diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2d616e439..6f6132878 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,6 +10,22 @@ jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
+ services:
+ postgres:
+ image: postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685
+ env:
+ POSTGRES_DB: teaql_rollup_279
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: teaql-example-ci-fixture-only
+ ports:
+ - 127.0.0.1:5432:5432
+ options: >-
+ --health-cmd "pg_isready -U postgres -d teaql_rollup_279"
+ --health-interval 5s --health-timeout 5s --health-retries 12
+ env:
+ TEAQL_TEST_POSTGRES_JDBC_URL: jdbc:postgresql://127.0.0.1:5432/teaql_rollup_279
+ TEAQL_TEST_POSTGRES_USER: postgres
+ TEAQL_TEST_POSTGRES_PASSWORD: teaql-example-ci-fixture-only
timeout-minutes: 150
permissions:
contents: read
@@ -22,6 +38,13 @@ jobs:
java-version: '21'
distribution: 'temurin'
cache: maven
+ - name: Mark dedicated PostgreSQL diagnostics fixture
+ run: |
+ docker exec -i -u postgres '${{ job.services.postgres.id }}' \
+ psql -X -v ON_ERROR_STOP=1 -d teaql_rollup_279 <<'SQL'
+ COMMENT ON DATABASE teaql_rollup_279 IS 'TeaQL #279 owned layered statistics fixture';
+ CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
+ SQL
- name: Build with Maven
run: mvn -B install
- name: Verify managed Jackson runtime versions
diff --git a/.github/workflows/example-gate.yml b/.github/workflows/example-gate.yml
index 5da0c01ac..92c19eea1 100644
--- a/.github/workflows/example-gate.yml
+++ b/.github/workflows/example-gate.yml
@@ -7,6 +7,18 @@ on:
jobs:
examples:
runs-on: ubuntu-latest
+ services:
+ postgres:
+ image: postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685
+ env:
+ POSTGRES_DB: teaql_rollup_279
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: teaql-example-ci-fixture-only
+ ports:
+ - 127.0.0.1:5432:5432
+ options: >-
+ --health-cmd "pg_isready -U postgres -d teaql_rollup_279"
+ --health-interval 5s --health-timeout 5s --health-retries 12
permissions:
contents: read
defaults:
@@ -18,6 +30,9 @@ jobs:
TEAQL_S3_BUCKET: teaql-java-example-ci
TEAQL_S3_ACCESS_KEY: teaql-java-example-ci
TEAQL_S3_SECRET_KEY: teaql-java-example-ci-fixture-only
+ TEAQL_TEST_POSTGRES_JDBC_URL: jdbc:postgresql://127.0.0.1:5432/teaql_rollup_279
+ TEAQL_TEST_POSTGRES_USER: postgres
+ TEAQL_TEST_POSTGRES_PASSWORD: teaql-example-ci-fixture-only
steps:
- name: Check out runtime under test
uses: actions/checkout@v4
@@ -30,13 +45,13 @@ jobs:
uses: actions/checkout@v4
with:
repository: teaql/teaql-code-gen
- ref: 554a1b7fa1e5c053e52290c3ee48925901cebe00
+ ref: 47a9c444599814aa0b85eea58e88344f7fe3c520
path: generator
ssh-key: ${{ secrets.TEAQL_CODEGEN_READONLY_DEPLOY_KEY }}
persist-credentials: false
- name: Verify pinned generator source
run: |
- test "$(git -C "$TEAQL_CODEGEN_DIR" rev-parse HEAD)" = 554a1b7fa1e5c053e52290c3ee48925901cebe00
+ test "$(git -C "$TEAQL_CODEGEN_DIR" rev-parse HEAD)" = 47a9c444599814aa0b85eea58e88344f7fe3c520
test -z "$(git -C "$TEAQL_CODEGEN_DIR" status --porcelain)"
- name: Install example verification tools
run: sudo apt-get update && sudo apt-get install -y ripgrep
@@ -45,6 +60,13 @@ jobs:
distribution: temurin
java-version: '21'
cache: maven
+ - name: Mark dedicated PostgreSQL diagnostics fixture
+ run: |
+ docker exec -i -u postgres '${{ job.services.postgres.id }}' \
+ psql -X -v ON_ERROR_STOP=1 -d teaql_rollup_279 <<'SQL'
+ COMMENT ON DATABASE teaql_rollup_279 IS 'TeaQL #279 owned layered statistics fixture';
+ CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
+ SQL
- name: Prime third-party dependencies for offline source-paired probes
# The gate copies third-party downloads into a disposable Maven home
# and explicitly excludes every TeaQL/model artifact from that cache.
@@ -70,6 +92,10 @@ jobs:
fs.rmSync(owned, {recursive: true});
}
NODE
+ # This job created every reactor target above. Retain dependency
+ # downloads, but return the ephemeral CI checkout to the target-free
+ # input required by source-paired inheritance verification.
+ mvn -B -ntp clean
- name: Start dedicated S3 example fixture
run: |
docker run -d --name teaql-java-example-s3 \
diff --git a/examples/business-id-runtime/pom.xml b/examples/business-id-runtime/pom.xml
index 40fa63595..4cd2051d7 100644
--- a/examples/business-id-runtime/pom.xml
+++ b/examples/business-id-runtime/pom.xml
@@ -6,7 +6,7 @@
io.teaql
teaql-java-parent
- 1.556-RELEASE
+ 1.557-RELEASE
../../pom.xml
teaql-business-id-example
diff --git a/examples/conformance/README.md b/examples/conformance/README.md
index 020d82198..3ab1ad9d5 100644
--- a/examples/conformance/README.md
+++ b/examples/conformance/README.md
@@ -38,6 +38,50 @@ clock/root and ordinary required/range vectors, not arbitrary custom context
fixers, a range-constrained generated default, security/TTL clock behavior or
the complete seven-runtime diagnostic contract.
+## Context-derived fields
+
+The focused Context-derived field gate is:
+
+```bash
+node examples/conformance/context-derived/verify-local.cjs
+```
+
+It compiles an unmodified two-object generated library with local runtime
+sources and runs typed Q/E and audited Save against one SQLite file twice.
+Different request time, IP, and actor do not update an unchanged object.
+A real edit applies update-scoped Context values and preserves create-only
+values. Failed validation restores automatic Context fields while retaining
+the caller's edit, which can be corrected or reverted. The application-owned
+Checker and metadata customization demonstrate the same guard for non-clock
+Context fields; generated timestamp assignments use that guard too.
+
+The same fixture also loads typed readonly query properties and persistent
+extensions. A readonly property does not dirty the entity. A dynamic-only edit
+does apply update-scoped Context values, while assigning its known persisted
+value again leaves SQL, version and committed audit unchanged. The extension
+provider shares the exact JDBC executor used by the owner graph transaction;
+there is no hand-written mutation SQL or separately committed extension write.
+
+`TEAQL_CONTEXT_FIX_EVIDENCE_DIR` chooses a new directory for compact receipts,
+logs, hashes and the SQLite store. Temporary source/build consumers are removed
+on exit. This is local source acceptance, not a public-package release or
+completion of every graph/dynamic-field case in all seven languages.
+
+## Natural Checker messages
+
+```bash
+node examples/conformance/natural-messages/verify-local.cjs
+```
+
+The [focused example](natural-messages/README.md) uses a separately evaluated,
+two-entity generated model and local runtime sources. Two rounds share one
+SQLite store. Actual generated Q/E and audited Save verify human-readable
+English/Chinese child-field messages, unchanged machine pointers and rule IDs,
+original UTF-16 validation length after masking, rejection before provider/audit
+calls, automatic Context rollback and successful correction. Presentation
+metadata is attached through the runtime module seam; automatic generator
+emission and published-package acceptance remain separate gates.
+
## Caller-owned Spring transactions
```bash
diff --git a/examples/conformance/context-derived/GeneratedContextFixTest.java b/examples/conformance/context-derived/GeneratedContextFixTest.java
new file mode 100644
index 000000000..79c9ecbf2
--- /dev/null
+++ b/examples/conformance/context-derived/GeneratedContextFixTest.java
@@ -0,0 +1,271 @@
+package io.teaql.examples.contextfix;
+
+import com.example.contextfixservice.*;
+import com.example.contextfixservice.entry.*;
+import io.teaql.core.*;
+import io.teaql.core.checker.*;
+import io.teaql.core.meta.*;
+import io.teaql.core.businessid.BusinessClock;
+import io.teaql.core.sqlite.SqliteDataServiceExecutor;
+import io.teaql.provider.jdbc.JdbcSqlExecutor;
+import io.teaql.runtime.*;
+import io.teaql.data.dynamic.*;
+import io.teaql.data.dynamic.jdbc.JdbcDynamicFieldsProvider;
+import java.time.*;
+import java.sql.*;
+import java.util.concurrent.atomic.*;
+import java.util.Map;
+import java.io.PrintWriter;
+import java.util.logging.Logger;
+import javax.sql.DataSource;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/** Application-owned customization of an unmodified generated library. */
+public class GeneratedContextFixTest {
+ static final LocalDateTime A = LocalDateTime.of(2026, 11, 11, 10, 0), B = A.plusHours(1);
+ static class Context extends DefaultUserContext {
+ Context(TeaQLRuntime runtime) { super(runtime); }
+ @Override @SuppressWarnings("unchecked") protected T evaluateExpression(String expression, Object... args) {
+ if ("uniStr".equals(expression)) {
+ if (Boolean.TRUE.equals(getAttribute("brokenContext")))
+ throw new IllegalStateException("PRIVATE_CONTEXT_PROVIDER_CANARY");
+ return (T) "fixture-token";
+ }
+ return null;
+ }
+ }
+ static class ContextChecker extends EntryChecker {
+ @Override public void doCheck(UserContext context, Entry row, ObjectLocation location) {
+ // Freeze eligibility before the first automatic assignment.
+ boolean eligible = needContextFix(context, row);
+ if (eligible) {
+ if (row.isNew()) {
+ row.updateSourceIp(context.getAttribute("clientIp", String.class));
+ row.updateOpenedBy(context.getAttribute("actor", String.class));
+ }
+ row.updateLastIp(context.getAttribute("clientIp", String.class));
+ row.updateChangedBy(context.getAttribute("actor", String.class));
+ }
+ super.doCheck(context, row, location);
+ if ("NORMALIZE".equals(row.getName())) row.updateName("entry");
+ if ("INVALID".equals(row.getName())) invalidTypeCheck(context, newLocation(location, "name"), "fixture rejection");
+ }
+ }
+
+ @Test public void generatedQAndEAuditedSaveUsesContextOnlyForRealChanges() throws Exception {
+ String source = System.getProperty("teaql.expected.runtime.root");
+ if (source != null) assertTrue(java.nio.file.Path.of(TeaQLRuntime.class.getProtectionDomain().getCodeSource().getLocation().toURI())
+ .startsWith(java.nio.file.Path.of(source)));
+ String database = System.getenv("TEAQL_CONTEXT_FIX_DB");
+ assertNotNull("use an owned persistent SQLite path", database);
+ var ds = new Source("jdbc:sqlite:" + database);
+ var metadata = new SimpleEntityMetaFactory();
+ var sql = new JdbcSqlExecutor(ds);
+ var data = new SqliteDataServiceExecutor("sqlite", sql, ds);
+ var ids = new AtomicLong(System.currentTimeMillis());
+ var runtime = TeaQLRuntime.builder().metadata(metadata).dataService("sqlite", data)
+ .dataService("default", data).idGenerationService(new InternalIdGenerationService() {
+ public Long generateId(UserContext ctx, Entity row) { return ids.incrementAndGet(); }
+ public void ensureFloor(String type, long floor) { ids.accumulateAndGet(floor, Math::max); }
+ })
+ .businessClock(new BusinessClock() {
+ public LocalDate businessDate(UserContext ctx) { return businessDateTime(ctx).toLocalDate(); }
+ public LocalDateTime businessDateTime(UserContext ctx) { return ctx.getAttribute("businessNow", LocalDateTime.class); }
+ }).executionLogging(false).build();
+ runtime.install(GeneratedRuntimeModule.module());
+ var descriptor = metadata.resolveEntityDescriptor("Entry");
+ // Supported model-aware customization; never patch the emitted library.
+ descriptor.findProperty("source_ip").with("createFunction", "clientIp");
+ descriptor.findProperty("opened_by").with("createFunction", "actor");
+ descriptor.findProperty("last_ip").with("updateFunction", "clientIp");
+ descriptor.findProperty("changed_by").with("updateFunction", "actor");
+ runtime.install(RuntimeModule.of().withCheckers(new ContextChecker()));
+ var context = new Context(runtime);
+ context.putAttribute("businessNow", A); context.putAttribute("clientIp", "192.0.2.10"); context.putAttribute("actor", "alice");
+ context.ensureSchema();
+ var roots = Q.catalogs().limit(1).comment("find fixture root").purpose("verify Context save").executeForList(context);
+ var catalog = roots.isEmpty() ? Q.catalogs().comment("create fixture root").purpose("verify Context save").newEntity(context) : roots.get(0);
+ if (catalog.isNew()) { catalog.updateName("Catalog"); catalog.auditAs("create Context fixture root").save(context); }
+ context.withActiveRoot(new ContextEntityRef("Catalog", catalog.getId()));
+ var failedCreate = Q.entries().comment("create with broken Context supplier").purpose("verify Fix location").newEntity(context);
+ failedCreate.updateName("failed"); failedCreate.updateCatalog(catalog);
+ context.putAttribute("brokenContext", true);
+ int beforeFixFailure = ds.calls.get();
+ var fixError = assertThrows(CheckException.class,
+ () -> failedCreate.auditAs("reject broken Context supplier").save(context));
+ assertEquals("Entry", fixError.getViolates().get(0).getRootType());
+ assertEquals("/guardedToken", fixError.getViolates().get(0).getLocation().instancePath());
+ assertTrue(fixError.getMessage().contains("guarded_token"));
+ assertFalse(fixError.getMessage().contains("PRIVATE_CONTEXT_PROVIDER_CANARY"));
+ assertEquals(beforeFixFailure, ds.calls.get());
+ assertNull(failedCreate.getBornAt()); assertNull(failedCreate.getLastIp());
+ assertEquals("failed", failedCreate.getName());
+ context.putAttribute("brokenContext", false);
+ var row = Q.entries().comment("create Context fixture").purpose("verify generated Context injection").newEntity(context);
+ row.updateName("entry"); row.updateCatalog(catalog); row.auditAs("create Context fixture").save(context);
+ long id = row.getId();
+ assertEquals(A, row.getBornAt()); assertEquals("alice", row.getOpenedBy());
+
+ var audit = new AtomicInteger();
+ context.putAttribute(AppAuditEventSink.class.getName(), (AppAuditEventSink) (ctx, event) -> audit.incrementAndGet());
+ context.putAttribute("businessNow", B); context.putAttribute("clientIp", "192.0.2.20"); context.putAttribute("actor", "bob");
+ row = Q.entries().withIdIs(id).limit(1).comment("reload full fixture").purpose("verify no-op").executeForList(context).get(0);
+ long version = row.getVersion(); int connections = ds.calls.get();
+ row.auditAs("first unchanged save under Context B").save(context);
+ row.auditAs("second unchanged save under Context B").save(context);
+ assertEquals(connections, ds.calls.get()); assertEquals(0, audit.get());
+ assertEquals(Long.valueOf(version), row.getVersion()); assertEquals(A, row.getTouchedAt());
+ assertEquals("192.0.2.10", row.getLastIp()); assertEquals("alice", row.getChangedBy());
+
+ row.updateName("NORMALIZE");
+ row.auditAs("normalize business edit back to its persisted value").save(context);
+ assertEquals("a repaired no-op must not acquire a connection", connections, ds.calls.get());
+ assertEquals(0, audit.get()); assertEquals(Long.valueOf(version), row.getVersion());
+ assertEquals("entry", row.getName()); assertEquals(A, row.getTouchedAt());
+ assertEquals("192.0.2.10", row.getLastIp()); assertEquals("alice", row.getChangedBy());
+
+ row.updateName("INVALID"); Entry invalid = row;
+ connections = ds.calls.get();
+ var error = assertThrows(CheckException.class, () -> invalid.auditAs("reject Context fixture").save(context));
+ assertEquals("Entry", error.getViolates().get(0).getRootType());
+ assertEquals("/name", error.getViolates().get(0).getLocation().instancePath());
+ assertEquals(connections, ds.calls.get()); assertEquals(0, audit.get());
+ assertEquals(A, row.getTouchedAt()); assertEquals("192.0.2.10", row.getLastIp());
+ assertEquals("INVALID", row.getName());
+ row.updateName("entry"); row.auditAs("cancel failed caller edit").save(context);
+ assertEquals(connections, ds.calls.get());
+
+ context.putAttribute("clientIp", "x".repeat(101)); row.updateName("blocked"); Entry invalidContext = row;
+ var contextError = assertThrows(CheckException.class,
+ () -> invalidContext.auditAs("reject invalid Context IP").save(context));
+ var ipError = contextError.getViolates().stream()
+ .filter(item -> "last_ip".equals(item.getLocation().modelPath())).findFirst().orElseThrow();
+ assertEquals("Entry", ipError.getRootType());
+ assertEquals("/lastIp", ipError.getLocation().instancePath());
+ assertEquals(connections, ds.calls.get()); assertEquals(0, audit.get());
+ assertEquals("192.0.2.10", row.getLastIp());
+ context.putAttribute("clientIp", "192.0.2.20");
+ row.updateName("updated"); row.auditAs("real business update under Context B").save(context);
+ assertEquals(1, audit.get());
+ var persisted = Q.entries().withIdIs(id).limit(1).comment("read back real update").purpose("verify SQLite persistence").executeForList(context).get(0);
+ assertEquals("updated", E.entry(persisted).getName().eval());
+ assertEquals(A, persisted.getBornAt()); assertEquals("192.0.2.10", persisted.getSourceIp());
+ assertEquals("alice", persisted.getOpenedBy()); assertEquals(B, persisted.getTouchedAt());
+ assertEquals("192.0.2.20", persisted.getLastIp()); assertEquals("bob", persisted.getChangedBy());
+ assertEquals(Long.valueOf(version + 1), persisted.getVersion());
+ // A computed result belongs to the query view, not the mutation ledger.
+ var readonlyRequest = Q.entries().withIdIs(id).limit(1);
+ readonlyRequest.setDynamicPropertyMetadata(new DynamicPropertyMetadata(Map.of("_name_copy", String.class)));
+ readonlyRequest.addSimpleDynamicProperty("_name_copy", new PropertyReference("name"));
+ var readonly = readonlyRequest.comment("Load a typed readonly query result")
+ .purpose("Prove view materialization is not a business edit").executeForOne(context);
+ assertEquals(persisted.getName(), readonly.getDynamicProperty("_name_copy"));
+ assertTrue(readonly.getUpdatedProperties().isEmpty());
+ context.putAttribute("businessNow", B.plusHours(1));
+ context.putAttribute("clientIp", "192.0.2.30"); context.putAttribute("actor", "carol");
+ connections = ds.calls.get(); int auditsBefore = audit.get();
+ for (int attempt = 0; attempt < 2; attempt++)
+ readonly.auditAs("Retain readonly properties without Context-only writes").save(context);
+ assertEquals(connections, ds.calls.get()); assertEquals(auditsBefore, audit.get());
+ assertEquals(Long.valueOf(version + 1), readonly.getVersion()); assertEquals(B, readonly.getTouchedAt());
+ assertEquals(persisted.getName(), readonly.getDynamicProperty("_name_copy"));
+
+ // Persist extensions through the same audited graph boundary and exact JDBC executor.
+ var provider = new JdbcDynamicFieldsProvider(sql); provider.ensureSchema();
+ DynamicFieldContext definitionContext = new DynamicFieldContext() {
+ public String scopeType() { return "GLOBAL"; }
+ public String scopeId() { return "default"; }
+ public String userId() { return "context-example"; }
+ public String purpose() { return "Verify Context Fix for persistent extensions"; }
+ public String comment() { return "Register a controlled extension definition"; }
+ public boolean strictIntent() { return true; }
+ public long nextId(String type) { return ids.incrementAndGet(); }
+ };
+ if (provider.listFieldDefs(definitionContext, "Entry").stream().noneMatch(def -> "context_note".equals(def.getCode()))) {
+ var def = new DynamicFieldDef(); def.setScope(DynamicFieldScope.global()); def.setOwnerType("Entry");
+ def.setCode("context_note"); def.setName("Context note"); def.setDataType(DynamicDataType.STRING);
+ provider.registerFieldDef(definitionContext, def);
+ }
+ context.putAttribute(DynamicFieldsFacade.class.getName(),
+ new DefaultDynamicFieldsFacade(provider).withIdGenerator(type -> ids.incrementAndGet()));
+ var dynamicRequest = Q.entries().withIdIs(id).limit(1);
+ dynamicRequest.selectDynamicFieldsWith(new DynamicFieldSelection().selectString("context_note"));
+ var dynamic = dynamicRequest.comment("Load typed extension definitions and values")
+ .purpose("Update only a persistent dynamic field").executeForOne(context);
+ assertEquals(DynamicFieldValue.State.NOT_LOADED, dynamic.dynamicFields().field("context_note").state());
+ dynamic.updateDynamicField("context_note", "dynamic-only");
+ assertTrue(dynamic.getUpdatedProperties().isEmpty());
+ auditsBefore = audit.get();
+ dynamic.auditAs("Persist a dynamic-only business edit with Context defaults").save(context);
+ assertEquals(auditsBefore + 1, audit.get());
+ assertEquals(Long.valueOf(version + 2), dynamic.getVersion());
+ assertEquals(B.plusHours(1), dynamic.getTouchedAt()); assertEquals("carol", dynamic.getChangedBy());
+ assertEquals(A, dynamic.getBornAt()); assertEquals("alice", dynamic.getOpenedBy());
+ var checkRequest = Q.entries().withIdIs(id).limit(1);
+ checkRequest.selectDynamicFieldsWith(new DynamicFieldSelection().selectString("context_note"));
+ var storedDynamic = checkRequest.comment("Read the committed extension and owner")
+ .purpose("Compare typed E and persistent extension readback").executeForOne(context);
+ assertEquals("dynamic-only", storedDynamic.dynamicFields().field("context_note").value());
+ assertEquals(B.plusHours(1), E.entry(storedDynamic).getTouchedAt().eval());
+ context.putAttribute("businessNow", B.plusHours(2)); context.putAttribute("actor", "dora");
+ context.putAttribute("clientIp", "192.0.2.40");
+ storedDynamic.updateDynamicField("context_note", "dynamic-only");
+ connections = ds.calls.get(); auditsBefore = audit.get();
+ storedDynamic.auditAs("An equal persistent extension is not a Context update").save(context);
+ assertEquals(connections, ds.calls.get()); assertEquals(auditsBefore, audit.get());
+ assertEquals(Long.valueOf(version + 2), storedDynamic.getVersion());
+ assertEquals("carol", storedDynamic.getChangedBy());
+ // Repeat indexed failure/undo using real generated relationships, not a test-only carrier.
+ var graphRoot = Q.catalogs().comment("Create a separate generated graph owner")
+ .purpose("Verify indexed Checker locations before graph writes").newEntity(context);
+ graphRoot.updateName("graph-root"); graphRoot.auditAs("Create an isolated graph root").save(context);
+ context.withActiveRoot(new ContextEntityRef("Catalog", graphRoot.getId()));
+ for (String name : java.util.List.of("graph-first", "graph-second")) {
+ var child = Q.entries().comment("Prepare one generated graph child")
+ .purpose("Verify all children before persistence").newEntity(context);
+ child.updateName(name); child.updateCatalog(graphRoot); child.auditAs("Create a graph child").save(context);
+ }
+ var parent = Q.catalogs().withIdIs(graphRoot.getId()).limit(1)
+ .selectEntryListWith(Q.entries().orderByIdAscending().limit(10))
+ .comment("Load the generated parent and both children")
+ .purpose("Verify exact child index and rollback of automatic Context values").executeForOne(context);
+ assertEquals(2, parent.getEntryList().size());
+ var first = parent.getEntryList().get(0); var second = parent.getEntryList().get(1);
+ long parentVersion = parent.getVersion(), secondVersion = second.getVersion();
+ LocalDateTime graphBefore = first.getTouchedAt();
+ context.putAttribute("businessNow", B.plusHours(3)); context.putAttribute("actor", "eve");
+ context.putAttribute("clientIp", "192.0.2.50");
+ first.updateName("changed-child"); second.updateName("INVALID");
+ connections = ds.calls.get(); auditsBefore = audit.get();
+ var childError = assertThrows(CheckException.class,
+ () -> parent.auditAs("Reject a later invalid child before any graph write").save(context));
+ assertTrue(childError.getViolates().stream().anyMatch(v -> "/entryList/1/name".equals(v.getLocation().instancePath())));
+ assertEquals(connections, ds.calls.get()); assertEquals(auditsBefore, audit.get());
+ assertEquals(graphBefore, first.getTouchedAt()); assertEquals("dora", first.getChangedBy());
+ first.updateName("graph-first"); second.updateName("graph-second");
+ parent.auditAs("Undo rejected graph edits without retaining automatic Context changes").save(context);
+ assertEquals(connections, ds.calls.get()); assertEquals(auditsBefore, audit.get());
+ first.updateName("accepted-child"); parent.auditAs("Save only the genuinely changed generated child").save(context);
+ assertEquals(auditsBefore + 1, audit.get()); assertEquals(Long.valueOf(parentVersion), parent.getVersion());
+ assertEquals(Long.valueOf(secondVersion), second.getVersion());
+ var storedChild = Q.entries().withIdIs(first.getId()).limit(1)
+ .comment("Read the accepted graph child").purpose("Verify typed E after indexed failure and retry").executeForOne(context);
+ assertEquals("accepted-child", E.entry(storedChild).getName().eval()); assertEquals("eve", storedChild.getChangedBy());
+ assertEquals(B.plusHours(3), E.entry(storedChild).getTouchedAt().eval());
+ System.out.println("JAVA_CONTEXT_FIX_GRAPH=passed indexedLocation=true automaticUndo=true childOnly=true");
+ System.out.println("JAVA_CONTEXT_FIX_EXTENSIONS=passed dynamicOnly=true readonlyNoop=true equalDynamicNoop=true");
+ System.out.println("JAVA_CONTEXT_FIX_SQLITE=passed typedQ=true typedE=true noOpProviderCalls=0 failedCheckProviderCalls=0 updateAudits=1 objectLocation=true");
+ }
+
+ static final class Source implements DataSource {
+ final String url; final AtomicInteger calls = new AtomicInteger(); Source(String url) { this.url = url; }
+ public Connection getConnection() throws SQLException { calls.incrementAndGet(); return DriverManager.getConnection(url); }
+ public Connection getConnection(String u, String p) throws SQLException { return getConnection(); }
+ public PrintWriter getLogWriter() { return null; } public void setLogWriter(PrintWriter writer) {}
+ public void setLoginTimeout(int timeout) {} public int getLoginTimeout() { return 0; }
+ public Logger getParentLogger() { return Logger.getGlobal(); }
+ public T unwrap(Class type) throws SQLException { throw new SQLException("not a wrapper"); }
+ public boolean isWrapperFor(Class> type) { return false; }
+ }
+}
diff --git a/examples/conformance/context-derived/fixture/generated-files.json b/examples/conformance/context-derived/fixture/generated-files.json
new file mode 100644
index 000000000..1b30188c9
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/generated-files.json
@@ -0,0 +1,25 @@
+{
+ "lib/pom.xml" : "d84156f85a56541ad74bc068af3edd47c453c7840c8f98bf5665450d8af882c3",
+ "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" : "98b2b2452053aaa185f488583c58aa5e631cc25df68ec6479c84beed3bf6e97a",
+ "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" : "2d3dd418617a5c07c56f9fb7ec3df4f3358cd09ad3c16b9479bcb8726ec13519",
+ "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" : "6981d1fe40f62e54294e5635ac213906edb11f1b89243dbc86928895262d41ac",
+ "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" : "236cd90c149323654912dcb508f5603e60226fdcdfaa4851115a58a133c0606c"
+}
diff --git a/examples/conformance/context-derived/fixture/lib/pom.xml b/examples/conformance/context-derived/fixture/lib/pom.xml
new file mode 100644
index 000000000..9dbc9977b
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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
+ 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/fixture/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java
new file mode 100644
index 000000000..e69de29bb
diff --git a/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/Checkers.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/Checkers.java
new file mode 100644
index 000000000..e69de29bb
diff --git a/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/Constants.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/Constants.java
new file mode 100644
index 000000000..f359466e1
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java
new file mode 100644
index 000000000..4e02f8d3f
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/E.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/E.java
new file mode 100644
index 000000000..ce74647eb
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java
new file mode 100644
index 000000000..d871642c1
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java
@@ -0,0 +1,303 @@
+
+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.setAuditMaskFields(java.util.List.of());
+ 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/fixture/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java
new file mode 100644
index 000000000..9ad995608
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/Q.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/Q.java
new file mode 100644
index 000000000..b8c9d8f3a
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/Repositories.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/Repositories.java
new file mode 100644
index 000000000..e69de29bb
diff --git a/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java
new file mode 100644
index 000000000..7ab1bb4e6
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java
new file mode 100644
index 000000000..b00ede579
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java
new file mode 100644
index 000000000..34e0edeb3
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java
new file mode 100644
index 000000000..a10d96871
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java
new file mode 100644
index 000000000..0681d09e8
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java
@@ -0,0 +1,579 @@
+
+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;
+
+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 extends T> factory){
+ super(returnType, factory);
+ selectId();
+ selectVersion();
+ }
+
+ public CatalogRequest comment(String comment){
+ super.internalComment(comment);
+ return this;
+ }
+
+ // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法)
+
+ public CatalogRequest returnType(Class extends T> 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 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/fixture/lib/src/main/java/com/example/contextfixservice/entry/Entry.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/entry/Entry.java
new file mode 100644
index 000000000..c4f863c90
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java
new file mode 100644
index 000000000..46bc7e8f1
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java
new file mode 100644
index 000000000..b61497cdf
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java
new file mode 100644
index 000000000..3c0ef9888
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/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/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java
new file mode 100644
index 000000000..6c494b208
--- /dev/null
+++ b/examples/conformance/context-derived/fixture/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java
@@ -0,0 +1,1583 @@
+
+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;
+
+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 extends T> factory){
+ super(returnType, factory);
+ selectId();
+ selectVersion();
+ }
+
+ public EntryRequest comment(String comment){
+ super.internalComment(comment);
+ return this;
+ }
+
+ // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法)
+
+ public EntryRequest returnType(Class extends T> 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 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