diff --git a/.github/workflows/example-gate.yml b/.github/workflows/example-gate.yml index 5c69f2892..5da0c01ac 100644 --- a/.github/workflows/example-gate.yml +++ b/.github/workflows/example-gate.yml @@ -7,13 +7,37 @@ on: jobs: examples: runs-on: ubuntu-latest + permissions: + contents: read + defaults: + run: + working-directory: runtime env: + TEAQL_CODEGEN_DIR: ${{ github.workspace }}/generator TEAQL_S3_ENDPOINT: http://127.0.0.1:19010 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 steps: - - uses: actions/checkout@v4 + - name: Check out runtime under test + uses: actions/checkout@v4 + with: + path: runtime + persist-credentials: false + # This key is a read-only deploy key on this one private repository, + # not a personal token. Fork PRs receive no repository secrets. + - name: Check out qualified generator + uses: actions/checkout@v4 + with: + repository: teaql/teaql-code-gen + ref: 554a1b7fa1e5c053e52290c3ee48925901cebe00 + 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 -z "$(git -C "$TEAQL_CODEGEN_DIR" status --porcelain)" - name: Install example verification tools run: sudo apt-get update && sudo apt-get install -y ripgrep - uses: actions/setup-java@v4 @@ -21,6 +45,31 @@ jobs: distribution: temurin java-version: '21' cache: maven + - 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. + # Keep its offline checks; prepare a fresh runner before they start. + run: | + mvn -B -ntp install + node <<'NODE' + const fs = require('node:fs'), path = require('node:path'), os = require('node:os'), cp = require('node:child_process'); + const runtime = process.cwd(), owned = fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-ci-example-dependencies-')); + try { + const poms = cp.execFileSync('git', ['ls-files', '-z', 'examples'], {encoding: 'utf8'}) + .split('\0').filter(name => name.endsWith('/lib/pom.xml')); + if (poms.length === 0) throw new Error('No generated library dependency manifests'); + for (const relative of poms) { + const selected = path.join(owned, relative); + fs.mkdirSync(path.dirname(selected), {recursive: true}); + fs.copyFileSync(path.join(runtime, relative), selected); + require('./scripts/pin-local-example-pom.cjs').pin(selected, runtime, owned); + cp.execFileSync('mvn', ['-B', '-ntp', '-f', selected, + 'org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline'], {stdio: 'inherit'}); + } + } finally { + fs.rmSync(owned, {recursive: true}); + } + NODE - 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 a21961011..40fa63595 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.555-RELEASE + 1.556-RELEASE ../../pom.xml teaql-business-id-example diff --git a/examples/conformance/README.md b/examples/conformance/README.md index 83fe762de..020d82198 100644 --- a/examples/conformance/README.md +++ b/examples/conformance/README.md @@ -16,3 +16,53 @@ using an isolated temporary SQLite database for each run. The generated Runtime Module is installed at application startup but remains a passive manifest. Schema reconciliation is invoked separately and explicitly. + +## Generated Fix postconditions and safe provenance + +```bash +node examples/fix-e-alignment/verify-local.cjs +``` + +The unchanged three-object model supplies a parent and child with required +context-root references and create/update timestamps. Three additional +application-owned tests assert typed managed defaults before validation, +unchanged ordinary business inputs read back with generated Q/E, and exactly +one immutable, value-free provenance entry per fixed field. Invalid required +and range inputs fail after Fix with zero provider reads, writes or transactions; +corrected input then saves in a fresh invocation. Both rounds use the same +SQLite files without cleanup between them. + +`TEAQL_FIX_E_EVIDENCE_DIR` selects a new absolute directory for compact logs, +hashes and databases. Build output is removed on exit. This proves the declared +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. + +## Caller-owned Spring transactions + +```bash +node examples/conformance/spring-transactions/verify-local.cjs +``` + +This focused source-paired gate reuses the unchanged two-object generated library. +Business operations use generated Q/E and audited Save, with an application-owned +Spring `DataSourceTransactionManager` over a real SQLite file. Eight scenarios +run twice on the same stores: sparse no-op plus outer commit; outer rollback and +latest-intent retry; nested rollback; equal-position/repeated savepoints; +`REQUIRES_NEW` isolation; post-commit audit delivery failure; pre-provider Checker +and intent rejection; and an actual second graph-write failure followed by retry. +Independent SQL is used only for readback and controlled trigger fault injection, +not to implement application persistence. Audit observers verify committed rows +through an independent connection, outside the completed Spring owner. + +Set `TEAQL_JAVA_SPRING_EVIDENCE_DIR` to a new absolute directory to retain compact +logs, JUnit XML, hashes and databases there. Builds and isolated dependency copies +are removed on exit; no TeaQL artifacts are borrowed from the Maven cache and no +shared install/deploy is performed. `--baseline` executes the same application +against the pre-fix `6d162bb0` production archive and intentionally exits nonzero +when it reproduces a failed assertion; that is not a passing runtime gate. + +The complete example script includes this gate. This is SQLite plus Spring JDBC, +not JTA/reactive/custom-manager or installed-artifact acceptance. The model has no +Decimal field: exact Decimal registration for Spring-backed SQLite is a separate +provider boundary, not implemented by a fake function in this example. diff --git a/examples/conformance/lib/pom.xml b/examples/conformance/lib/pom.xml index 7e2df1b40..8606fff55 100644 --- a/examples/conformance/lib/pom.xml +++ b/examples/conformance/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 1.556-RELEASE UTF-8 true diff --git a/examples/conformance/pom.xml b/examples/conformance/pom.xml index 492d0b693..4374ef62f 100644 --- a/examples/conformance/pom.xml +++ b/examples/conformance/pom.xml @@ -16,7 +16,7 @@ 1.0.0 UTF-8 true - 1.555-RELEASE + 1.556-RELEASE diff --git a/examples/conformance/spring-transactions/GeneratedSpringTransactionTest.java b/examples/conformance/spring-transactions/GeneratedSpringTransactionTest.java new file mode 100644 index 000000000..e83d231eb --- /dev/null +++ b/examples/conformance/spring-transactions/GeneratedSpringTransactionTest.java @@ -0,0 +1,298 @@ +package com.teaql.runtimeexampleconformanceservice; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.runtimeexampleconformanceservice.platform.Platform; +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.provider.springjdbc.SpringJdbcSqlExecutor; +import io.teaql.runtime.*; +import java.nio.file.Path; +import java.sql.*; +import java.util.*; +import java.util.concurrent.atomic.AtomicLong; +import org.junit.Test; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.support.TransactionTemplate; +import org.sqlite.Function; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Application-owned business calls. SQL below is an independent oracle/fault injector only. */ +public class GeneratedSpringTransactionTest { + static final class Context extends DefaultUserContext implements RuntimeExampleConformanceServiceUserContext { + Context(TeaQLRuntime runtime) { super(runtime); } + } + + static final class Source extends SQLiteDataSource { + long connections; + final List written = new ArrayList<>(), rejected = new ArrayList<>(); + @Override public Connection getConnection() throws SQLException { + connections++; + var connection = super.getConnection(); + Function.create(connection, "spring_written", new Function() { + protected void xFunc() throws SQLException { written.add(value_long(0)); result(0); } + }); + Function.create(connection, "spring_rejected", new Function() { + protected void xFunc() throws SQLException { rejected.add(value_long(0)); result(0); } + }); + return connection; + } + } + + static final class Fixture { + final int round = Integer.parseInt(System.getenv("TEAQL_SPRING_ROUND")); + final String kind, url; + final Source source = new Source(); + final SpringJdbcSqlExecutor sql; + final DataSourceTransactionManager manager; + final List audits = new ArrayList<>(); + final List policies = new ArrayList<>(); + final Context context; + final Platform root; + boolean failDelivery; + + Fixture(String kind) throws Exception { + this.kind = kind; + url = "jdbc:sqlite:" + Path.of(System.getenv("TEAQL_SPRING_DB_ROOT"), kind + ".sqlite").toAbsolutePath(); + source.setUrl(url); + sql = new SpringJdbcSqlExecutor(new NamedParameterJdbcTemplate(source)); + manager = new DataSourceTransactionManager(source); + var service = new SqliteDataServiceExecutor("sqlite", sql, source); + var ids = new AtomicLong(round * 1000L); + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { return new MutationPolicyIdentity("spring-example", "1", "sha256:spring-example"); } + public MutationDecision review(UserContext caller, MutationPlan plan) { policies.add(plan); return MutationDecision.allow(); } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(new InternalIdGenerationService() { + public Long generateId(UserContext caller, Entity entity) { return ids.incrementAndGet(); } + public void ensureFloor(String type, long floor) { ids.accumulateAndGet(floor, Math::max); } + }) + .executionLogging(false).mutationPolicyRegistry(key -> Optional.of(policy)) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller, ExecutionMetadata event) {} + public void writeAuditEvent(UserContext caller, RawAuditEvent event) { + assertFalse("audit cannot reuse the completed physical owner", sql.hasActiveTransaction()); + // A separate connection must observe committed data before delivery. + if (event.entityType().equals("WorkItem")) { + try { assertTrue(version((Long) event.entityId()) >= event.resultingVersion()); } + catch (SQLException error) { throw new IllegalStateException(error); } + } + audits.add(event); + if (failDelivery) throw new IllegalStateException("EXPECTED_AUDIT_DELIVERY_FAILURE"); + } + }).build().install(GeneratedRuntimeModule.module()); + context = new Context(runtime); + context.ensureSchema(); + root = Q.platforms().withIdIs(1L).limit(1).comment("Load the system-provided root") + .purpose("Attach the Spring transaction example to its domain root").executeForOne(context); + assertNotNull(root); + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(BaseEntity.class, TeaQLRuntime.class, SpringJdbcSqlExecutor.class, SqliteDataServiceExecutor.class)) { + var origin = Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath(); + assertTrue("source-paired runtime origin: " + type.getName(), origin.startsWith(expected)); + } + } + + TransactionTemplate transaction(int propagation) { + var template = new TransactionTemplate(manager); template.setPropagationBehavior(propagation); return template; + } + TransactionTemplate transaction() { return transaction(TransactionDefinition.PROPAGATION_REQUIRED); } + WorkItem create(String title) { + return Q.workItems().comment("Prepare a Spring work item").purpose("Verify audited business persistence") + .newEntity(context).updatePlatform(root).updateTitle(title).updateDescription(null) + .auditAs("Seed the Spring transaction example").save(context); + } + WorkItem load(long id) { + return Q.workItems().withIdIs(id).limit(1).comment("Load every scalar field before mutation") + .purpose("Keep the original optimistic baseline").executeForOne(context); + } + long version(long id) throws SQLException { + try (var connection = DriverManager.getConnection(url); + var query = connection.prepareStatement("SELECT version FROM work_item_data WHERE id=?")) { + query.setLong(1, id); try (var rows = query.executeQuery()) { assertTrue(rows.next()); return rows.getLong(1); } + } + } + void oracle(long id, String title, String description, long version) throws SQLException { + try (var connection = DriverManager.getConnection(url); + var query = connection.prepareStatement("SELECT title,description,version,platform FROM work_item_data WHERE id=?")) { + query.setLong(1, id); + try (var rows = query.executeQuery()) { + assertTrue(rows.next()); assertEquals(title, rows.getString(1)); assertEquals(description, rows.getString(2)); + assertEquals(version, rows.getLong(3)); assertEquals(root.getId().longValue(), rows.getLong(4)); assertFalse(rows.next()); + } + } + } + void emit(Map observations) throws Exception { + var value = new LinkedHashMap(); value.put("passed", true); value.put("case", kind); + value.put("round", round); value.put("observations", observations); + var stored = new ArrayList>(); + try (var connection = DriverManager.getConnection(url); var statement = connection.createStatement(); + var rows = statement.executeQuery("SELECT id,title,description,version,platform FROM work_item_data ORDER BY id")) { + while (rows.next()) { + var row = new LinkedHashMap(); row.put("id", rows.getLong(1)); row.put("title", rows.getString(2)); + row.put("description", rows.getString(3)); row.put("version", rows.getLong(4)); row.put("platform", rows.getLong(5)); stored.add(row); + } + } + value.put("stored", stored); + System.out.println("JAVA_SPRING_BUSINESS=" + new ObjectMapper().writeValueAsString(value)); + } + } + + @Test public void outerCommitKeepsSparseNoopAndDefersAudit() throws Exception { + var f = new Fixture("outer-commit-noop"); var clean = f.create("Unchanged"); var row = f.create("Original"); + var view = Q.workItemsWithMinimalFields().withIdIs(clean.getId()).selectTitle().limit(1) + .selectPlatformWith(Q.platformsWithMinimalFields().selectName()) + .comment("Load a sparse display view").purpose("Preserve NotLoaded through an unchanged save").executeForOne(f.context); + var state = view.__internalLoadState(); int audits = f.audits.size(), policies = f.policies.size(); + f.transaction().executeWithoutResult(status -> { + long calls = f.source.connections; view.updateTitle("Temporary").updateTitle("Unchanged"); + view.auditAs("Keep a sparse no-op inside the caller transaction").save(f.context); + assertEquals(calls, f.source.connections); assertSame(state, view.__internalLoadState()); + assertThrows(TeaQLNotLoadedException.class, () -> E.workItem(view).getDescription().eval()); + row.updateTitle("Committed").auditAs("Commit the actual business edit").save(f.context); + assertEquals("audit waits for physical commit", audits, f.audits.size()); assertTrue(f.sql.hasActiveTransaction()); + }); + assertEquals(audits + 1, f.audits.size()); assertEquals(policies + 1, f.policies.size()); + assertEquals("Committed", E.workItem(f.load(row.getId())).getTitle().eval()); + assertSame(state, view.__internalLoadState()); assertEquals(Long.valueOf(1), view.getVersion()); + f.oracle(row.getId(), "Committed", null, 2); f.oracle(clean.getId(), "Unchanged", null, 1); + f.emit(Map.of("auditDelta", 1, "policyDelta", 1, "id", row.getId(), "unchangedId", clean.getId())); + } + + @Test public void outerRollbackRetainsLatestIntentForOneRetry() throws Exception { + var f = new Fixture("outer-rollback-retry"); var row = f.load(f.create("Original").getId()); int audits = f.audits.size(); + var error = assertThrows(IllegalStateException.class, () -> f.transaction().executeWithoutResult(status -> { + row.updateTitle("First").auditAs("Stage the first edit").save(f.context); + row.updateTitle("Latest").auditAs("Stage the latest edit").save(f.context); + row.updateDescription("Unsaved later input"); assertEquals(audits, f.audits.size()); + throw new IllegalStateException("EXPECTED_OUTER_ROLLBACK"); + })); + assertEquals("EXPECTED_OUTER_ROLLBACK", error.getMessage()); assertEquals(audits, f.audits.size()); + assertEquals(Long.valueOf(1), row.getVersion()); assertEquals("Latest", E.workItem(row).getTitle().eval()); + assertEquals("Unsaved later input", E.workItem(row).getDescription().eval()); + assertTrue(row.getUpdatedProperties().containsAll(List.of("title", "description"))); + f.oracle(row.getId(), "Original", null, 1); + row.auditAs("Retry final business intent once").save(f.context); + assertEquals(audits + 1, f.audits.size()); assertEquals(Long.valueOf(2), row.getVersion()); + f.oracle(row.getId(), "Latest", "Unsaved later input", 2); + f.emit(Map.of("auditDelta", 1, "id", row.getId(), "finalVersion", row.getVersion())); + } + + @Test public void nestedRollbackRestoresOnlyInnerBusinessMutation() throws Exception { + var f = new Fixture("nested-rollback"); var outer = f.create("Outer original"); var inner = f.create("Inner original"); + int audits = f.audits.size(); + f.transaction().executeWithoutResult(status -> { + outer.updateTitle("Outer committed").auditAs("Commit only the outer business object").save(f.context); + f.transaction(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(nested -> { + inner.updateTitle("Inner retry").auditAs("Abandon the nested business attempt").save(f.context); nested.setRollbackOnly(); + }); + assertEquals(audits, f.audits.size()); assertEquals(Long.valueOf(1), inner.getVersion()); + assertTrue(inner.getUpdatedProperties().contains("title")); assertEquals("Inner retry", E.workItem(inner).getTitle().eval()); + assertEquals("Inner original", E.workItem(f.load(inner.getId())).getTitle().eval()); + }); + assertEquals(audits + 1, f.audits.size()); assertEquals(outer.getId(), f.audits.get(f.audits.size() - 1).entityId()); + f.oracle(outer.getId(), "Outer committed", null, 2); f.oracle(inner.getId(), "Inner original", null, 1); + inner.auditAs("Retry the independently rolled-back inner object").save(f.context); + assertEquals(audits + 2, f.audits.size()); f.oracle(inner.getId(), "Inner retry", null, 2); + f.emit(Map.of("auditDelta", 2, "outerId", outer.getId(), "innerId", inner.getId())); + } + + @Test public void equalAndRepeatedSavepointsRetainPrecedingBusinessCommit() throws Exception { + var f = new Fixture("savepoint-boundaries"); var outer = f.create("Outer original"); var inner = f.create("Inner original"); + int audits = f.audits.size(); + f.transaction().executeWithoutResult(status -> { + outer.updateTitle("Outer committed").auditAs("Preserve the preceding physical work").save(f.context); + var first = status.createSavepoint(); var second = status.createSavepoint(); + inner.updateTitle("Inner first").auditAs("First abandoned nested intent").save(f.context); status.rollbackToSavepoint(second); + assertEquals(Long.valueOf(1), inner.getVersion()); + inner.updateTitle("Inner second").auditAs("Second abandoned nested intent").save(f.context); status.rollbackToSavepoint(first); + assertEquals(Long.valueOf(1), inner.getVersion()); + inner.updateTitle("Inner final").auditAs("Third abandoned nested intent").save(f.context); status.rollbackToSavepoint(first); + assertEquals(Long.valueOf(1), inner.getVersion()); assertEquals(audits, f.audits.size()); + }); + assertEquals(audits + 1, f.audits.size()); assertEquals(outer.getId(), f.audits.get(f.audits.size() - 1).entityId()); + f.oracle(outer.getId(), "Outer committed", null, 2); f.oracle(inner.getId(), "Inner original", null, 1); + inner.auditAs("Retry the final intended inner value").save(f.context); f.oracle(inner.getId(), "Inner final", null, 2); + assertEquals(audits + 2, f.audits.size()); f.emit(Map.of("auditDelta", 2, "outerId", outer.getId(), "innerId", inner.getId())); + } + + @Test public void requiresNewCommitsWithoutAbsorbingOuterIntent() throws Exception { + var f = new Fixture("requires-new"); var outer = f.create("Outer original"); var inner = f.create("Inner original"); int audits = f.audits.size(); + assertThrows(IllegalStateException.class, () -> f.transaction().executeWithoutResult(status -> { + // SQLite permits only one writer. The outer owner has not written or established a read snapshot yet. + f.transaction(TransactionDefinition.PROPAGATION_REQUIRES_NEW).executeWithoutResult(independent -> + inner.updateTitle("Inner committed").auditAs("Commit an independent physical transaction").save(f.context)); + assertEquals(audits + 1, f.audits.size()); assertEquals(inner.getId(), f.audits.get(f.audits.size() - 1).entityId()); + outer.updateTitle("Outer retry").auditAs("Roll back only the outer physical transaction").save(f.context); + throw new IllegalStateException("EXPECTED_OUTER_ROLLBACK"); + })); + assertEquals(audits + 1, f.audits.size()); assertEquals(Long.valueOf(1), outer.getVersion()); + f.oracle(outer.getId(), "Outer original", null, 1); f.oracle(inner.getId(), "Inner committed", null, 2); + outer.auditAs("Retry the outer object independently").save(f.context); f.oracle(outer.getId(), "Outer retry", null, 2); + assertEquals(audits + 2, f.audits.size()); f.emit(Map.of("auditDelta", 2, "outerId", outer.getId(), "innerId", inner.getId())); + } + + @Test public void failedPostCommitDeliveryCannotInventRollback() throws Exception { + var f = new Fixture("audit-delivery-failure"); var row = f.create("Original"); int audits = f.audits.size(); f.failDelivery = true; + var error = assertThrows(RuntimeException.class, () -> f.transaction().executeWithoutResult(status -> { + row.updateTitle("Committed despite delivery failure").auditAs("Commit before failing the observer").save(f.context); + assertEquals(audits, f.audits.size()); + })); + assertTrue(error.toString().contains("EXPECTED_AUDIT_DELIVERY_FAILURE")); f.failDelivery = false; + assertEquals(audits + 1, f.audits.size()); assertEquals(Long.valueOf(2), row.getVersion()); assertTrue(row.getUpdatedProperties().isEmpty()); + f.oracle(row.getId(), "Committed despite delivery failure", null, 2); + row.updateDescription("Later successful edit").auditAs("Continue after a delivery-only failure").save(f.context); + assertEquals(audits + 2, f.audits.size()); f.oracle(row.getId(), "Committed despite delivery failure", "Later successful edit", 3); + f.emit(Map.of("auditDelta", 2, "id", row.getId(), "finalVersion", row.getVersion())); + } + + @Test public void checkerAndIntentRejectionNeverEnterSpringProvider() throws Exception { + var f = new Fixture("admission"); var invalid = Q.workItems().comment("Construct an incomplete work item") + .purpose("Check before acquiring a database transaction").newEntity(f.context).updatePlatform(f.root); + long calls = f.source.connections; int policies = f.policies.size(), audits = f.audits.size(); + assertThrows(CheckException.class, () -> invalid.auditAs("Reject the missing required title").save(f.context)); + assertThrows(RuntimeException.class, () -> Q.workItems().limit(1).purpose("Reject a missing query comment").executeForList(f.context)); + assertEquals(calls, f.source.connections); assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + var valid = f.create("Valid control"); calls = f.source.connections; audits = f.audits.size(); policies = f.policies.size(); + valid.updateTitle("Rejected intent"); + assertThrows(RuntimeException.class, () -> valid.auditAs(" ").save(f.context)); + assertEquals(calls, f.source.connections); assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + f.oracle(valid.getId(), "Valid control", null, 1); f.emit(Map.of("auditDelta", 0, "id", valid.getId(), "rejections", 3)); + } + + @Test public void actualSecondGraphWriteFailureRollsBackAndRetries() throws Exception { + var f = new Fixture("graph-write-failure"); var first = f.create("First original"); var second = f.create("Second original"); + var graph = Q.platforms().withIdIs(1L).limit(1) + .selectWorkItemListWith(Q.workItems().orderByIdAscending().limit(10)) + .comment("Load a bounded complete two-member graph").purpose("Verify atomic generated graph mutation").executeForOne(f.context); + var children = graph.getWorkItemList(); + var a = children.stream().filter(row -> row.getId().equals(first.getId())).findFirst().orElseThrow(); + var b = children.stream().filter(row -> row.getId().equals(second.getId())).findFirst().orElseThrow(); + a.updateTitle("First committed"); b.updateTitle("Second committed"); + try (var connection = DriverManager.getConnection(f.url); var statement = connection.createStatement()) { + statement.execute("CREATE TRIGGER spring_observe AFTER UPDATE ON work_item_data BEGIN SELECT spring_written(NEW.id); END"); + statement.execute("CREATE TRIGGER spring_fail BEFORE UPDATE ON work_item_data WHEN NEW.title='Second committed' BEGIN SELECT spring_rejected(NEW.id); SELECT RAISE(ABORT,'EXPECTED_SECOND_GRAPH_WRITE'); END"); + } + int audits = f.audits.size(); f.source.written.clear(); f.source.rejected.clear(); + assertThrows(RuntimeException.class, () -> f.transaction().executeWithoutResult(status -> + graph.auditAs("Attempt both graph writes in the caller transaction").save(f.context))); + assertEquals(List.of(first.getId()), f.source.written); assertEquals(List.of(second.getId()), f.source.rejected); assertEquals(audits, f.audits.size()); + assertEquals(Long.valueOf(1), a.getVersion()); assertEquals(Long.valueOf(1), b.getVersion()); + assertTrue(a.getUpdatedProperties().contains("title")); assertTrue(b.getUpdatedProperties().contains("title")); + f.oracle(first.getId(), "First original", null, 1); f.oracle(second.getId(), "Second original", null, 1); + try (var connection = DriverManager.getConnection(f.url); var statement = connection.createStatement()) { statement.execute("DROP TRIGGER spring_fail"); } + f.source.written.clear(); graph.auditAs("Retry the same generated object graph").save(f.context); + assertEquals(List.of(first.getId(), second.getId()), f.source.written); assertEquals(audits + 2, f.audits.size()); + f.oracle(first.getId(), "First committed", null, 2); f.oracle(second.getId(), "Second committed", null, 2); + try (var connection = DriverManager.getConnection(f.url); var statement = connection.createStatement()) { statement.execute("DROP TRIGGER spring_observe"); } + f.emit(Map.of("auditDelta", 2, "firstId", first.getId(), "secondId", second.getId(), "failedAfterWrites", 1)); + } +} diff --git a/examples/conformance/spring-transactions/verify-local.cjs b/examples/conformance/spring-transactions/verify-local.cjs new file mode 100644 index 000000000..b87b1f489 --- /dev/null +++ b/examples/conformance/spring-transactions/verify-local.cjs @@ -0,0 +1,97 @@ +#!/usr/bin/env node +'use strict'; +const fs=require('node:fs'),path=require('node:path'),os=require('node:os'),cp=require('node:child_process'); +const assert=require('node:assert/strict'),crypto=require('node:crypto'); +const {createOwnedRunner,ownedBytes}=require('../../fix-e-alignment/owned-command.cjs'); +const ROOT=path.resolve(__dirname,'../../..'),REFERENCE='6d162bb0cff43335e570302a95a5abc721915b77'; +const CASES=['admission','audit-delivery-failure','graph-write-failure','nested-rollback','outer-commit-noop','outer-rollback-retry','requires-new','savepoint-boundaries']; +const sha=b=>crypto.createHash('sha256').update(b).digest('hex'); +const digest=f=>sha(fs.readFileSync(f)); +const git=(...args)=>cp.execFileSync('git',['-C',ROOT,...args],{maxBuffer:64*1024**2}); +function source(){ + const files=[...new Set(git('ls-files','-z','--cached','--others','--exclude-standard').toString().split('\0').filter(Boolean))].sort(); + const hash=crypto.createHash('sha256'); + for(const n of files){const f=path.join(ROOT,n);assert(fs.lstatSync(f).isFile(),n);hash.update(n+'\0').update(String(fs.statSync(f).mode)+'\0').update(fs.readFileSync(f)).update('\0');} + return{commit:git('rev-parse','HEAD').toString().trim(),contentsSha256:hash.digest('hex'),files,dirty:git('status','--porcelain').toString()}; +} +function fixture(){ + const prefix='examples/conformance/lib/'; + const files=git('ls-files','-z','--',prefix).toString().split('\0').filter(Boolean).sort();assert(files.length>10); + const hashes={};for(const n of files){hashes[n.slice(prefix.length)]=digest(path.join(ROOT,n));assert.equal(sha(git('show','HEAD:'+n)),hashes[n.slice(prefix.length)],'never edit generated library: '+n);} + const model='examples/conformance/model.xml';assert.equal(digest(path.join(ROOT,model)),sha(git('show','HEAD:'+model))); + return{origin:'existing tracked two-object example; not regenerated in this gate',model,modelSha256:digest(path.join(ROOT,model)),files:hashes}; +} +function seedPublicMaven(destination){ + const cache=path.resolve(process.env.TEAQL_MAVEN_DEPENDENCY_CACHE||path.join(os.homedir(),'.m2/repository')); + assert(!fs.existsSync(destination));fs.mkdirSync(destination);let files=0,bytes=0; + function visit(relative=''){ + for(const n of fs.readdirSync(path.join(cache,relative))){const rel=path.join(relative,n),from=path.join(cache,rel),stat=fs.lstatSync(from); + if(stat.isSymbolicLink()||rel==='io/teaql'||rel==='com/teaql'||rel.startsWith('org/owasp/dependency-check-data'))continue; + if(stat.isDirectory())visit(rel);else if(stat.isFile()&&/\.(jar|pom|sha1|sha256|sha512|md5|xml)$/.test(n)){ + const to=path.join(destination,rel);fs.mkdirSync(path.dirname(to),{recursive:true});fs.copyFileSync(from,to,fs.constants.COPYFILE_EXCL);files++;bytes+=stat.size; + } + } + } + visit();return{files,bytes,teaqlArtifactsBorrowed:0,cacheDatabasesCopied:false}; +} + +async function main(){ + assert(process.argv.length===2||process.argv.length===3&&process.argv[2]==='--baseline'); + const baseline=process.argv[2]==='--baseline',requested=process.env.TEAQL_JAVA_SPRING_EVIDENCE_DIR; + const output=requested?path.resolve(requested):fs.mkdtempSync(path.join(os.tmpdir(),'teaql-java-spring-business-evidence-')); + if(requested){assert(path.isAbsolute(requested)&&!fs.existsSync(output),'new absolute evidence directory required');fs.mkdirSync(output,{recursive:true});} + const scratch=fs.mkdtempSync(path.join(os.tmpdir(),'teaql-java-spring-business-build-')),runner=createOwnedRunner(); + const report={schema:'teaql.java-spring-business-example/v1',passed:false,baseline,commands:[],rounds:[],sameDatabases:true, + currentInstalledArtifactAccepted:false,allTransactionProvidersAccepted:false,allP0P1Complete:false,publicPublication:false}; + async function run(name,command,cwd,extra={}){ + const fd=fs.openSync(path.join(output,name+'.log'),'wx');let result; + const env={...process.env,...extra,TMPDIR:scratch};for(const n of ['MAVEN_ARGS','MAVEN_OPTS','JAVA_TOOL_OPTIONS','JDK_JAVA_OPTIONS'])delete env[n]; + try{result=await runner.run(command,{cwd,env,timeout:300000,stdio:['ignore',fd,fd]});}finally{fs.closeSync(fd);} + report.commands.push({name,command,cwd,exitCode:result.status,signal:result.signal,logSha256:digest(path.join(output,name+'.log'))}); + assert(!result.error&&result.signal===null&&runner.safeToClean);return result; + } + try{ + const disk=fs.statfsSync(scratch);assert(disk.bavail*disk.bsize>8*1024**3); + const original=source();report.source=original;report.fixture=fixture();report.applicationSha256=digest(path.join(__dirname,'GeneratedSpringTransactionTest.java'));report.verifierSha256=digest(__filename); + const runtime=path.join(scratch,'source'),consumer=path.join(scratch,'consumer'),maven=path.join(scratch,'maven'); + fs.mkdirSync(runtime);report.testedProductionCommit=baseline?REFERENCE:original.commit; + if(baseline){ + const archive=path.join(scratch,'source.tar');assert.equal((await run('archive',['git','-C',ROOT,'archive','--format=tar','--output='+archive,REFERENCE],scratch)).status,0); + assert.equal((await run('extract',['tar','-xf',archive,'-C',runtime],scratch)).status,0);fs.unlinkSync(archive); + }else for(const n of original.files){const to=path.join(runtime,n);fs.mkdirSync(path.dirname(to),{recursive:true});fs.copyFileSync(path.join(ROOT,n),to);} + // This library is already a module of the runtime's reactor. Verify it in + // place rather than introduce a second module with the same Maven identity. + for(const[n,h]of Object.entries(report.fixture.files))assert.equal(digest(path.join(runtime,'examples/conformance/lib',n)),h); + const tests=path.join(consumer,'src/test/java/com/teaql/runtimeexampleconformanceservice');fs.mkdirSync(tests,{recursive:true}); + fs.copyFileSync(path.join(__dirname,'GeneratedSpringTransactionTest.java'),path.join(tests,'GeneratedSpringTransactionTest.java')); + const version=fs.readFileSync(path.join(runtime,'pom.xml'),'utf8').match(/([^<]+)<\/version>/)[1]; + const dependencies=['teaql-runtime','teaql-sqlite','teaql-provider-spring-jdbc','teaql-jackson'].map(n=>`io.teaql${n}${version}`).join(''); + const pom=`4.0.0io.teaqlteaql-java-parent${version}../source/pom.xmlio.teaql.examplesteaql-spring-business-example${version}com.teaqlruntime-example-conformance-service-core1.0.0${dependencies}junitjunit4.13.2testorg.apache.maven.pluginsmaven-surefire-pluginfalse`; + fs.writeFileSync(path.join(consumer,'pom.xml'),pom);fs.writeFileSync(path.join(output,'consumer-pom.xml'),pom,{flag:'wx'}); + fs.writeFileSync(path.join(scratch,'pom.xml'),'4.0.0io.teaql.testspring-business-reactor0.0.0pomsourceconsumer'); + report.cache=seedPublicMaven(maven);const databases=path.join(output,'databases');fs.mkdirSync(databases); + for(const round of [1,2]){ + const command=['mvn','-o','-B','-ntp','-Dmaven.repo.local='+maven,'-f',path.join(scratch,'pom.xml'),'-pl',':teaql-spring-business-example','-am','test','-Dtest=GeneratedSpringTransactionTest','-Dsurefire.failIfNoSpecifiedTests=false','-Dteaql.version='+version,'-Dteaql.expected.runtime.root='+runtime]; + const result=await run('round-'+round,command,scratch,{TEAQL_SPRING_DB_ROOT:databases,TEAQL_SPRING_ROUND:String(round)}); + const log=fs.readFileSync(path.join(output,'round-'+round+'.log'),'utf8'); + if(/COMPILATION ERROR/.test(log))throw Error('Application did not compile:\n'+log.split('\n').filter(n=>n.startsWith('[ERROR]')).slice(0,30).join('\n')); + const file=path.join(consumer,'target/surefire-reports/TEST-com.teaql.runtimeexampleconformanceservice.GeneratedSpringTransactionTest.xml'); + if(fs.existsSync(file)){fs.copyFileSync(file,path.join(output,'round-'+round+'-tests.xml'));report.rounds.push({round,junitSha256:digest(file),counts:log.match(/Tests run: 8, Failures: \d+, Errors: \d+, Skipped: \d+[^\n]*/)?.[0]});} + const values=[...log.matchAll(/^JAVA_SPRING_BUSINESS=(.+)$/gm)].map(m=>JSON.parse(m[1])); + if(report.rounds.length)report.rounds.at(-1).observations=values; + assert.equal(result.status,0,log.slice(-14000));assert.equal(values.length,8);assert.deepEqual(values.map(v=>v.case).sort(),CASES); + assert(values.every(v=>v.passed&&v.round===round));assert.match(log,/Tests run: 8, Failures: 0, Errors: 0, Skipped: 0/); + assert.deepEqual(fixture(),report.fixture);assert.deepEqual(source(),original); + } + assert(!baseline,'a passing baseline does not reproduce the defect');report.passed=true; + }catch(error){report.error=error.stack;console.error(error.stack);process.exitCode=1;} + finally{ + report.databases={};const dir=path.join(output,'databases');if(fs.existsSync(dir))for(const n of fs.readdirSync(dir).sort()){assert(n.endsWith('.sqlite'));report.databases[n]={bytes:fs.statSync(path.join(dir,n)).size,sha256:digest(path.join(dir,n))};} + const safe=runner.safeToClean;report.cleanup={scratchRemoved:false,disposedOwnedBytes:safe?ownedBytes(scratch):0,sharedCachesDeleted:false,originalSourcesDeleted:false,databasesDeleted:false}; + if(safe)fs.rmSync(scratch,{recursive:true});else report.unsafeBuildRetention=scratch; + report.cleanup.scratchRemoved=!fs.existsSync(scratch);runner.dispose();fs.writeFileSync(path.join(output,'receipt.json'),JSON.stringify(report,null,2)+'\n',{flag:'wx'}); + console.log(JSON.stringify({output,passed:report.passed,baseline,rounds:report.rounds.length,scratchRemoved:report.cleanup.scratchRemoved,currentInstalledArtifactAccepted:false})); + } +} +if(require.main===module)main().catch(error=>{console.error(error.stack);process.exitCode=1;}); +module.exports={CASES,source,fixture,seedPublicMaven}; diff --git a/examples/exact-decimal/GeneratedExactDecimalProbe.java b/examples/exact-decimal/GeneratedExactDecimalProbe.java new file mode 100644 index 000000000..b64b08bf4 --- /dev/null +++ b/examples/exact-decimal/GeneratedExactDecimalProbe.java @@ -0,0 +1,141 @@ +package com.example.exactdecimalservice; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.platform.Platform; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.sqlite.SQLiteDataSource; + +/** Application-owned exact Decimal check against a freshly generated domain library. */ +public final class GeneratedExactDecimalProbe { + private GeneratedExactDecimalProbe() {} + + private static TeaQLRuntime runtime(SQLiteDataSource dataSource, JdbcSqlExecutor sql) { + return TeaQLRuntime.builder() + .metadata(new SimpleEntityMetaFactory()) + .dataService("default", new SqliteDataServiceExecutor("default", sql, dataSource)) + .idGenerationService(new IdSpaceIdGenerator(new WorkspaceTeaQLDatabase(sql, dataSource))) + .executionLogging(false) + .build() + .install(GeneratedRuntimeModule.module()); + } + + public static void main(String[] args) throws Exception { + String configured = System.getenv("TEAQL_EXACT_DECIMAL_DB"); + if (configured == null || configured.isBlank()) { + throw new IllegalArgumentException("Set TEAQL_EXACT_DECIMAL_DB to the verifier-owned SQLite path"); + } + SQLiteDataSource sourceData = new SQLiteDataSource(); + sourceData.setUrl("jdbc:sqlite:" + Path.of(configured).toAbsolutePath()); + JdbcSqlExecutor sourceSql = new JdbcSqlExecutor(sourceData); + var source = new CustomUserContext(runtime(sourceData, sourceSql)); + source.ensureSchema(); + Platform platform = Q.platforms().withIdIs(1L) + .comment("Locate the exact Decimal platform") + .purpose("Attach ledger entries to their generated root") + .executeForOne(source); + if (platform == null) throw new AssertionError("seeded platform is missing"); + + Map existing = new HashMap<>(); + for (var row : Q.decimalEntries().orderByIdAscending().limit(10) + .comment("Load the retained complete Decimal fixture") + .purpose("Repeat verification without deleting persisted data").executeForList(source)) { + String label = E.decimalEntry(row).getLabel().eval(); + if (existing.put(label, row) != null) throw new AssertionError("duplicate fixture label"); + } + boolean fresh = existing.isEmpty(); + if (!fresh && existing.size() != 5) throw new AssertionError("incomplete retained fixture"); + DecimalEntry first = save(source, platform, existing, "first", new BigDecimal("0.1")); + DecimalEntry second = save(source, platform, existing, "second", new BigDecimal("0.2")); + var loaded = Q.decimalEntriesWithMinimalFields() + .selectLabel().selectAmount() + .withAmountIs(new BigDecimal("0.1")) + .orderByIdAscending().limit(10) + .comment("Read a generated exact Decimal row") + .purpose("Verify Q filtering and E hydration") + .executeForList(source); + if (loaded.size() != 1 || !"first".equals(E.decimalEntry(loaded.get(0)).getLabel().eval()) + || E.decimalEntry(loaded.get(0)).getAmount().eval().compareTo(new BigDecimal("0.1")) != 0) { + throw new AssertionError("generated Decimal Q/E round-trip failed"); + } + if (sum(source, List.of(first.getId(), second.getId())).compareTo(new BigDecimal("0.3")) != 0) { + throw new AssertionError("generated Decimal SUM is not exact"); + } + DecimalEntry preciseEntry = save(source, platform, existing, "precise", new BigDecimal("3.50")); + BigDecimal scale = reloadAmount(source, preciseEntry.getId()); + if (!new BigDecimal("3.50").equals(scale)) { + throw new AssertionError("generated Decimal scale was not preserved: " + scale); + } + BigDecimal preciseInput = new BigDecimal("123456789012.3456789"); + preciseEntry.updateAmount(preciseInput); + preciseEntry.auditAs("Update exact Decimal precision for generated integration gate").save(source); + BigDecimal precision = reloadAmount(source, preciseEntry.getId()); + if (!preciseInput.equals(precision)) { + throw new AssertionError("generated Decimal precision was not preserved: " + precision); + } + + for (String exponent : new String[] {"1E-7", "1E+8"}) { + BigDecimal input = new BigDecimal(exponent); + DecimalEntry entry = save(source, platform, existing, "exponent " + exponent, input); + BigDecimal reloaded = reloadAmount(source, entry.getId()); + var filtered = Q.decimalEntriesWithMinimalFields().selectAmount() + .withIdIs(entry.getId()).withAmountIs(input).limit(1) + .comment("Find generated exact Decimal exponent value") + .purpose("Verify canonical SQLite binding in generated Q and mutation APIs") + .executeForOne(source); + if (input.compareTo(reloaded) != 0 || filtered == null + || input.compareTo(E.decimalEntry(filtered).getAmount().eval()) != 0) { + throw new AssertionError("generated Decimal exponent round-trip failed: " + exponent); + } + } + + var finalRows = Q.decimalEntries().orderByIdAscending().limit(10) + .comment("Check the retained fixture size") + .purpose("Reject duplicate seeds across repeat runs").executeForList(source); + if (finalRows.size() != 5) throw new AssertionError("repeat verification added duplicate rows"); + System.out.println("GENERATED_EXACT_DECIMAL_PASS q=1 e=1 mutation=1 sum=0.3 scale=3.50 precision=19 exponent=2 rows=5 fresh=" + fresh); + } + + private static DecimalEntry save(CustomUserContext context, Platform platform, + Map existing, String label, BigDecimal amount) { + DecimalEntry entry = existing.get(label); + if (entry == null) entry = Q.decimalEntries() + .comment("Initialize generated Decimal entry") + .purpose("Record an auditable ledger value") + .newEntity(context); + entry.updatePlatform(platform); + entry.updateLabel(label); + entry.updateAmount(amount); + entry.auditAs("Create exact Decimal entry for generated integration gate").save(context); + return entry; + } + + private static BigDecimal sum(CustomUserContext context, List identities) { + var rows = Q.decimalEntriesWithMinimalFields().withIdIn(identities.toArray(Long[]::new)).sumAmountAs("total") + .comment("Sum generated exact Decimal entries") + .purpose("Verify financial aggregation without binary floating point") + .aggregation(context).toList(); + if (rows.size() != 1 || !(rows.get(0).get("total") instanceof BigDecimal total)) { + throw new AssertionError("generated Decimal aggregate has the wrong shape"); + } + return total; + } + + private static BigDecimal reloadAmount(CustomUserContext context, Long id) { + var entry = Q.decimalEntriesWithMinimalFields().selectAmount() + .withIdIs(id).limit(1) + .comment("Reload generated exact Decimal value") + .purpose("Verify scale and precision after audited save") + .executeForOne(context); + if (entry == null) throw new AssertionError("generated Decimal entry is missing: " + id); + return E.decimalEntry(entry).getAmount().eval(); + } +} diff --git a/examples/exact-decimal/GeneratedMemoryAggregateProbe.java b/examples/exact-decimal/GeneratedMemoryAggregateProbe.java new file mode 100644 index 000000000..3d91fc705 --- /dev/null +++ b/examples/exact-decimal/GeneratedMemoryAggregateProbe.java @@ -0,0 +1,72 @@ +package com.example.exactdecimalservice; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.platform.Platform; +import io.teaql.core.AggregationResult; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.runtime.TeaQLRuntime; +import io.teaql.runtime.memory.MemoryDataService; +import java.math.BigDecimal; +import java.util.List; +import java.util.concurrent.atomic.AtomicLong; + +/** The same generated Q/E/Mutation APIs run on the existing in-memory provider. */ +public final class GeneratedMemoryAggregateProbe { + private GeneratedMemoryAggregateProbe() {} + + public static void main(String[] args) throws Exception { + var ids = new AtomicLong(1); + var memory = new MemoryDataService("default"); + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", memory).idGenerationService((c, e) -> ids.getAndIncrement()) + .executionLogging(false).build().install(GeneratedRuntimeModule.module()); + var context = new CustomUserContext(runtime); + + // Memory has no schema or external database. Seed through generated + // Mutation APIs; do not insert rows by reaching into provider storage. + Platform platform = Q.platforms().comment("Create the memory example platform") + .purpose("Own generated exact Decimal examples").newEntity(context); + platform.updateName("Exact Decimal Memory Platform"); + platform.auditAs("Create the generated memory example root").save(context); + + var empty = total(context, List.of(-1L)); + if (empty.toList().size() != 1 || !empty.toList().get(0).containsKey("total") + || empty.toList().get(0).get("total") != null) throw new AssertionError("empty SUM must be present null"); + var json = new ObjectMapper().valueToTree(empty.toList()); + if (!json.get(0).has("total") || !json.get(0).get("total").isNull()) throw new AssertionError("JSON lost selected null"); + if (empty.toNumber(0).intValue() != 0 || empty.toNumber(null) != null) throw new AssertionError("fallback mutated raw aggregate"); + + DecimalEntry first = save(context, platform, "first", "0.1"); + DecimalEntry second = save(context, platform, "second", "0.2"); + var rows = Q.decimalEntriesWithMinimalFields().selectLabel().selectAmount() + .withAmountIs(new BigDecimal("0.1")).limit(10) + .comment("Read generated memory Decimal values") + .purpose("Use typed Q and E without a database").executeForList(context); + if (rows.size() != 1 || !"first".equals(E.decimalEntry(rows.get(0)).getLabel().eval()) + || new BigDecimal("0.1").compareTo(E.decimalEntry(rows.get(0)).getAmount().eval()) != 0) + throw new AssertionError("generated Q/E memory round trip failed"); + Object sum = total(context, List.of(first.getId(), second.getId())).toList().get(0).get("total"); + if (!(sum instanceof BigDecimal decimal) || decimal.compareTo(new BigDecimal("0.3")) != 0) + throw new AssertionError("memory SUM lost exact Decimal precision"); + + // A populated store can still have an empty selected result. One + // caller's explicit fallback must not contaminate a repeated query. + if (total(context, List.of(-1L)).toList().get(0).get("total") != null) + throw new AssertionError("empty bucket borrowed another bucket's sum"); + System.out.println("GENERATED_MEMORY_AGGREGATE_PASS q=1 e=1 mutation=1 sum=0.3 empty=null fallback=0 rows=2 sql=0"); + } + + private static DecimalEntry save(CustomUserContext context, Platform platform, String label, String amount) { + DecimalEntry row = Q.decimalEntries().comment("Initialize an exact memory Decimal entry") + .purpose("Exercise generated audited mutation on memory").newEntity(context); + row.updatePlatform(platform); row.updateLabel(label); row.updateAmount(new BigDecimal(amount)); + row.auditAs("Persist the generated memory Decimal entry").save(context); return row; + } + + private static AggregationResult total(CustomUserContext context, List ids) { + return Q.decimalEntriesWithMinimalFields().withIdIn(ids.toArray(Long[]::new)).sumAmountAs("total") + .comment("Sum selected generated memory entries") + .purpose("Check exact numeric and empty-result semantics").aggregation(context); + } +} diff --git a/examples/exact-decimal/GeneratedWorkspaceStartupProbe.java b/examples/exact-decimal/GeneratedWorkspaceStartupProbe.java new file mode 100644 index 000000000..afdf14c41 --- /dev/null +++ b/examples/exact-decimal/GeneratedWorkspaceStartupProbe.java @@ -0,0 +1,11 @@ +package com.example.exactdecimalservice; + +/** Runs the plain Java console; App closes its owned JDBC pool before returning. */ +public final class GeneratedWorkspaceStartupProbe { + private GeneratedWorkspaceStartupProbe() {} + + public static void main(String[] args) throws Exception { + App.main(args); + System.out.println("GENERATED_EXACT_DECIMAL_WORKSPACE_PASS"); + } +} diff --git a/examples/exact-decimal/README.md b/examples/exact-decimal/README.md new file mode 100644 index 000000000..b2024bf91 --- /dev/null +++ b/examples/exact-decimal/README.md @@ -0,0 +1,38 @@ +# Generated Java/SQLite exact Decimal example + +This is a small, generation-dependent runtime example. It uses two entities, +one modeled `number()` field, a local generator checkout and this local Java +runtime checkout. No generated domain source is edited. + +```bash +TEAQL_CODEGEN_DIR=/path/to/teaql-code-gen bash examples/exact-decimal/verify.sh +``` + +The verifier copies both source checkouts into one owned temporary build area, +uses the validated local generator entry point, and builds the runtime, generated +library and plain console together in a Maven reactor. It never installs or +deploys TeaQL artifacts into a shared Maven cache. Both rounds use the same two +SQLite databases (one Q/E probe database and one console startup database): + +- Generated Q equality, strong `BigDecimal` hydration and E evaluation. +- Audited saves of `0.1` and `0.2`, followed by an exact modeled Q `SUM=0.3`. +- A `3.50` scale round-trip and audited update to + `123456789012.3456789` without losing numeric precision. +- Exponent-form `BigDecimal` inputs (`1E-7`, `1E+8`) through generated + audited mutation, typed Q filtering and E hydration. +- The actual generated plain Java/JDBC console startup, including repeated + `ensureSchema` against one workspace database. + +It also verifies that the generated library hash does not change while the +application code is compiled and executed. Three packaged runtime class hashes +must match the classes built from the paired checkout, excluding accidental +reuse of a cached published version. The Q/E probe retains exactly five rows +across both rounds. Every run retains its logs, source identities, generated +file hashes and small databases under the printed evidence directory; disposable +compilers, source copies and JARs are removed even on failure. Set +`TEAQL_JAVA_EXACT_EVIDENCE_DIR` to a new path to choose that directory. +This does not qualify migration of +pre-existing SQLite `NUMERIC` columns or participation in an application-owned +Spring `@Transactional` boundary; TeaQL's own graph save is transactional. +Committed mutation replication is tested separately on its P1 branch and is +not required for this isolated Decimal fix. diff --git a/examples/exact-decimal/model.xml b/examples/exact-decimal/model.xml new file mode 100644 index 000000000..2184858bf --- /dev/null +++ b/examples/exact-decimal/model.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/examples/exact-decimal/verify-local.cjs b/examples/exact-decimal/verify-local.cjs new file mode 100644 index 000000000..eeb8ca46d --- /dev/null +++ b/examples/exact-decimal/verify-local.cjs @@ -0,0 +1,143 @@ +#!/usr/bin/env node +"use strict"; +// Source-only ordinary example. No install/deploy, source editing or shared cleanup. +const fs = require("node:fs"), path = require("node:path"), os = require("node:os"); +const cp = require("node:child_process"), crypto = require("node:crypto"), assert = require("node:assert/strict"); +const runtimeRoot = path.resolve(__dirname, "../.."), generatorRoot = fs.realpathSync( + process.env.TEAQL_CODEGEN_DIR || (() => { throw new Error("Set TEAQL_CODEGEN_DIR to the local generator checkout"); })()); +const requested = process.env.TEAQL_JAVA_EXACT_EVIDENCE_DIR; +const evidence = requested ? path.resolve(requested) : fs.mkdtempSync(path.join(os.tmpdir(), "teaql-java-decimal-evidence-")); +if (requested) { assert(!fs.existsSync(evidence), "never overwrite retained evidence"); fs.mkdirSync(evidence); } +const sha = bytes => crypto.createHash("sha256").update(bytes).digest("hex"); +const git = (root, ...args) => cp.execFileSync("git", ["-C", root, ...args], {maxBuffer: 32 * 1024 * 1024}); +const commands = []; +function files(root) { + assert.equal(fs.realpathSync(git(root, "rev-parse", "--show-toplevel").toString().trim()), fs.realpathSync(root)); + return [...new Set(git(root, "ls-files", "-z", "--cached", "--others", "--exclude-standard").toString().split("\0").filter(Boolean))].sort(); +} +function snapshot(root) { + const hash = crypto.createHash("sha256"); + for (const file of files(root)) { + assert(!path.isAbsolute(file) && !file.split("/").includes("..")); + const absolute = path.join(root, file); + hash.update(file + "\0"); + if (!fs.existsSync(absolute)) { hash.update("deleted\0"); continue; } + assert(fs.lstatSync(absolute).isFile(), "source snapshot requires regular files: " + file); + hash.update(fs.readFileSync(absolute)); hash.update("\0"); + } + return {commit: git(root, "rev-parse", "HEAD").toString().trim(), diffSha256: sha(git(root, "diff", "--binary", "HEAD")), + sourceSha256: hash.digest("hex")}; +} +function copy(root, destination) { + for (const file of files(root)) { + const original = path.join(root, file); + if (!fs.existsSync(original)) continue; + assert(fs.lstatSync(original).isFile()); + const target = path.join(destination, file); + fs.mkdirSync(path.dirname(target), {recursive: true}); fs.copyFileSync(original, target); + } +} +function run(name, command, cwd, env = {}) { + const log = path.join(evidence, name + ".log"), fd = fs.openSync(log, "wx"), started = Date.now(); + let result; + try { result = cp.spawnSync("timeout", ["--kill-after=10s", "300s", ...command], { + cwd, env: {...process.env, ...env}, stdio: ["ignore", fd, fd]}); } + finally { fs.closeSync(fd); } + commands.push({name, command, cwd, exitCode: result.status, signal: result.signal, + milliseconds: Date.now() - started, logSha256: sha(fs.readFileSync(log))}); + assert.equal(result.status, 0, `${name} failed; see ${log}`); + return fs.readFileSync(log, "utf8"); +} +function generatedHashes(root) { + const result = {}; + function walk(directory) { + for (const file of fs.readdirSync(directory).sort()) { + if (file === "target") continue; + const full = path.join(directory, file), stat = fs.lstatSync(full); + assert(!stat.isSymbolicLink()); + if (stat.isDirectory()) walk(full); + else { assert(stat.isFile()); result[path.relative(root, full)] = sha(fs.readFileSync(full)); } + } + } + walk(root); return result; +} +const before = {runtime: snapshot(runtimeRoot), generator: snapshot(generatorRoot)}; +const scratch = fs.mkdtempSync(path.join(os.tmpdir(), "teaql-java-decimal-build-")); +let passed = false, failure, generated, localClasses = {}, artifactSha256; +try { + const disk = fs.statfsSync(scratch); + assert(disk.bavail * disk.bsize > 8 * 1024 ** 3, "8 GiB free build space required"); + const runtime = path.join(scratch, "runtime"), generator = path.join(scratch, "generator"), app = path.join(scratch, "app"); + copy(runtimeRoot, runtime); copy(generatorRoot, generator); + run("generator-build", ["mvn", "-B", "-ntp", "-pl", "generator", "-am", "package", "-DskipTests", "-Dexec.skip=true", + "org.apache.maven.plugins:maven-dependency-plugin:3.8.1:build-classpath", "-Dmdep.outputFile=target/example-classpath.txt"], generator); + const dependencies = fs.readFileSync(path.join(generator, "generator/target/example-classpath.txt"), "utf8").trim(); + assert(dependencies.split(path.delimiter).some(file => file.startsWith(path.join(generator, "model/target") + path.sep)), + "generator must use the model artifact built from this source, not a stale local-cache coordinate"); + const classpath = path.join(generator, "generator/target/classes") + path.delimiter + dependencies; + const originalModel = path.join(runtime, 'examples/exact-decimal/model.xml'); + const version = fs.readFileSync(path.join(runtime, "pom.xml"), "utf8").match(/([^<]+)<\/version>/)[1]; + assert(!version.includes("${")); + const originalModelBytes = fs.readFileSync(originalModel); + assert(!originalModelBytes.toString().includes('teaql_java_version=')); + const model = path.join(scratch, 'model.xml'); + const selectedModel = originalModelBytes.toString().replace(/4.0.0io.teaql.testexact-decimal-source-reactor0.0.0pomruntimeapp/libapp\n'); + run("source-paired-build", ["mvn", "-B", "-ntp", "-f", reactor, "-pl", ":exact-decimal-service", "-am", "package", + "-DskipTests", "-Dteaql.version=" + version], scratch); + const artifact = path.join(app, "target/exact-decimal-service-0.0.1-SNAPSHOT.jar"); + artifactSha256 = sha(fs.readFileSync(artifact)); + for (const [module, entry] of [ + ["teaql-core", "io/teaql/core/UserContext.class"], + ["teaql-runtime", "io/teaql/runtime/TeaQLRuntime.class"], + ["teaql-runtime", "io/teaql/runtime/memory/MemoryDataService.class"], + ["teaql-runtime", "io/teaql/runtime/memory/MemoryAggregations.class"], + ["teaql-sqlite", "io/teaql/core/sqlite/SqliteDecimalFunctions.class"], + ]) { + const compiled = fs.readFileSync(path.join(runtime, module, "target/classes", entry)); + const packaged = cp.execFileSync("unzip", ["-p", artifact, entry]); + assert.equal(sha(packaged), sha(compiled), "workspace shaded a different runtime: " + entry); + localClasses[entry] = sha(compiled); + } + for (const round of [1, 2]) { + const log = run("round-" + round, ["java", "-cp", artifact, "com.example.exactdecimalservice.GeneratedExactDecimalProbe"], scratch, + {TEAQL_EXACT_DECIMAL_DB: path.join(evidence, "source.sqlite")}); + assert(log.includes("GENERATED_EXACT_DECIMAL_PASS q=1 e=1 mutation=1 sum=0.3 scale=3.50 precision=19 exponent=2 rows=5 fresh=" + (round === 1))); + const startup = run("workspace-" + round, ["java", "-cp", artifact, "com.example.exactdecimalservice.GeneratedWorkspaceStartupProbe", + "--teaql.datasource.url=jdbc:sqlite:" + path.join(evidence, "workspace.sqlite")], scratch); + assert(startup.includes("GENERATED_EXACT_DECIMAL_WORKSPACE_PASS")); + const memory = run("memory-" + round, ["java", "-cp", artifact, "com.example.exactdecimalservice.GeneratedMemoryAggregateProbe"], scratch); + assert(memory.includes("GENERATED_MEMORY_AGGREGATE_PASS q=1 e=1 mutation=1 sum=0.3 empty=null fallback=0 rows=2 sql=0")); + assert.deepEqual(generatedHashes(path.join(app, "lib")), libraryBefore, "generated library changed during application verification"); + } + assert.deepEqual({runtime: snapshot(runtimeRoot), generator: snapshot(generatorRoot)}, before, "source changed during verification"); + passed = true; +} catch (error) { failure = error.stack; process.exitCode = 1; console.error(error.message); } +finally { + // All child commands are synchronous, have returned, and are bounded by timeout. + const ownedBytes = Number(cp.execFileSync("du", ["-sb", scratch], {encoding: "utf8"}).split(/\s/)[0]); + fs.rmSync(scratch, {recursive: true}); + const databases = {}; + for (const name of ["source.sqlite", "workspace.sqlite"]) { + const file = path.join(evidence, name); + if (fs.existsSync(file)) databases[name] = {bytes: fs.statSync(file).size, sha256: sha(fs.readFileSync(file))}; + } + fs.writeFileSync(path.join(evidence, "receipt.json"), JSON.stringify({schema: "teaql.java-exact-source-example/v1", passed, + before, commands, failure, modelSha256: generated?.modelSha256, artifactSha256, localClasses, databases, + rounds: passed ? 2 : undefined, sameDatabase: true, generatedLibraryUnchanged: passed, + disposedOwnedBytes: ownedBytes, scratchRemoved: !fs.existsSync(scratch), sharedCacheInstall: false, + publicPublication: false, internalRegistryAcceptance: false}, null, 2) + "\n"); + if (passed) console.log("GENERATED_EXACT_DECIMAL_GATE_PASS rounds=2 workspace=2 library_unchanged=1 source_paired=1 evidence=" + evidence); +} diff --git a/examples/exact-decimal/verify.sh b/examples/exact-decimal/verify.sh new file mode 100644 index 000000000..ac991d42e --- /dev/null +++ b/examples/exact-decimal/verify.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +exec node "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/verify-local.cjs" diff --git a/examples/fix-e-alignment/CancelledNewGraphExampleTest.java b/examples/fix-e-alignment/CancelledNewGraphExampleTest.java new file mode 100644 index 000000000..08f79f937 --- /dev/null +++ b/examples/fix-e-alignment/CancelledNewGraphExampleTest.java @@ -0,0 +1,130 @@ +package io.teaql.examples.fixe; + +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.checker.CheckException; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Map; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** ML-12 through the retained generated model, Checker/Fix, Q/E and real SQLite. */ +public class CancelledNewGraphExampleTest { + private static final class Fixture { + final SQLiteDataSource source = new SQLiteDataSource(); + final ContextRootProbe.ObservedSql sql; + final UserContext context; + final int round = Integer.parseInt(System.getenv("TEAQL_FIX_E_ROUND")); + int mutations, audits; + boolean armed; + + Fixture(String scenario) { + String base = System.getenv("TEAQL_FIX_E_DB"); assertNotNull(base); + source.setUrl("jdbc:sqlite:" + base + ".cancelled-new-" + scenario + ".sqlite"); + sql = new ContextRootProbe.ObservedSql(source); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); + ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source) { + @Override public MutationResult mutate(UserContext caller, PersistenceMutation request) { + if (armed) mutations++; + return super.mutate(caller, request); + } + }; + BusinessClock clock = new BusinessClock() { + public LocalDate businessDate(UserContext caller) { return businessDateTime(caller).toLocalDate(); } + public LocalDateTime businessDateTime(UserContext caller) { return LocalDateTime.of(2032, 2, 29, 10, 15, 30).plusDays(round - 1); } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(ids).businessClock(clock).executionLogging(false) + .build().install(GeneratedRuntimeModule.module()); + context = new GeneratedFixEExampleTest.Context(runtime); + context.putAttribute(AppAuditEventSink.class.getName(), (AppAuditEventSink) (caller, event) -> { if (armed) audits++; }); + context.ensureSchema(); + } + + PurchaseOrder parent() { + var entity = Q.purchaseOrders().comment("Prepare a cancellable graph") + .purpose("Verify generated cancellation semantics before persistence").newEntity(context); + entity.updateContactPhone("5550199"); return entity; + } + OrderItem child(boolean complete) { + var entity = Q.orderItems().comment("Prepare a newly reserved child") + .purpose("Verify incomplete and complete new children can be cancelled").newEntity(context); + if (complete) { entity.updateProductName("kept child"); entity.updateUnitPrice(BigDecimal.ONE); } + return entity; + } + void cancel(BaseEntity entity) { + int reads = sql.queries, writes = sql.writes; + entity.markForDeletion(); + assertEquals(reads, sql.queries); assertEquals(writes, sql.writes); + assertTrue(entity.isNew()); assertTrue(entity.isMarkedAsDelete()); + } + void absent(OrderItem entity) { + assertNull(Q.orderItems().withIdIs(entity.getId()).limit(1) + .comment("Verify the cancelled child is not stored") + .purpose("A never-inserted child must not leave a row or tombstone").executeForOne(context)); + var rows = sql.queryForList("SELECT id FROM order_item_data WHERE id=?", new Object[]{entity.getId()}); + assertTrue(rows.isEmpty()); assertNull(entity.getVersion()); + } + void emit(String scenario) throws Exception { + System.out.println("JAVA_CANCELLED_NEW_GRAPH_CASE=" + ContextRootProbe.JSON.writeValueAsString(Map.of( + "case", scenario, "round", round, "passed", true, "generatedQAndE", true, + "mutations", mutations, "audits", audits, "cancelledRowAbsent", true))); + } + } + + @Test public void generatedCancellationKeepsOnlyIntendedSQLiteMutations() throws Exception { + var rootCase = new Fixture("root"); var root = rootCase.parent(); rootCase.cancel(root); rootCase.armed = true; + int writes = rootCase.sql.writes; + var error = assertThrows(TeaQLRuntimeException.class, + () -> root.auditAs("reject a cancelled new root at save").save(rootCase.context)); + assertTrue(error.getMessage().contains("CANCELLED_NEW_ROOT")); + assertEquals(writes, rootCase.sql.writes); assertEquals(0, rootCase.mutations); assertEquals(0, rootCase.audits); + assertNull(root.getVersion()); + assertNull(Q.purchaseOrders().withIdIs(root.getId()).limit(1).comment("Verify cancelled root absence") + .purpose("No persisted entity exists for a cancelled creation").executeForOne(rootCase.context)); + assertTrue(rootCase.sql.queryForList("SELECT id FROM purchase_order_data WHERE id=?", new Object[]{root.getId()}).isEmpty()); + rootCase.emit("root"); + + for (String scenario : new String[]{"complete-child", "incomplete-child", "composed-child"}) { + var f = new Fixture(scenario); var parent = f.parent(); + var cancelled = f.child(!scenario.equals("incomplete-child")); var live = f.child(true); + if (scenario.equals("composed-child")) parent.addOrderItem(cancelled); + f.cancel(cancelled); + if (!scenario.equals("composed-child")) parent.addOrderItem(cancelled); + parent.addOrderItem(live); f.armed = true; + parent.auditAs("save parent and live sibling without cancelled new child").save(f.context); + assertEquals(2, f.mutations); assertEquals(2, f.audits); f.absent(cancelled); + var loaded = Q.purchaseOrders().withIdIs(parent.getId()).limit(1).comment("Reload saved parent") + .purpose("Verify generated Q/E after omitting a cancelled child").executeForOne(f.context); + assertEquals("5550199", E.purchaseOrder(loaded).getContactPhone().eval()); + var child = Q.orderItems().withIdIs(live.getId()).limit(1).comment("Reload intended live child") + .purpose("Cancelling a sibling must not suppress the live mutation").executeForOne(f.context); + assertEquals("kept child", E.orderItem(child).getProductName().eval()); + assertEquals(Long.valueOf(1), E.orderItem(child).getVersion().eval()); + var retry = assertThrows(TeaQLRuntimeException.class, + () -> cancelled.auditAs("a cancelled child cannot be resurrected after parent save").save(f.context)); + assertTrue(retry.getMessage().contains("CANCELLED_NEW_ROOT")); assertEquals(2, f.mutations); + f.emit(scenario); + } + + var f = new Fixture("invalid-live-sibling"); var parent = f.parent(); + var cancelled = f.child(false); var invalid = f.child(false); f.cancel(cancelled); + parent.addOrderItem(cancelled); parent.addOrderItem(invalid); f.armed = true; + assertThrows(CheckException.class, () -> parent.auditAs("live sibling still requires complete valid data").save(f.context)); + assertEquals(0, f.mutations); assertEquals(0, f.audits); f.absent(cancelled); f.emit("invalid-live-sibling"); + } +} diff --git a/examples/fix-e-alignment/CheckerBoundaryExampleTest.java b/examples/fix-e-alignment/CheckerBoundaryExampleTest.java new file mode 100644 index 000000000..c0a24fb02 --- /dev/null +++ b/examples/fix-e-alignment/CheckerBoundaryExampleTest.java @@ -0,0 +1,239 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.checker.*; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.*; +import io.teaql.tfp.*; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import javax.sql.DataSource; +import org.junit.Test; +import org.junit.function.ThrowingRunnable; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Real generated Q/E/audited saves plus existing public Checker and JSON SPIs. */ +public class CheckerBoundaryExampleTest { + static final ObjectMapper JSON = new ObjectMapper().registerModule(new JavaTimeModule()); + static final LocalDateTime CLOCK = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + + static final class Observed extends JdbcSqlExecutor { + int queries, writes, transactions, commits, parentInserts, childInserts; + Observed(DataSource source) { super(source); } + void write(String sql, int count) { + writes++; + String s = sql.toLowerCase(Locale.ROOT).replace("\"", "").trim(); + if (s.startsWith("insert into purchase_order_data")) parentInserts += count; + if (s.startsWith("insert into order_item_data")) childInserts += count; + } + @Override public List> queryForList(String sql, Object[] args) { queries++; return super.queryForList(sql,args); } + @Override public List query(String sql,Object[] args,CompiledRowMapper mapper) { queries++; return super.query(sql,args,mapper); } + @Override public int update(String sql,Object[] args) { write(sql,1); return super.update(sql,args); } + @Override public int[] batchUpdate(String sql,List args) { write(sql,args.size()); return super.batchUpdate(sql,args); } + @Override public void execute(String sql) { write(sql,1); super.execute(sql); } + @Override public void executeInTransaction(Runnable action) { transactions++; super.executeInTransaction(action); commits++; } + } + static final class Fixture { + final SQLiteDataSource raw = new SQLiteDataSource(); + final Observed sql; + final UserContext context; + int allocations, policies, reviews, audits, checkers, mapped, saves, round, observations; + String mode = ""; + @SuppressWarnings("unchecked") Fixture() throws Exception { + String base = System.getenv("TEAQL_FIX_E_DB"); assertNotNull(base); + raw.setUrl("jdbc:sqlite:"+base+".checker-boundaries.sqlite"); sql = new Observed(raw); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite",sql,raw); + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext caller) { return CLOCK.toLocalDate(); } + public LocalDateTime businessDateTime(UserContext caller) { return CLOCK; } + }; + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { return new MutationPolicyIdentity("checker-boundary","1","sha256:checker-boundary"); } + public MutationDecision review(UserContext caller,MutationPlan plan) { reviews++; return MutationDecision.allow(); } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()).dataService("default",service).dataService("sqlite",service) + .businessClock(clock).idGenerationService(new InternalIdGenerationService() { + public Long generateId(UserContext caller,Entity entity) { allocations++; return ids.generateId(caller,entity); } + public void ensureFloor(String type,long floor) { ids.ensureFloor(type,floor); } + }).mutationPolicyRegistry(key -> { policies++; return Optional.of(policy); }) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller,ExecutionMetadata event) {} + public void writeAuditEvent(UserContext caller,RawAuditEvent event) { audits++; } + }).build(); + var module = GeneratedRuntimeModule.module(); runtime.install(module); + var decorated = RuntimeModule.of(); + for (Checker original : module.checkers()) { + Checker delegate = (Checker)original; + decorated = decorated.withCheckers(new Checker() { + public String type() { return delegate.type(); } + public boolean needCheck(UserContext caller,BaseEntity entity) { return delegate.needCheck(caller,entity); } + public void checkAndFix(UserContext caller,BaseEntity entity,ObjectLocation location) { + checkers++; + if (entity instanceof OrderItem item && item.newItem()) { + if (mode.equals("reject")) item.updateUnitPrice(BigDecimal.ZERO); + if (mode.equals("repair")) { item.updateProductName("Fixed child"); item.updateUnitPrice(new BigDecimal("12.34")); } + } + delegate.checkAndFix(caller,entity,location); + } + }); + } + runtime.install(decorated); context = new GeneratedFixEExampleTest.Context(runtime); context.ensureSchema(); + int count = physical().get("purchase_order_data").size(); assertEquals(0,count%5); round = count/5+1; + assertTrue("only two unreset rounds",round==1||round==2); + } + PurchaseOrder parent() { + var row = Q.purchaseOrders().comment("Prepare a Java Checker boundary") + .purpose("Validate generated saves before provider entry").newEntity(context); + row.updateInternalNote(null); return row; + } + OrderItem item(PurchaseOrder parent,String name) { + var row = Q.orderItems().comment("Prepare a real child constraint") + .purpose("Exercise the public Checker SPI through audited saves").newEntity(context); + row.updatePurchaseOrder(parent); row.updateProductName(name); row.updateUnitPrice(new BigDecimal("10.00")); return row; + } + Map counters() { + var r = new TreeMap(); r.put("queries",sql.queries);r.put("writes",sql.writes);r.put("transactions",sql.transactions); + r.put("commits",sql.commits);r.put("parentInserts",sql.parentInserts);r.put("childInserts",sql.childInserts); + r.put("allocations",allocations);r.put("policies",policies);r.put("reviews",reviews);r.put("audits",audits); + r.put("checkers",checkers);r.put("mapped",mapped);r.put("saves",saves);return r; + } + Map delta(Map before) { var r = new TreeMap(); counters().forEach((k,v)->r.put(k,v-before.get(k)));return r; } + void zero(Map effects,boolean allowChecker) { + for (var e:effects.entrySet()) if (!Set.of("mapped","saves").contains(e.getKey()) && !(allowChecker&&e.getKey().equals("checkers"))) + assertEquals(effects.toString(),Integer.valueOf(0),e.getValue()); + } + Map>> physical() throws Exception { + var all = new TreeMap>>(); + try (var connection = raw.getConnection(); var statement = connection.createStatement()) { + for (String table:List.of("tenant_data","purchase_order_data","order_item_data")) { + var rows = new ArrayList>(); + try(var result=statement.executeQuery("SELECT * FROM "+table+" ORDER BY id")) { + while(result.next()) { var row=new TreeMap();var meta=result.getMetaData(); + for(int i=1;i<=meta.getColumnCount();i++) row.put(meta.getColumnName(i), + meta.getColumnName(i).equals("unit_price")?result.getString(i):result.getObject(i)); rows.add(row); } + } + all.put(table,rows); + } + } + return all; + } + void emit(String name,Map facts,String profile) throws Exception { + var row=new LinkedHashMap(facts);row.put("case",name);row.put("round",round);row.put("passed",true); + if(profile!=null)row.put("profile",profile);System.out.println("JAVA_CHECKER_BOUNDARY_CASE="+JSON.writeValueAsString(row));observations++; + } + CheckResult reject(String rule,String location,ThrowingRunnable save) throws Exception { + var stored=physical();var before=counters();var error=assertThrows(CheckException.class,save); + zero(delta(before),true);assertEquals(stored,physical()); + return error.getViolates().stream().filter(v->v.toWire(JsonFieldNamingProfile.SNAKE_CASE).ruleId().equals(rule) + &&v.getLocation().modelPath().equals(location)).findFirst().orElseThrow(()->new AssertionError(error.getViolates())); + } + } + + @Test public void realGeneratedGraphAndJsonInputBoundaries() throws Exception { + var f=new Fixture(); + var parent=f.parent();parent.updateContactPhone("5550100");var child=f.item(parent,"Boundary item"); + var before=f.counters();child.auditAs("Calibrate exactly-once generated graph persistence").save(f.context);var effects=f.delta(before); + assertEquals(Integer.valueOf(1),effects.get("parentInserts"));assertEquals(Integer.valueOf(1),effects.get("childInserts")); + assertEquals(Integer.valueOf(2),effects.get("audits"));assertTrue(effects.get("checkers")>0);assertTrue(effects.get("transactions")>0); + f.emit("exact-provider-calibration",Map.of("parentId",parent.getId(),"childId",child.getId(),"effects",effects),null); + + var root=Q.tenantsWithMinimalFields().withIdIs(1L).selectPurchaseOrderListWith( + Q.purchaseOrdersWithMinimalFields().withIdIs(parent.getId()).selectTenant().selectContactPhone().selectCreateTime().selectUpdateTime() + .limit(1).comment("Load every fixed field except the optional note")) + .limit(1).comment("Load an actually incomplete modified object beneath a sparse root") + .purpose("Distinguish optional-field completeness from missing-root admission").executeForOne(f.context); + var partial=E.tenant(root).getPurchaseOrderList().first().eval(); + assertEquals(Long.valueOf(1),E.purchaseOrder(partial).getTenant().getId().eval()); + assertThrows(TeaQLNotLoadedException.class,()->E.purchaseOrder(partial).getInternalNote().eval()); + partial.updateContactPhone("5550101"); + var violation=f.reject("invalid_type","purchase_order_list[0].internal_note", + ()->root.auditAs("Reject the actual incomplete mutation target").save(f.context)); + assertEquals("PurchaseOrder",violation.toWire(JsonFieldNamingProfile.CAMEL_CASE).entityType()); + f.emit("nonroot-partial-update",Map.of("loadedRoot",1,"absentField","internal_note", + "nativePath",violation.getLocation().nativePath(),"zeroProviderIO",true),null); + + var completeRoot=Q.tenantsWithMinimalFields().withIdIs(1L).selectPurchaseOrderListWith(Q.purchaseOrders().withIdIs(parent.getId()) + .limit(1).comment("Load the complete actual mutation target")) + .limit(1).comment("Keep the untouched ancestor sparse").purpose("Save only entities with actual changes").executeForOne(f.context); + assertThrows(TeaQLNotLoadedException.class,()->E.tenant(completeRoot).getName().eval()); + var complete=E.tenant(completeRoot).getPurchaseOrderList().first().eval();complete.updateContactPhone("5550102"); + before=f.counters();completeRoot.auditAs("Save the complete child under a sparse untouched root").save(f.context);effects=f.delta(before); + assertEquals(Long.valueOf(1),E.tenant(completeRoot).getVersion().eval());assertEquals(Long.valueOf(2),E.purchaseOrder(complete).getVersion().eval()); + assertEquals(Integer.valueOf(1),effects.get("audits"));assertEquals(Integer.valueOf(0),effects.get("parentInserts")); + f.emit("unmodified-partial-ancestor",Map.of("parentId",parent.getId(),"childVersion",2,"rootVersion",1,"effects",effects),null); + + var rejected=f.parent();rejected.updateContactPhone("5550100");var rejectedChild=f.item(rejected,"Boundary item");f.mode="reject"; + violation=f.reject("min","unit_price",()->rejectedChild.auditAs("Reject a range violation introduced by customer Fix").save(f.context)); + assertEquals("OrderItem",violation.toWire(JsonFieldNamingProfile.CAMEL_CASE).entityType()); + assertEquals(0,BigDecimal.ZERO.compareTo(E.orderItem(rejectedChild).getUnitPrice().eval())); + f.emit("post-fix-rejection",Map.of("originalPrice","10.00","fixedPrice","0","actualFixReached",true,"zeroProviderIO",true),null); + var repaired=f.parent();repaired.updateContactPhone("5550100");var repairedChild=f.item(repaired,null);f.mode="repair"; + before=f.counters();repairedChild.auditAs("Let customer Fix supply a required name and exact Decimal").save(f.context);effects=f.delta(before);f.mode=""; + var stored=Q.orderItems().withIdIs(repairedChild.getId()).limit(1).comment("Read actual post-Fix values") + .purpose("Detect stale mutation compilation after the Checker SPI").executeForOne(f.context); + assertEquals("Fixed child",E.orderItem(stored).getProductName().eval());assertEquals(0,new BigDecimal("12.34").compareTo(E.orderItem(stored).getUnitPrice().eval())); + assertEquals(Integer.valueOf(1),effects.get("parentInserts"));assertEquals(Integer.valueOf(1),effects.get("childInserts"));assertEquals(Integer.valueOf(2),effects.get("audits")); + f.emit("post-fix-repair",Map.of("parentId",repaired.getId(),"childId",repairedChild.getId(),"storedName","Fixed child","storedPrice","12.34","effects",effects),null); + + for(var profile:JsonFieldNamingProfile.values()) { + String name=profile.modelValue(),standard=profile.render("contact_phone"); + var metadata=new WireEntityMetadata("PurchaseOrder",Map.of("contact_phone",standard),Map.of("legacy/phone~","contact_phone")); + // Java reserves the ID when newEntity returns. Do that before the + // measured input/save boundary; never mislabel ID reservation as a + // forbidden SQL side effect of a later rejected save. + var target=f.parent();var baseline=f.physical();before=f.counters(); + var normalized=WireFieldAdapter.normalize((ObjectNode)JSON.readTree("{\"legacy/phone~\":null}"),metadata); + f.mapped++;target.updateContactPhone(null);f.saves++; + var error=assertThrows(CheckException.class,()->target.auditAs("Check an actually submitted JSON alias").save(f.context)); + WireFieldAdapter.retainSubmittedPaths(error.getViolates(),normalized);f.zero(f.delta(before),true);assertEquals(baseline,f.physical()); + var actual=error.getViolates().stream().filter(v->v.toWire(profile).ruleId().equals("required") + &&v.getLocation().modelPath().equals("contact_phone")).findFirst().orElseThrow(); + assertEquals("/legacy~1phone~0",actual.getSourceInstancePath());var wires=new LinkedHashMap(); + for(var output:JsonFieldNamingProfile.values())wires.put(output.modelValue(),actual.toWire(output)); + f.emit("accepted-input-alias",Map.of("wires",wires,"zeroProviderIO",true,"idReservedBeforeBoundary",true),name); + for(String scenario:List.of("unknown","equal-forward","equal-reverse","unequal-forward","unequal-reverse")) { + String text; + if(scenario.equals("unknown"))text="{\"unknown/field~\":{\"not_a_phone\":42}}"; + else {String first=scenario.endsWith("reverse")?"legacy/phone~":standard,last=scenario.endsWith("reverse")?standard:"legacy/phone~"; + String value=scenario.startsWith("unequal")?"5550101":"5550100"; + text="{"+JSON.writeValueAsString(first)+":\"5550100\","+JSON.writeValueAsString(last)+":"+JSON.writeValueAsString(value)+"}";} + var submitted=(ObjectNode)JSON.readTree(text);baseline=f.physical();before=f.counters(); + var wire=assertThrows(TfpEndpointException.class,()->{ + var input=WireFieldAdapter.normalize(submitted,metadata);f.mapped++; + target.updateContactPhone(input.values().get("contact_phone").asText());f.saves++; + target.auditAs("This invalid wire input must never reach Save").save(f.context); + }); + assertEquals(scenario.equals("unknown")?"WIRE_UNKNOWN_FIELD":"WIRE_FIELD_COLLISION",wire.getCode()); + effects=f.delta(before);f.zero(effects,false);assertEquals(Integer.valueOf(0),effects.get("mapped"));assertEquals(Integer.valueOf(0),effects.get("saves")); + assertEquals(baseline,f.physical());f.emit("input-"+scenario,Map.of("code",wire.getCode(),"mapperCalls",0,"saveCalls",0,"checkerCalls",0,"zeroProviderIO",true),name); + } + var input=WireFieldAdapter.normalize((ObjectNode)JSON.readTree("{"+JSON.writeValueAsString(standard)+":\"55509"+f.round+profile.ordinal()+"\"}"),metadata); + target.updateContactPhone(input.values().get("contact_phone").asText());before=f.counters(); + target.auditAs("Persist a valid normalized JSON control").save(f.context);effects=f.delta(before); + assertEquals(Integer.valueOf(1),effects.get("parentInserts"));assertEquals(Integer.valueOf(1),effects.get("audits")); + f.emit("wire-positive-control",Map.of("id",target.getId(),"parentInserts",1),name); + } + assertEquals(26,f.observations); + System.out.println("JAVA_CHECKER_BOUNDARY_RESULT="+JSON.writeValueAsString(Map.of("language","java","passed",true, + "round",f.round,"observations",f.observations,"sameDatabase",true,"physical",f.physical(), + "realJsonInputAdapter","existing-public-object-local-composition","recursiveHttpOrTfpAccepted",false, + "fullCheckerContractAccepted",false,"allP0P1Complete",false))); + } +} diff --git a/examples/fix-e-alignment/ConcurrentQueryExampleTest.java b/examples/fix-e-alignment/ConcurrentQueryExampleTest.java new file mode 100644 index 000000000..4cf15a7d3 --- /dev/null +++ b/examples/fix-e-alignment/ConcurrentQueryExampleTest.java @@ -0,0 +1,165 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** TC-REQ-06: real generated nested queries overlap on one Context and SQLite provider. */ +public class ConcurrentQueryExampleTest { + private static final class Fixture { + final SQLiteDataSource source = new SQLiteDataSource(); + final AtomicInteger reads = new AtomicInteger(), entered = new AtomicInteger(), eReads = new AtomicInteger(), audits = new AtomicInteger(); + final CountDownLatch first = new CountDownLatch(1), both = new CountDownLatch(2), release = new CountDownLatch(1); + final List> events = new CopyOnWriteArrayList<>(); + final AtomicReference caller = new AtomicReference<>(); + final UserContext context; + final String database; + volatile boolean armed; + + Fixture() { + database = Objects.requireNonNull(System.getenv("TEAQL_FIX_E_DB")) + ".concurrent-query.sqlite"; + source.setUrl("jdbc:sqlite:" + database); + var sql = new JdbcSqlExecutor(source) { + @Override public List> queryForList(String statement, Object[] arguments) { + reads.incrementAndGet(); return super.queryForList(statement, arguments); + } + @Override public List query(String statement, Object[] arguments, CompiledRowMapper mapper) { + reads.incrementAndGet(); return super.query(statement, arguments, mapper); + } + }; + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source) { + @Override public QueryResult query(UserContext current, QueryRequest request) { + if (armed && request.parentRequest() == null && List.of("alpha root", "beta root").contains(request.comment())) { + assertSame(caller.get(), current); + assertTrue("runtime query frames must not live on Context", current.getTraceChain().isEmpty()); + entered.incrementAndGet(); first.countDown(); both.countDown(); await(release); + } + return super.query(current, request); + } + }; + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext current) { return LocalDate.of(2032, 2, 29); } + public LocalDateTime businessDateTime(UserContext current) { return businessDate(current).atTime(10, 15, 30); } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service).idGenerationService(ids) + .businessClock(clock).executionLogging(true).logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext current, ExecutionMetadata event) { + if (!armed || !"select".equals(event.getStatementOperation())) return; + assertSame(caller.get(), current); + assertTrue(current.getTraceChain().isEmpty()); + var row = new LinkedHashMap(); + row.put("comment", event.getComment()); row.put("purpose", event.getPurpose()); + row.put("statement", event.getStatementOperation()); row.put("backend", event.getBackend()); + row.put("request", nodes(event.getRequestTraceChain())); row.put("path", nodes(event.getTracePath())); + row.put("thread", Thread.currentThread().getName()); row.put("resultCount", event.getResultCount()); + events.add(row); + } + public void writeAuditEvent(UserContext current, RawAuditEvent event) { if (armed) audits.incrementAndGet(); } + }).build().install(GeneratedRuntimeModule.module()); + context = new GeneratedFixEExampleTest.Context(runtime); caller.set(context); context.ensureSchema(); + } + PurchaseOrder seed(String label) { + var parent = Q.purchaseOrders().comment("Prepare " + label + " parent").purpose("Seed the query isolation example").newEntity(context); + parent.updateContactPhone(label); parent.updateInternalNote(null); + var child = Q.orderItems().comment("Prepare " + label + " child").purpose("Seed a bounded nested query").newEntity(context); + child.updateProductName(label + " child"); child.updateUnitPrice(BigDecimal.ONE); parent.addOrderItem(child); + return parent.auditAs("Seed one independent query graph").save(context); + } + PurchaseOrder query(long id, String label) { + return Q.purchaseOrders().withIdIs(id) + .selectOrderItemListWith(Q.orderItems().limit(10).comment(label + " children")) + .limit(1).comment(label + " root").purpose(label + " purpose").executeForOne(context); + } + void loaded(PurchaseOrder row, String expected) { + int before = reads.get(); + assertEquals(expected, E.purchaseOrder(row).getContactPhone().eval()); + assertEquals(Integer.valueOf(1), E.purchaseOrder(row).getOrderItemList().size().eval()); + assertEquals(expected + " child", E.purchaseOrder(row).getOrderItemList().first().getProductName().eval()); + eReads.addAndGet(reads.get() - before); + assertEquals("E evaluation must not read the provider", before, reads.get()); + } + } + private static List> nodes(List source) { + return source.stream().map(node -> { + var value = new LinkedHashMap(); value.put("kind", node.getKind().name()); + value.put("name", node.getName()); value.put("comment", node.getComment()); return (Map) value; + }).toList(); + } + private static void await(CountDownLatch latch) { + try { assertTrue("bounded query overlap checkpoint", latch.await(10, TimeUnit.SECONDS)); } + catch (InterruptedException error) { Thread.currentThread().interrupt(); throw new AssertionError(error); } + } + @Test public void overlappingGeneratedQueriesKeepIntentAndSqlLineageRequestOwned() throws Exception { + var fixture = new Fixture(); var alpha = fixture.seed("alpha"); var beta = fixture.seed("beta"); + assertTrue(fixture.context.getTraceChain().isEmpty()); fixture.armed = true; + var workers = Executors.newFixedThreadPool(2); + try { + var left = workers.submit(() -> fixture.query(alpha.getId(), "alpha")); await(fixture.first); + var right = workers.submit(() -> fixture.query(beta.getId(), "beta")); await(fixture.both); + assertEquals(2, fixture.entered.get()); assertTrue("both queries are live", !left.isDone() && !right.isDone()); + assertTrue(fixture.context.getTraceChain().isEmpty()); fixture.release.countDown(); + var leftRow = left.get(15, TimeUnit.SECONDS); var rightRow = right.get(15, TimeUnit.SECONDS); + fixture.loaded(leftRow, "alpha"); fixture.loaded(rightRow, "beta"); + } finally { + fixture.release.countDown(); workers.shutdownNow(); assertTrue(workers.awaitTermination(15, TimeUnit.SECONDS)); + } + fixture.loaded(fixture.query(alpha.getId(), "after"), "alpha"); + var result = new LinkedHashMap(); + result.put("round", Integer.parseInt(System.getenv("TEAQL_FIX_E_ROUND"))); result.put("overlapEntered", fixture.entered.get()); + result.put("contextUnchanged", fixture.context.getTraceChain().isEmpty()); result.put("generatedQAndE", true); + result.put("database", "fixture.sqlite.concurrent-query.sqlite"); result.put("alphaId", alpha.getId()); result.put("betaId", beta.getId()); + result.put("events", fixture.events); result.put("eProviderReads", fixture.eReads.get()); result.put("queryAuditEvents", fixture.audits.get()); + System.out.println("JAVA_CONCURRENT_QUERY_OBSERVATION=" + new ObjectMapper().writeValueAsString(result)); + assertTrue(fixture.context.getTraceChain().isEmpty()); assertEquals(6, fixture.events.size()); + assertEquals(0, fixture.audits.get()); + for (String label : List.of("alpha", "beta", "after")) { + var own = fixture.events.stream().filter(row -> (label + " purpose").equals(row.get("purpose"))).toList(); + assertEquals("one root and one derived physical SELECT", 2, own.size()); + assertEquals(Set.of(label + " root"), new HashSet<>(own.stream().map(row -> row.get("comment")).toList())); + for (var row : own) { + assertEquals("sqlite", row.get("backend")); assertEquals("select", row.get("statement")); + String request = new ObjectMapper().writeValueAsString(row.get("request")); + String path = new ObjectMapper().writeValueAsString(row.get("path")); + assertTrue("root business intent survives derived work", request.contains(label + " root")); + for (String other : List.of("alpha", "beta", "after")) if (!other.equals(label)) { + for (String suffix : List.of(" root", " children", " purpose")) { + assertFalse("no sibling intent in business chain", request.contains(other + suffix)); + assertFalse("no sibling intent in physical path", path.contains(other + suffix)); + } + } + @SuppressWarnings("unchecked") var physical = (List>) row.get("path"); + assertEquals("PROVIDER", physical.get(physical.size() - 2).get("kind")); + assertEquals("SQL", physical.get(physical.size() - 1).get("kind")); + assertEquals("select", physical.get(physical.size() - 1).get("name")); + long relations = physical.stream().filter(node -> "RELATION".equals(node.get("kind"))).count(); + assertTrue(relations == 0L || relations == 1L); + assertEquals("explicit nested comment belongs to its business child node", relations == 1L, request.contains(label + " children")); + } + assertEquals(1L, own.stream().filter(row -> new ObjectMapper().valueToTree(row.get("path")).toString().contains("RELATION")).count()); + } + assertEquals(2, fixture.events.stream().filter(row -> List.of("alpha purpose", "beta purpose").contains(row.get("purpose"))) + .map(row -> row.get("thread")).distinct().count()); + result.put("passed", true); + System.out.println("JAVA_CONCURRENT_QUERY=" + new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/fix-e-alignment/ContextRootProbe.java b/examples/fix-e-alignment/ContextRootProbe.java new file mode 100644 index 000000000..94903bd31 --- /dev/null +++ b/examples/fix-e-alignment/ContextRootProbe.java @@ -0,0 +1,154 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.checker.CheckException; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import javax.sql.DataSource; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Actual generated Q/E and audited SQLite saves. Generic writes are adversarial probes only. */ +final class ContextRootProbe { + static final ObjectMapper JSON = new ObjectMapper(); + static final LocalDateTime T0 = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + static final class ObservedSql extends JdbcSqlExecutor { + int queries, writes, transactions, rootLookups; + ObservedSql(DataSource source) { super(source); } + void read(String sql) { queries++; if (sql.toLowerCase(Locale.ROOT).contains("tenant_data")) rootLookups++; } + @Override public List> queryForList(String sql,Object[] args) { read(sql); return super.queryForList(sql,args); } + @Override public List query(String sql,Object[] args,CompiledRowMapper mapper) { read(sql); return super.query(sql,args,mapper); } + @Override public int update(String sql,Object[] args) { writes++; return super.update(sql,args); } + @Override public int[] batchUpdate(String sql,List args) { writes++; return super.batchUpdate(sql,args); } + @Override public void execute(String sql) { writes++; super.execute(sql); } + @Override public void executeInTransaction(Runnable action) { transactions++; super.executeInTransaction(action); } + } + static final class Fixture { + final SQLiteDataSource raw = new SQLiteDataSource(); + final ObservedSql sql; + final SimpleEntityMetaFactory metadata = new SimpleEntityMetaFactory(); + final TeaQLRuntime runtime; + final UserContext context; + int allocations, policies, reviews, audits; + long otherRoot; + Fixture(String file) { + raw.setUrl("jdbc:sqlite:"+file); sql = new ObservedSql(raw); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite",sql,raw); + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext context) { return T0.toLocalDate(); } + public LocalDateTime businessDateTime(UserContext context) { return T0; } + }; + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { return new MutationPolicyIdentity("context-root-probe","1","sha256:root-probe"); } + public MutationDecision review(UserContext context,MutationPlan plan) { reviews++; return MutationDecision.allow(); } + }; + runtime = TeaQLRuntime.builder().metadata(metadata).dataService("default",service).dataService("sqlite",service) + .businessClock(clock).idGenerationService(new InternalIdGenerationService() { + public Long generateId(UserContext caller,Entity entity) { allocations++; return ids.generateId(caller,entity); } + public void ensureFloor(String type,long floor) { ids.ensureFloor(type,floor); } + }).mutationPolicyRegistry(key -> { policies++; return Optional.of(policy); }) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller,ExecutionMetadata event) {} + public void writeAuditEvent(UserContext caller,RawAuditEvent event) { audits++; } + }).build().install(GeneratedRuntimeModule.module()); + context = new GeneratedFixEExampleTest.Context(runtime); context.ensureSchema(); + var other = Q.tenants().comment("Prepare another actual domain root") + .purpose("Distinguish a real wrong owner from an invalid database reference").newEntity(context); + other.updateProperty("name","Other root"); other.auditAs("Create the second root control").save(context); otherRoot=other.getId(); + assertNotEquals(Long.valueOf(1),other.getId()); + } + UserContext withRoot(String type,Long id) { + UserContext result = new GeneratedFixEExampleTest.Context(runtime); + if(type!=null) result.withActiveRoot(new ContextEntityRef(type,id)); + return result; + } + PurchaseOrder parent() { + var row=Q.purchaseOrders().comment("Prepare a root-bound owner") + .purpose("Verify context-root admission before persistence").newEntity(context); + row.updateContactPhone("5550987"); row.updateInternalNote(null); return row; + } + PurchaseOrder saved() { return parent().auditAs("Create a root-bound admission control").save(context); } + PurchaseOrder loaded(long id) { return Q.purchaseOrders().withIdIs(id).limit(1) + .comment("Reload the original owner through generated Q").purpose("Retain authoritative loaded ownership").executeForOne(context); } + void overrideRoot(PurchaseOrder row,long id) { + // Do not discover or invoke a forbidden generated business setter. + var reference=(BaseEntity)metadata.resolveEntityDescriptor("Tenant").createEntity(); + reference.setProperty("id",id); reference.set$status(EntityStatus.REFER); + String member=FieldLayout.forType(row.getClass()).memberName("tenant"); assertNotNull(member); + row.updateProperty(member,reference); + } + Map counters() { return Map.of("queries",sql.queries,"writes",sql.writes,"transactions",sql.transactions, + "allocations",allocations,"policies",policies,"reviews",reviews,"audits",audits,"rootLookups",sql.rootLookups); } + Map delta(Map before) { var values=new TreeMap(); counters().forEach((k,v)->values.put(k,v-before.get(k))); return values; } + List> storage() throws Exception { + var rows=new ArrayList>(); + try(var connection=raw.getConnection();var statement=connection.createStatement();var result=statement.executeQuery( + "SELECT id,version,tenant,contact_phone FROM purchase_order_data ORDER BY id")) { + while(result.next()) rows.add(Arrays.asList(result.getLong(1),result.getLong(2),result.getObject(3),result.getString(4))); + } + return rows; + } + } + static Map reject(Fixture f,String name,PurchaseOrder row,UserContext context,String reason) throws Exception { + var before=f.counters(); var stored=f.storage(); String actual=null,errorType=null; + try { row.auditAs("Reject "+name+" before persistence").save(context); } + catch(ContextRootException error) { actual=error.getReason().name(); errorType="ContextRootException"; } + catch(CheckException error) { actual=error.getViolates().isEmpty()?"empty_check":error.getViolates().get(0).toWire(io.teaql.core.checker.JsonFieldNamingProfile.CAMEL_CASE).ruleId(); errorType="CheckException"; } + catch(RuntimeException error) { actual="provider_or_other"; errorType=error.getClass().getSimpleName(); } + var effects=f.delta(before); boolean unchanged=stored.equals(f.storage()); + boolean matched=reason.equals(actual); + var result=new LinkedHashMap();result.put("case",name);result.put("expectedReason",reason);result.put("reason",actual); + result.put("errorType",errorType);result.put("id",row.getId());result.put("effects",effects);result.put("physicalStateUnchanged",unchanged); + result.put("passed",matched&&unchanged&&effects.values().stream().allMatch(v->v==0)); + System.out.println("JAVA_CONTEXT_ROOT_CASE="+JSON.writeValueAsString(result));return result; + } + static void verify() throws Exception { + var f=new Fixture(System.getenv("TEAQL_FIX_E_DB")+".context-root.sqlite"); var cases=new ArrayList>(); + var owner=f.parent();var item=Q.orderItems().comment("Prepare a child in the same root-bound graph") + .purpose("Verify parent and child receive a trusted root reference").newEntity(f.context); + item.updatePurchaseOrder(owner);item.updateProductName("Root control item");item.updateUnitPrice(BigDecimal.ONE); + var before=f.counters();item.auditAs("Save the trusted parent and child graph").save(f.context);var calibration=f.delta(before); + assertEquals(Long.valueOf(1),E.purchaseOrder(owner).getTenant().getId().eval()); + assertEquals(Long.valueOf(1),E.orderItem(item).getTenant().getId().eval()); + assertTrue(calibration.get("writes")>0);assertTrue(calibration.get("transactions")>0);assertTrue(calibration.get("policies")>0); + assertTrue(calibration.get("reviews")>0);assertEquals(Integer.valueOf(2),calibration.get("audits"));assertEquals(Integer.valueOf(0),calibration.get("rootLookups")); + before=f.counters(); Q.tenants().withIdIs(1L).limit(1).comment("Calibrate the root lookup observer") + .purpose("Ensure a missing root lookup is measured rather than assumed").executeForOne(f.context); + var rootCalibration=f.delta(before);assertTrue(rootCalibration.get("rootLookups")>0); + for(var entry:List.of(new Object[]{"missing-root",null,null,"MISSING"},new Object[]{"wrong-type","Other",1L,"TYPE_MISMATCH"}, + new Object[]{"zero-root","Tenant",0L,"INVALID_ID"},new Object[]{"negative-root","Tenant",-1L,"INVALID_ID"})) + cases.add(reject(f,(String)entry[0],f.parent(),f.withRoot((String)entry[1],(Long)entry[2]),(String)entry[3])); + var bad=f.parent();f.overrideRoot(bad,f.otherRoot);cases.add(reject(f,"explicit-create-mismatch",bad,f.context,"VALUE_MISMATCH")); + for(String name:List.of("update-wrong-context","update-payload-mismatch","update-context-and-root","update-missing-root", + "delete-wrong-context","delete-missing-root","recover-wrong-context","recover-missing-root")) { + var original=f.saved();var row=f.loaded(original.getId()); + if(name.startsWith("recover")) {row.markForDeletion();row.auditAs("Prepare a real tombstone for recovery admission").save(f.context);row.markAsRecover();} + else if(name.startsWith("delete"))row.markForDeletion(); + else row.updateContactPhone("5550988"); + if(name.equals("update-payload-mismatch")||name.equals("update-context-and-root"))f.overrideRoot(row,f.otherRoot); + boolean missing=name.endsWith("missing-root"),same=name.equals("update-payload-mismatch"); + var caller=missing?f.withRoot(null,null):same?f.context:f.withRoot("Tenant",f.otherRoot); + cases.add(reject(f,name,row,caller,missing?"MISSING":"VALUE_MISMATCH")); + } + var failures=cases.stream().filter(v->!Boolean.TRUE.equals(v.get("passed"))).map(v->v.get("case")).toList(); + var result=new LinkedHashMap();result.put("language","java");result.put("passed",failures.isEmpty());result.put("cases",cases); + result.put("failures",failures);result.put("parentId",owner.getId());result.put("childId",item.getId());result.put("otherRoot",f.otherRoot); + result.put("calibration",calibration);result.put("rootCalibration",rootCalibration);result.put("finalStorage",f.storage()); + result.put("queryAuthorizationInferred",false);result.put("newEntityBeforeReturnAccepted",false);result.put("untrustedHydrationAuthorizationInferred",false); + System.out.println("JAVA_CONTEXT_ROOT_RESULT="+JSON.writeValueAsString(result));assertTrue("root admission failures: "+failures,failures.isEmpty()); + } +} diff --git a/examples/fix-e-alignment/ContextRootSubtypeProbe.java b/examples/fix-e-alignment/ContextRootSubtypeProbe.java new file mode 100644 index 000000000..734d514eb --- /dev/null +++ b/examples/fix-e-alignment/ContextRootSubtypeProbe.java @@ -0,0 +1,74 @@ +package io.teaql.examples.fixe; + +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.meta.EntityDescriptor; +import java.util.*; +import static org.junit.Assert.*; + +/** Runtime-owned metadata extension; generated library bytes stay unchanged. */ +final class ContextRootSubtypeProbe { + public static final class SpecializedTenant extends Tenant { + @Override public String typeName() { return "SpecializedTenant"; } + } + public static final class UnknownTenant extends Tenant { + @Override public String typeName() { return "UnregisteredTenant"; } + } + static Tenant reference(Tenant value,long id) { + value.setProperty("id",id);value.set$status(EntityStatus.REFER);return value; + } + static PurchaseOrder loaded(ContextRootProbe.Fixture f,Tenant root) { + var row=f.loaded(f.saved().getId()); + // Framework-only hydration path, not a forbidden public root updater. + row.setProperty(FieldLayout.forType(row.getClass()).memberName("tenant"),root); + row.updateContactPhone("5552001");return row; + } + static Map reject(ContextRootProbe.Fixture f,String name,PurchaseOrder row, + UserContext context,String expected) throws Exception { + var before=f.counters();var stored=f.storage();String actual=null; + try { row.auditAs("Reject invalid specialized-root ownership").save(context); } + catch(ContextRootException error) { actual=error.getReason().name(); } + catch(CheckException error) { actual=error.getViolates().get(0).toWire(JsonFieldNamingProfile.CAMEL_CASE).ruleId(); } + catch(TeaQLRuntimeException error) { + if(!"entityDescriptor UnregisteredTenant cannot be resolved".equals(error.getMessage())) throw error; + actual="unregistered_model"; + } + var delta=f.delta(before);assertEquals(expected,actual);assertEquals(stored,f.storage()); + assertTrue(delta.values().stream().allMatch(v->v==0)); + return Map.of("case",name,"id",row.getId(),"expected",expected,"actual",actual, + "effects",delta,"storageUnchanged",true,"passed",true); + } + static void verify() throws Exception { + var f=new ContextRootProbe.Fixture(System.getenv("TEAQL_FIX_E_DB")+".root-subtype.sqlite"); + var declared=f.metadata.resolveEntityDescriptor("Tenant"); + var subtype=new EntityDescriptor();subtype.setType("SpecializedTenant"); + subtype.setTargetType(SpecializedTenant.class);subtype.setEntitySupplier(SpecializedTenant::new); + subtype.setParent(declared);f.metadata.register(subtype); + var row=loaded(f,reference(new SpecializedTenant(),1));var before=f.counters(); + row.auditAs("Update an object whose loaded root uses a declared subtype").save(f.context); + var positive=f.delta(before);assertTrue(positive.get("writes")>0); + assertEquals(Integer.valueOf(1),positive.get("audits"));assertEquals(Integer.valueOf(0),positive.get("rootLookups")); + assertEquals(Long.valueOf(2),row.getVersion()); + var reloaded=f.loaded(row.getId());assertEquals("5552001",E.purchaseOrder(reloaded).getContactPhone().eval()); + assertEquals(Long.valueOf(1),E.purchaseOrder(reloaded).getTenant().getId().eval()); + var cases=new ArrayList>(); + cases.add(reject(f,"subtype-wrong-context",loaded(f,reference(new SpecializedTenant(),1)), + f.withRoot("Tenant",f.otherRoot),"VALUE_MISMATCH")); + var moved=loaded(f,reference(new SpecializedTenant(),1)); + moved.updateProperty(FieldLayout.forType(moved.getClass()).memberName("tenant"),reference(new SpecializedTenant(),f.otherRoot)); + cases.add(reject(f,"subtype-context-and-payload-transfer",moved,f.withRoot("Tenant",f.otherRoot),"VALUE_MISMATCH")); + cases.add(reject(f,"unregistered-subtype",loaded(f,reference(new UnknownTenant(),1)),f.context,"unregistered_model")); + var detached=loaded(f,reference(new SpecializedTenant(),1));subtype.setParent(null); + try { cases.add(reject(f,"subtype-without-model-inheritance",detached,f.context,"invalid_type")); } + finally { subtype.setParent(declared); } + var result=new LinkedHashMap();result.put("passed",true);result.put("language","java"); + result.put("metadataSource","invoking-context");result.put("positiveId",row.getId()); + result.put("positiveEffects",positive);result.put("cases",cases);result.put("finalStorage",f.storage()); + result.put("generatedLibraryModified",false);result.put("queryAuthorizationInferred",false); + System.out.println("JAVA_CONTEXT_ROOT_SUBTYPE_RESULT="+ContextRootProbe.JSON.writeValueAsString(result)); + } +} diff --git a/examples/fix-e-alignment/ExpressionBoundaryProbe.java b/examples/fix-e-alignment/ExpressionBoundaryProbe.java new file mode 100644 index 000000000..c5eb43ac7 --- /dev/null +++ b/examples/fix-e-alignment/ExpressionBoundaryProbe.java @@ -0,0 +1,189 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import io.teaql.core.CompiledRowMapper; +import io.teaql.core.Entity; +import io.teaql.core.UserContext; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.checker.ObjectLocation; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.core.value.Expression; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import java.util.stream.Stream; +import javax.sql.DataSource; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Normal generated Q/E and audited SQLite saves; no generated implementations are changed. */ +final class ExpressionBoundaryProbe { + /** Count real provider entry points without changing SQL, parameters, rows or transactions. */ + static final class ObservedSql extends JdbcSqlExecutor { + final AtomicInteger calls = new AtomicInteger(); + ObservedSql(DataSource source) { super(source); } + @Override public List> queryForList(String sql, Object[] args) { + calls.incrementAndGet(); return super.queryForList(sql, args); + } + @Override public List query(String sql, Object[] args, CompiledRowMapper mapper) { + calls.incrementAndGet(); return super.query(sql, args, mapper); + } + @Override public Stream> queryForStream(String sql, Object[] args) { + calls.incrementAndGet(); return super.queryForStream(sql, args); + } + @Override public Stream queryForStream(String sql, Object[] args, CompiledRowMapper mapper) { + calls.incrementAndGet(); return super.queryForStream(sql, args, mapper); + } + @Override public void execute(String sql) { calls.incrementAndGet(); super.execute(sql); } + @Override public int update(String sql, Object[] args) { calls.incrementAndGet(); return super.update(sql, args); } + @Override public int[] batchUpdate(String sql, List args) { calls.incrementAndGet(); return super.batchUpdate(sql, args); } + @Override public void executeInTransaction(Runnable action) { calls.incrementAndGet(); super.executeInTransaction(action); } + } + @FunctionalInterface interface Operation { void run(Expression e, AtomicInteger callbacks) throws Throwable; } + record Terminal(String name, String suffix, Operation operation) { } + static List terminals() { + return List.of( + new Terminal("eval", "eval()", (e, c) -> e.eval()), + new Terminal("resolve", "resolve()", (e, c) -> e.resolve()), + new Terminal("orIfNull", "orIfNull()", (e, c) -> e.orIfNull("PRIVATE-TERMINAL-ARGUMENT")), + new Terminal("orElseThrow", "orElseThrow()", (e, c) -> e.orElseThrow()), + new Terminal("orElseThrowSupplier", "orElseThrow()", (e, c) -> e.orElseThrow(() -> { + c.incrementAndGet(); return new AssertionError("PRIVATE-TERMINAL-ARGUMENT"); + })), + new Terminal("isNull", "isNull()", (e, c) -> e.isNull()), + new Terminal("isNotNull", "isNotNull()", (e, c) -> e.isNotNull()), + new Terminal("isEmpty", "isEmpty()", (e, c) -> e.isEmpty()), + new Terminal("isNotEmpty", "isNotEmpty()", (e, c) -> e.isNotEmpty()), + new Terminal("whenIsNull", "whenIsNull()", (e, c) -> e.whenIsNull(c::incrementAndGet)), + new Terminal("whenIsNotNullRunnable", "whenIsNotNull()", (e, c) -> e.whenIsNotNull((Runnable) c::incrementAndGet)), + new Terminal("whenIsNotNullConsumer", "whenIsNotNull()", (e, c) -> e.whenIsNotNull((Consumer) value -> c.incrementAndGet())), + new Terminal("whenIsEmpty", "whenIsEmpty()", (e, c) -> e.whenIsEmpty(c::incrementAndGet)), + new Terminal("whenNotEmptyConsumer", "whenNotEmpty()", (e, c) -> e.whenNotEmpty((Consumer) value -> c.incrementAndGet())), + new Terminal("whenNotEmptyRunnable", "whenNotEmpty()", (e, c) -> e.whenNotEmpty((Runnable) c::incrementAndGet))); + } + static Map diagnostic(String name, TeaQLNotLoadedException error, String pointer, + int index, String attempted, String chain, List failures) { + var wire = error.toWire(); + boolean passed = pointer.equals(wire.instancePath()) && index == wire.breakPointIndex() + && attempted.equals(wire.attemptedInstancePath()) && chain.equals(wire.expressionWithBrokenPoint()) + && error.getMessage().contains(chain) && !error.getMessage().contains("\"instancePath\"") + && error.getMessage().startsWith("TeaQLNotLoadedError: root=PurchaseOrder access_path="); + if (!passed) failures.add(name); + return Map.of("name", name, "wire", wire, "human", error.getMessage(), "passed", passed); + } + static void verify() throws Exception { + String database = System.getenv("TEAQL_FIX_E_DB") + ".expression-boundaries.sqlite"; + var source = new SQLiteDataSource(); source.setUrl("jdbc:sqlite:" + database); + var time = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + BusinessClock clock = new BusinessClock() { + public LocalDate businessDate(UserContext context) { return time.toLocalDate(); } + public LocalDateTime businessDateTime(UserContext context) { return time; } + }; + try (var keeper = source.getConnection()) { + var sql = new ObservedSql(source); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source); + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(ids).businessClock(clock).build().install(GeneratedRuntimeModule.module()); + UserContext context = new GeneratedFixEExampleTest.Context(runtime); context.ensureSchema(); + var order = Q.purchaseOrders().comment("Prepare the Java expression owner") + .purpose("Verify generated E boundaries with real SQLite").newEntity(context); + order.updateContactPhone("5550391"); order.updateInternalNote(null); + order.auditAs("Create Java E boundary owner").save(context); + var sparse = Q.purchaseOrdersWithMinimalFields().withIdIs(order.getId()).limit(1) + .comment("Load identity only").purpose("Observe genuine NotLoaded data").executeForOne(context); + var late = Q.purchaseOrdersWithMinimalFields().withIdIs(order.getId()) + .selectTenantWith(Q.tenantsWithMinimalFields().limit(1).comment("Load target identity only")) + .limit(1).comment("Load relation without its name").purpose("Distinguish a missing leaf").executeForOne(context); + var empty = Q.purchaseOrders().withIdIs(order.getId()) + .selectOrderItemListWith(Q.orderItemsWithMinimalFields().limit(10).comment("Load an empty child list")) + .limit(1).comment("Load null and empty data").purpose("Verify legitimate absence").executeForOne(context); + assertNotNull(sparse); assertNotNull(late); assertNotNull(empty); assertTrue(sql.calls.get() > 0); + int before = sql.calls.get(); var state = sparse.__internalLoadState(); var dirty = List.copyOf(sparse.getUpdatedProperties()); + var failures = new ArrayList(); var cases = new ArrayList>(); + var earlyError = assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(sparse).getTenant().getName().eval()); + cases.add(diagnostic("missing-relation", earlyError, "/tenant", 0, "/tenant/name", + "E.purchaseOrder().getTenant().getName().eval()", failures)); + assertEquals(Long.valueOf(1), E.purchaseOrder(late).getTenant().getId().eval()); + var leafError = assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(late).getTenant().getName().eval()); + cases.add(diagnostic("missing-late-leaf", leafError, "/tenant/name", 1, "/tenant/name", + "E.purchaseOrder().getTenant().getName().eval()", failures)); + assertNull(E.purchaseOrder(empty).getInternalNote().eval()); + assertEquals(Integer.valueOf(0), E.purchaseOrder(empty).getOrderItemList().size().eval()); + assertNull(E.purchaseOrder(empty).getOrderItemList().first().getProductName().eval()); + assertNull(E.purchaseOrder(empty).getOrderItemList().get(2).getProductName().eval()); + cases.add(Map.of("name", "loaded-null-empty-and-out-of-range", "null", true, "emptyCount", 0, + "firstAbsent", true, "indexAbsent", true, "passed", true)); + var terminals = new ArrayList>(); + var scalar = E.purchaseOrder(sparse).getContactPhone(); + for (var terminal : terminals()) { + var callbacks = new AtomicInteger(); + var error = assertThrows(TeaQLNotLoadedException.class, () -> terminal.operation().run(scalar, callbacks)); + String expected = "E.purchaseOrder().getContactPhone()." + terminal.suffix(); + boolean passed = expected.equals(error.getExpressionWithBrokenPoint()) && callbacks.get() == 0 + && !error.getMessage().contains("PRIVATE-TERMINAL-ARGUMENT") + && error.getMessage().startsWith("TeaQLNotLoadedError: root=PurchaseOrder access_path="); + if (!passed) failures.add("terminal:" + terminal.name()); + terminals.add(Map.of("name", terminal.name(), "expected", expected, "wire", error.toWire(), + "human", error.getMessage(), "callbacks", callbacks.get(), "passed", passed)); + } + cases.add(Map.of("name", "all-public-terminals", "observations", terminals, "passed", failures.stream().noneMatch(v -> v.startsWith("terminal:")))); + var callbacks = new AtomicInteger(); + E.purchaseOrder(empty).getInternalNote().whenIsNull(callbacks::incrementAndGet); + assertEquals(1, callbacks.get()); assertEquals("loaded-null-default", E.purchaseOrder(empty).getInternalNote().orIfNull("loaded-null-default")); + assertNull(E.purchaseOrder(empty).getInternalNote().eval()); + cases.add(Map.of("name", "loaded-null-fallback", "calls", 1, "originalNullUnchanged", true, "passed", true)); + var parent = E.purchaseOrder(late).getTenant(); + var sibling = parent.getName(); var snapshot = assertThrows(TeaQLNotLoadedException.class, sibling::eval).toWire(); + assertThrows(TeaQLNotLoadedException.class, () -> parent.getPurchaseOrderList().first().getTenant().getName().eval()); + assertEquals(snapshot, assertThrows(TeaQLNotLoadedException.class, sibling::eval).toWire()); + assertEquals(sql.calls.get(), before); assertSame(state, sparse.__internalLoadState()); assertEquals(dirty, sparse.getUpdatedProperties()); + assertFalse(sparse.__internalHasMutationLedger()); assertFalse(late.__internalHasMutationLedger()); assertFalse(empty.__internalHasMutationLedger()); + cases.add(Map.of("name", "pure-evaluation", "providerCalls", 0, "observerCalibrated", true, + "loadedSnapshotUnchanged", true, "dirtyStateUnchanged", true, "mutationLedgerCreated", false, "siblingUnchanged", true, "passed", true)); + var item = Q.orderItems().comment("Prepare a partial child projection") + .purpose("Observe a real canonical list index").newEntity(context); + item.updatePurchaseOrder(order); item.updateProductName("Java expression item"); item.updateUnitPrice(BigDecimal.ONE); + item.auditAs("Create Java E boundary child").save(context); + var list = Q.purchaseOrdersWithMinimalFields().withIdIs(order.getId()) + .selectOrderItemListWith(Q.orderItemsWithMinimalFields().limit(10).comment("Load child identity only")) + .limit(1).comment("Load a real partial child").purpose("Mark a missing field after a real list index").executeForOne(context); + before = sql.calls.get(); + var childError = assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(list).getOrderItemList().first().getProductName().eval()); + cases.add(diagnostic("missing-child-leaf", childError, "/orderItemList/0/productName", 2, "/orderItemList/0/productName", + "E.purchaseOrder().getOrderItemList().first().getProductName().eval()", failures)); + var profiles = new ArrayList(); + for (var profile : JsonFieldNamingProfile.values()) profiles.add(childError.toWire(profile)); + cases.add(Map.of("name", "generated-three-json-profiles", "profiles", profiles, "passed", true)); + assertEquals(Integer.valueOf(0), E.purchaseOrder(empty).getOrderItemList().size().eval()); + assertEquals(Integer.valueOf(1), E.purchaseOrder(list).getOrderItemList().size().eval()); assertEquals(before, sql.calls.get()); + cases.add(Map.of("name", "independent-projection-snapshots", "oldSize", 0, "newSize", 1, "providerCalls", 0, "passed", true)); + var literal = new TeaQLNotLoadedException("SyntheticRow", ObjectLocation.hashRoot("contact.phone/~alias").element(2).member("user_url"), + "user_url", JsonFieldNamingProfile.CAMEL_CASE); + assertEquals("/contact.phone~1~0alias/2/userUrl", literal.toWire().instancePath()); + cases.add(Map.of("name", "native-literal-location", "wire", literal.toWire(), "scope", "native-location-only", "passed", true)); + var mapper = new ObjectMapper(); + for (var value : cases) System.out.println("JAVA_E_BOUNDARY_CASE=" + mapper.writeValueAsString(value)); + System.out.println("JAVA_E_BOUNDARY_RESULT=" + mapper.writeValueAsString(Map.of( + "language", "java", "normalGeneratedQAndE", true, "passed", failures.isEmpty(), "cases", cases, + "orderID", order.getId(), "childID", item.getId(), "version", E.purchaseOrder(order).getVersion().eval(), + "failures", failures, "fullDiagnosticContractAccepted", false, "allP0P1Complete", false))); + assertTrue("Java generated E boundary failures: " + failures, failures.isEmpty()); + } + } +} diff --git a/examples/fix-e-alignment/GeneratedFixEExampleTest.java b/examples/fix-e-alignment/GeneratedFixEExampleTest.java new file mode 100644 index 000000000..353fa5694 --- /dev/null +++ b/examples/fix-e-alignment/GeneratedFixEExampleTest.java @@ -0,0 +1,147 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.CheckerFixAdvancedUserContext; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import io.teaql.core.UserContext; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicReference; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Application-owned source; its generated dependency is never patched to make the test pass. */ +public class GeneratedFixEExampleTest { + static final class Context extends DefaultUserContext implements CheckerFixAdvancedUserContext { + Context(TeaQLRuntime runtime) { super(runtime); } + } + record DatabaseBridge(SqlExecutionAdapter sql) implements TeaQLDatabase { + public List> query(String query, Object[] args) { return sql.queryForList(query, args); } + public int executeUpdate(String query, Object[] args) { return sql.update(query, args); } + public int[] batchUpdate(String query, List args) { return sql.batchUpdate(query, args); } + public void execute(String query) { sql.execute(query); } + public void executeInTransaction(Runnable action) { sql.executeInTransaction(action); } + public List> getTableColumns(String table) { + throw new UnsupportedOperationException("Schema inspection belongs to the dialect"); + } + } + + @Test public void localGeneratedSaveAndEConsumeTheBusinessClock() throws Exception { + String expectedRuntime = System.getProperty("teaql.expected.runtime.root"); + if (expectedRuntime != null) { + var root = java.nio.file.Path.of(expectedRuntime).toRealPath(); + for (Class type : List.of(UserContext.class, TeaQLRuntime.class, SqliteDataServiceExecutor.class)) { + var origin = java.nio.file.Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath(); + assertTrue("runtime class must come from the source-paired reactor: " + type.getName(), origin.startsWith(root)); + } + } + var first = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + var second = first.plusHours(25); + var time = new AtomicReference<>(first); + BusinessClock clock = new BusinessClock() { + public LocalDate businessDate(UserContext context) { return time.get().toLocalDate(); } + public LocalDateTime businessDateTime(UserContext context) { return time.get(); } + }; + var source = new SQLiteDataSource(); + String database = System.getenv("TEAQL_FIX_E_DB"); + source.setUrl(database == null ? "jdbc:sqlite:file:teaql-fix-e-" + UUID.randomUUID() + "?mode=memory&cache=shared" + : "jdbc:sqlite:" + database); + // Keep this named in-memory database alive across provider connections. + try (var keeper = source.getConnection()) { + var sql = new JdbcSqlExecutor(source); + var ids = new IdSpaceIdGenerator(new DatabaseBridge(sql)); + ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source); + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(ids).businessClock(clock).build().install(GeneratedRuntimeModule.module()); + UserContext context = new Context(runtime); + context.ensureSchema(); + var order = Q.purchaseOrders().comment("Prepare the synthetic clock fixture") + .purpose("Verify generated audited saves and expression diagnostics").newEntity(context); + order.updateContactPhone("5550100"); + order.updateInternalNote(null); + order.auditAs("Create the synthetic Fix order").save(context); + assertEquals(first, E.purchaseOrder(order).getCreateTime().eval()); + assertEquals(first, E.purchaseOrder(order).getUpdateTime().eval()); + assertEquals(Long.valueOf(1), E.purchaseOrder(order).getTenant().getId().eval()); + assertEquals("fallback", E.purchaseOrder(order).getInternalNote().orIfNull("fallback")); + + var partial = Q.purchaseOrdersWithMinimalFields().withIdIs(order.getId()).limit(1) + .comment("Load the identity projection without eager data") + .purpose("Verify complete E diagnostics without implicit loading").executeForOne(context); + var diagnostics = new ArrayList(); + var humanMessages = new ArrayList(); + var error = assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(partial).getTenant().getName().eval()); + assertEquals("/tenant", error.toWire().instancePath()); + assertEquals("/tenant/name", error.toWire().attemptedInstancePath()); + assertEquals("E.purchaseOrder().getTenant().getName().eval()", error.getExpressionWithBrokenPoint()); + diagnostics.add(error.toWire()); + humanMessages.add(error.getMessage()); + error = assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(partial) + .getTenant().getPurchaseOrderList().first().getTenant().getName().eval()); + assertEquals("E.purchaseOrder().getTenant().getPurchaseOrderList().first().getTenant().getName().eval()", error.getExpressionWithBrokenPoint()); + diagnostics.add(error.toWire()); + humanMessages.add(error.getMessage()); + error = assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(partial).getOrderItemList().get(2).getProductName().eval()); + assertEquals("/orderItemList", error.toWire().instancePath()); + assertEquals("/orderItemList/2/productName", error.toWire().attemptedInstancePath()); + diagnostics.add(error.toWire()); + humanMessages.add(error.getMessage()); + error = assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(partial).getContactPhone().orIfNull("PRIVATE-FALLBACK")); + assertEquals("E.purchaseOrder().getContactPhone().orIfNull()", error.getExpressionWithBrokenPoint()); + assertFalse(error.getMessage().contains("PRIVATE-FALLBACK")); + diagnostics.add(error.toWire()); + humanMessages.add(error.getMessage()); + + time.set(second); + var loaded = Q.purchaseOrders().withIdIs(order.getId()).limit(1) + .comment("Reload the complete order before changing it") + .purpose("Verify update Fix preserves the original create time").executeForOne(context); + loaded.updateContactPhone("5550101"); + loaded.auditAs("Update the synthetic Fix order").save(context); + var persisted = Q.purchaseOrders().withIdIs(order.getId()).limit(1) + .comment("Reload the persisted update").purpose("Verify Business Clock values using E").executeForOne(context); + assertEquals(first, E.purchaseOrder(persisted).getCreateTime().eval()); + assertEquals(second, E.purchaseOrder(persisted).getUpdateTime().eval()); + assertEquals("5550101", E.purchaseOrder(persisted).getContactPhone().eval()); + + var itemSum = Q.orderItems().limit(10).comment("sum order item prices"); + itemSum.sum("itemPrice", "unit_price"); itemSum.setPartitionProperty("purchase_order"); + var withSum = Q.purchaseOrders().withIdIs(order.getId()).limit(1); + withSum.addSingleAggregateDynamicProperty("emptyItemSum", itemSum); + var aggregate = withSum.comment("load order with its selected total") + .purpose("verify empty SUM through generated Q and E").executeForOne(context); + assertEquals(order.getId(), E.purchaseOrder(aggregate).getId().eval()); + assertTrue(aggregate.hasDynamicProperty("emptyItemSum")); + assertNull(aggregate.getDynamicProperty("emptyItemSum")); + System.out.println("GENERATED_EMPTY_SUM_PASS language=java present=true value=null"); + LoadingProbe.verify(context, order.getId()); + OwnershipProbe.verify(context); + ExpressionBoundaryProbe.verify(); + ContextRootProbe.verify(); + ContextRootSubtypeProbe.verify(); + System.out.println("FIX_E_EXAMPLE=" + new ObjectMapper().writeValueAsString(Map.of( + "language", "java", "passed", true, "normalGeneratedSave", true, + "createTimePreserved", true, "updateTimeAdvanced", true, + "declaredContextRootInjected", true, "diagnostics", diagnostics, "humanMessages", humanMessages))); + } + } +} diff --git a/examples/fix-e-alignment/LoadingProbe.java b/examples/fix-e-alignment/LoadingProbe.java new file mode 100644 index 000000000..0ff704988 --- /dev/null +++ b/examples/fix-e-alignment/LoadingProbe.java @@ -0,0 +1,50 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.Q; +import io.teaql.core.UserContext; +import io.teaql.core.checker.CheckException; +import io.teaql.core.value.TeaQLNotLoadedException; +import java.util.Map; +import static org.junit.Assert.*; + +/** Real generated Q/E and save calls; no generated source or hand-built row states. */ +final class LoadingProbe { + static void verify(UserContext context, Long orderId) throws Exception { + var owner = Q.purchaseOrders().withIdIs(orderId) + .selectTenantWith(Q.tenantsWithMinimalFields().withIdIs(2L).limit(1) + .comment("Load only a different tenant's detail")) + .limit(1).comment("Keep the selected reference when target detail is filtered out") + .purpose("Verify filtered forward details retain NotLoaded semantics").executeForOne(context); + assertNotNull(owner); + assertEquals(Long.valueOf(1), E.purchaseOrder(owner).getTenant().getId().eval()); + var missing = assertThrows(TeaQLNotLoadedException.class, + () -> E.purchaseOrder(owner).getTenant().getName().eval()); + assertEquals("/tenant/name", missing.toWire().attemptedInstancePath()); + assertTrue(missing.getExpressionWithBrokenPoint().contains("")); + owner.updateContactPhone("5550102"); + owner.auditAs("Change only the complete owner, not its partial target").save(context); + var complete = Q.purchaseOrders().withIdIs(orderId).limit(1) + .comment("Reload the successful owner update") + .purpose("Verify untouched partial targets do not prevent saving the owner").executeForOne(context); + assertEquals("5550102", E.purchaseOrder(complete).getContactPhone().eval()); + var version = E.purchaseOrder(complete).getVersion().eval(); + var partial = Q.purchaseOrdersWithMinimalFields().withIdIs(orderId).limit(1) + .comment("Load an identity-only owner") + .purpose("Reject changes to an incomplete owner before persistence").executeForOne(context); + partial.updateContactPhone("5550103"); + var rejected = assertThrows(CheckException.class, + () -> partial.auditAs("Attempt to modify an incomplete owner").save(context)); + assertFalse(rejected.getViolates().isEmpty()); + var unchanged = Q.purchaseOrders().withIdIs(orderId).limit(1) + .comment("Reload after the rejected incomplete mutation") + .purpose("Verify persisted values and version remain unchanged").executeForOne(context); + assertEquals("5550102", E.purchaseOrder(unchanged).getContactPhone().eval()); + assertEquals(version, E.purchaseOrder(unchanged).getVersion().eval()); + System.out.println("CORE_LOAD_EXAMPLE=" + new ObjectMapper().writeValueAsString(Map.of( + "language", "java", "passed", true, "foreignKeyPreserved", true, + "filteredDetailNotLoaded", missing.toWire(), "untouchedPartialTargetSave", true, + "modifiedPartialOwnerRejected", true, "rejectedVersionUnchanged", true))); + } +} diff --git a/examples/fix-e-alignment/MixedGraphExampleTest.java b/examples/fix-e-alignment/MixedGraphExampleTest.java new file mode 100644 index 000000000..a3b883ab7 --- /dev/null +++ b/examples/fix-e-alignment/MixedGraphExampleTest.java @@ -0,0 +1,323 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** ML-09/ML-11: one generated graph, three operation kinds, actual SQLite rollback. */ +public class MixedGraphExampleTest { + private static final LocalDateTime NOW = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + + private static final class Fixture { + final String scenario, database; + final SQLiteDataSource source = new SQLiteDataSource(); + final ContextRootProbe.ObservedSql sql; + final UserContext context; + final PurchaseOrder order; + final OrderItem removed, added; + final List> operands = new ArrayList<>(); + final List> beforeCommit = new ArrayList<>(); + boolean armed, failSecond; + int policies, begins, commits, rollbacks, audits, attempts; + + Fixture(String scenario) { + this.scenario = scenario; + String base = System.getenv("TEAQL_FIX_E_DB"); + assertNotNull("the runner owns and retains the actual SQLite files", base); + database = base + ".mixed-graph-" + scenario + ".sqlite"; + source.setUrl("jdbc:sqlite:" + database); + if (scenario.equals("commit-failure")) source.setEnforceForeignKeys(true); + sql = new ContextRootProbe.ObservedSql(source); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); + ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source) { + @Override public T executeInTransaction(UserContext caller, TransactionCallback action) { + if (armed) begins++; + try { + T result = super.executeInTransaction(caller, () -> { + T value = action.doInTransaction(); + if (armed && scenario.equals("commit-failure")) { + // The callback has completed, but JdbcSqlExecutor + // has not called Connection.commit() yet. These + // reads use its real transaction-bound connection. + var parent = sql.queryForList("SELECT version FROM purchase_order_data WHERE id=?", + new Object[]{order.getId()}).get(0); + var old = sql.queryForList("SELECT version FROM order_item_data WHERE id=?", + new Object[]{removed.getId()}).get(0); + var fresh = sql.queryForList("SELECT version,purchase_order FROM order_item_data WHERE id=?", + new Object[]{added.getId()}).get(0); + int violations = sql.queryForList("PRAGMA foreign_key_check", new Object[0]).size(); + assertEquals(3, attempts - beforeCommit.size() * 3); + assertEquals(0, audits); + assertEquals(2L, ((Number) parent.get("version")).longValue()); + assertEquals(-2L, ((Number) old.get("version")).longValue()); + assertEquals(1L, ((Number) fresh.get("version")).longValue()); + assertEquals(order.getId().longValue(), ((Number) fresh.get("purchase_order")).longValue()); + beforeCommit.add(Map.of("writes", 3, "audits", audits, "violations", violations, + "parentVersion", 2L, "oldVersion", -2L, "newVersion", 1L)); + } + return value; + }); + if (armed) commits++; + return result; + } catch (RuntimeException | Error error) { + if (armed) rollbacks++; + throw error; + } + } + @Override public MutationResult mutate(UserContext caller, PersistenceMutation request) { + if (armed) { + attempts++; + if (failSecond && attempts == 2) + throw new TeaQLRuntimeException("MIXED_GRAPH_INJECTED_SECOND_WRITE_FAILURE"); + } + var mutation = (EntityPersistenceMutation) request; + var target = mutation.getEntity(); + var operand = new LinkedHashMap(); + operand.put("entity", target.typeName()); operand.put("id", target.getId()); + operand.put("action", mutation.getAction().name()); operand.put("originalVersion", target.getVersion()); + MutationResult result = super.mutate(caller, request); + if (armed) operands.add(operand); + return result; + } + }; + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext caller) { return NOW.toLocalDate(); } + public LocalDateTime businessDateTime(UserContext caller) { return NOW; } + }; + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { + return new MutationPolicyIdentity("mixed-graph-example", "1", "sha256:mixed-graph-example"); + } + public MutationDecision review(UserContext caller, MutationPlan plan) { + if (armed) { + policies++; + assertEquals(3, plan.operations().size()); + var kinds = EnumSet.noneOf(MutationOperationKind.class); + for (var operation : plan.operations()) { + assertTrue("exactly one operation of each kind", kinds.add(operation.kind())); + switch (operation.kind()) { + case CREATE -> { + assertEquals(new EntityKey("OrderItem", added.getId()), operation.entity()); + assertNull(operation.originalVersion()); + } + case UPDATE -> { + assertEquals(new EntityKey("PurchaseOrder", order.getId()), operation.entity()); + assertEquals(Long.valueOf(1), operation.originalVersion()); + assertEquals("updated", operation.changedValues().get("contact_phone")); + } + case DELETE -> { + assertEquals(new EntityKey("OrderItem", removed.getId()), operation.entity()); + assertEquals(Long.valueOf(1), operation.originalVersion()); + } + default -> fail("unexpected mutation kind"); + } + } + assertEquals(EnumSet.of(MutationOperationKind.CREATE, MutationOperationKind.UPDATE, + MutationOperationKind.DELETE), kinds); + } + return MutationDecision.allow(); + } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(ids).businessClock(clock).executionLogging(false) + .mutationPolicyRegistry(key -> Optional.of(policy)) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller, ExecutionMetadata event) {} + }).build().install(GeneratedRuntimeModule.module()); + context = new GeneratedFixEExampleTest.Context(runtime); + context.putAttribute(AppAuditEventSink.class.getName(), + (AppAuditEventSink) (caller, event) -> { if (armed) audits++; }); + context.ensureSchema(); + order = Q.purchaseOrders().comment("Prepare the mixed graph parent") + .purpose("Verify atomic create update and deletion through generated APIs").newEntity(context); + order.updateContactPhone("initial"); order.updateInternalNote("mixed graph control"); + removed = Q.orderItems().comment("Prepare an existing child for later deletion") + .purpose("Verify pending deletion joins the same audited graph save").newEntity(context); + removed.updateProductName("Removed item"); removed.updateUnitPrice(BigDecimal.ONE); + order.addOrderItem(removed); + order.auditAs("Persist the existing parent and child before the mixed mutation").save(context); + assertEquals(Long.valueOf(1), order.getVersion()); assertEquals(Long.valueOf(1), removed.getVersion()); + + added = Q.orderItems().comment("Prepare a newly identified replacement child") + .purpose("Verify insertion joins the same graph as update and deletion").newEntity(context); + added.updateProductName("Added item"); added.updateUnitPrice(new BigDecimal("2")); + order.addOrderItem(added); + assertTrue(added.getId() > 0); assertNull(added.getVersion()); + assertNotEquals(added.getId(), removed.getId()); + order.updateContactPhone("updated"); + int readsBefore = sql.queries, writesBefore = sql.writes; + removed.markForDeletion(); + assertEquals("markForDeletion cannot read the provider", readsBefore, sql.queries); + assertEquals("markForDeletion cannot write the provider", writesBefore, sql.writes); + sql.writes = 0; sql.transactions = 0; armed = true; + } + + void save() { order.auditAs("Apply the reviewed insertion update and deletion as one graph").save(context); } + + void storage(boolean committed) throws Exception { + var parent = Q.purchaseOrders().withIdIs(order.getId()).limit(1) + .comment("Read the mixed graph parent after a save attempt") + .purpose("Compare generated E values with the atomic commit outcome").executeForOne(context); + assertEquals(committed ? "updated" : "initial", E.purchaseOrder(parent).getContactPhone().eval()); + assertEquals(Long.valueOf(committed ? 2 : 1), E.purchaseOrder(parent).getVersion().eval()); + var child = Q.orderItems().withIdIs(added.getId()).limit(1) + .comment("Read the replacement child after a save attempt") + .purpose("Verify a rolled back insertion is absent and a committed insertion is readable").executeForOne(context); + var old = Q.orderItems().withIdIs(removed.getId()).limit(1) + .comment("Read the deleted child through the ordinary generated query") + .purpose("Verify tombstones are excluded from the normal live graph").executeForOne(context); + if (committed) { + assertNotNull(child); assertNull(old); + assertEquals("Added item", E.orderItem(child).getProductName().eval()); + assertEquals(0, new BigDecimal("2").compareTo(E.orderItem(child).getUnitPrice().eval())); + assertEquals(Long.valueOf(1), E.orderItem(child).getVersion().eval()); + } else { assertNull(child); assertNotNull(old); } + // Independent, read-only SQL oracle, not an alternative business write path. + try (var connection = source.getConnection(); var statement = connection.prepareStatement( + "SELECT version,purchase_order,product_name FROM order_item_data WHERE id=?")) { + statement.setLong(1, removed.getId()); + try (var row = statement.executeQuery()) { + assertTrue(row.next()); assertEquals(committed ? -2L : 1L, row.getLong(1)); + assertEquals(order.getId().longValue(), row.getLong(2)); + assertEquals("Removed item", row.getString(3)); assertFalse(row.next()); + } + statement.setLong(1, added.getId()); + try (var row = statement.executeQuery()) { + assertEquals(committed, row.next()); + if (committed) { + assertEquals(1L, row.getLong(1)); assertEquals(order.getId().longValue(), row.getLong(2)); + assertEquals("Added item", row.getString(3)); assertFalse(row.next()); + } + } + } + } + + Map effects() { + return Map.of("policies", policies, "providerAttempts", attempts, "providerWrites", operands.size(), + "sqlWrites", sql.writes, "begins", begins, "commits", commits, "rollbacks", rollbacks, "audits", audits); + } + + void committed(Map rejected) throws Exception { + assertEquals(Long.valueOf(2), order.getVersion()); + assertEquals(Long.valueOf(-2), removed.getVersion()); + assertEquals(Long.valueOf(1), added.getVersion()); + assertTrue(added.getEntityMutationLedger().currentChangeSet().changes().isEmpty()); + storage(true); + var beforeNoOp = effects(); + save(); + assertEquals("a repeated save cannot write or audit the committed graph again", beforeNoOp, effects()); + storage(true); + var result = new LinkedHashMap(); + result.put("case", scenario); result.put("round", Integer.parseInt(System.getenv("TEAQL_FIX_E_ROUND"))); + result.put("passed", true); result.put("orderId", order.getId()); result.put("removedId", removed.getId()); + result.put("addedId", added.getId()); result.put("database", java.nio.file.Path.of(database).getFileName().toString()); + result.put("rejected", rejected); result.put("final", effects()); result.put("operands", operands); + result.put("generatedQAndEReadback", true); result.put("readOnlySqlOracle", true); + result.put("repeatedSaveIsNoOp", true); + if (scenario.equals("commit-failure")) result.put("beforeCommit", beforeCommit); + System.out.println("JAVA_MIXED_GRAPH_CASE=" + new ObjectMapper().writeValueAsString(result)); + } + } + + @Test public void oneReviewedGraphCreatesUpdatesAndDeletesAtomically() throws Exception { + var f = new Fixture("commit"); f.save(); + assertEquals(1, f.policies); assertEquals(3, f.attempts); assertEquals(3, f.operands.size()); + assertEquals(3, f.sql.writes); assertEquals(1, f.begins); assertEquals(1, f.commits); + assertEquals(0, f.rollbacks); assertEquals(3, f.audits); + f.committed(Map.of()); + } + + @Test public void secondProviderFailureRollsBackAllKindsAndOriginalGraphRetries() throws Exception { + var f = new Fixture("rollback"); + long orderId = f.order.getId(), oldId = f.removed.getId(), addedId = f.added.getId(); + f.failSecond = true; + var error = assertThrows(TeaQLRuntimeException.class, f::save); + assertTrue(error.getMessage(), error.getMessage().contains("MIXED_GRAPH_INJECTED_SECOND_WRITE_FAILURE")); + assertEquals(1, f.policies); assertEquals(2, f.attempts); assertEquals(1, f.operands.size()); + assertEquals(1, f.sql.writes); assertEquals(1, f.begins); assertEquals(0, f.commits); + assertEquals(1, f.rollbacks); assertEquals(0, f.audits); + assertEquals(Long.valueOf(1), f.order.getVersion()); assertEquals(Long.valueOf(1), f.removed.getVersion()); + assertNull(f.added.getVersion()); assertTrue(f.added.newItem()); + assertFalse(f.added.getEntityMutationLedger().currentChangeSet().changes().isEmpty()); + assertEquals("updated", E.purchaseOrder(f.order).getContactPhone().eval()); + f.storage(false); + var rejected = f.effects(); + f.failSecond = false; f.save(); + assertEquals(orderId, f.order.getId().longValue()); assertEquals(oldId, f.removed.getId().longValue()); + assertEquals(addedId, f.added.getId().longValue()); + assertEquals(2, f.policies); assertEquals(5, f.attempts); assertEquals(4, f.operands.size()); + assertEquals(4, f.sql.writes); assertEquals(2, f.begins); assertEquals(1, f.commits); + assertEquals(1, f.rollbacks); assertEquals(3, f.audits); + f.committed(rejected); + } + + @Test public void deferredForeignKeyRejectsRealCommitAfterAllWritesAndOriginalGraphRetries() throws Exception { + var f = new Fixture("commit-failure"); + long orderId = f.order.getId(), oldId = f.removed.getId(), addedId = f.added.getId(); + // Test-only auxiliary schema injects a deferred FK violation. Every + // business row is still created and changed through generated APIs. + try (var connection = f.source.getConnection(); var statement = connection.createStatement()) { + try (var rows = statement.executeQuery("PRAGMA foreign_keys")) { + assertTrue(rows.next()); assertEquals(1, rows.getInt(1)); + } + statement.execute("CREATE TABLE IF NOT EXISTS core236_commit_parent(id INTEGER PRIMARY KEY)"); + statement.execute("CREATE TABLE IF NOT EXISTS core236_commit_guard(id INTEGER PRIMARY KEY, missing_parent INTEGER NOT NULL, " + + "FOREIGN KEY(missing_parent) REFERENCES core236_commit_parent(id) DEFERRABLE INITIALLY DEFERRED)"); + statement.execute("CREATE TRIGGER core236_commit_fault AFTER UPDATE ON purchase_order_data WHEN NEW.id=" + orderId + + " BEGIN INSERT INTO core236_commit_guard(missing_parent) VALUES(1); END"); + } + var error = assertThrows(RuntimeException.class, f::save); + boolean foreignKey = false, actualCommit = false; + for (Throwable cause = error; cause != null; cause = cause.getCause()) { + foreignKey |= cause instanceof org.sqlite.SQLiteException sqlite && + sqlite.getResultCode() == org.sqlite.SQLiteErrorCode.SQLITE_CONSTRAINT_FOREIGNKEY; + actualCommit |= Arrays.stream(cause.getStackTrace()).anyMatch(frame -> + frame.getClassName().equals("org.sqlite.SQLiteConnection") && frame.getMethodName().equals("commit")); + } + assertTrue("the real deferred SQLite constraint must reject commit", foreignKey); + assertTrue("the rejection must originate at SQLiteConnection.commit", actualCommit); + assertEquals(1, f.beforeCommit.size()); + assertEquals(1, f.beforeCommit.get(0).get("violations")); + assertEquals(1, f.policies); assertEquals(3, f.attempts); assertEquals(3, f.operands.size()); + assertEquals(3, f.sql.writes); assertEquals(1, f.begins); assertEquals(0, f.commits); + assertEquals(1, f.rollbacks); assertEquals(0, f.audits); + assertEquals(Long.valueOf(1), f.order.getVersion()); assertEquals(Long.valueOf(1), f.removed.getVersion()); + assertNull(f.added.getVersion()); assertTrue(f.added.newItem()); + assertFalse(f.added.getEntityMutationLedger().currentChangeSet().changes().isEmpty()); + f.storage(false); + var rejected = f.effects(); + try (var connection = f.source.getConnection(); var statement = connection.createStatement()) { + statement.execute("DROP TRIGGER core236_commit_fault"); + try (var rows = statement.executeQuery("SELECT count(*) FROM core236_commit_guard")) { + assertTrue(rows.next()); assertEquals(0L, rows.getLong(1)); + } + } + f.save(); + assertEquals(orderId, f.order.getId().longValue()); assertEquals(oldId, f.removed.getId().longValue()); + assertEquals(addedId, f.added.getId().longValue()); + assertEquals(2, f.beforeCommit.size()); assertEquals(0, f.beforeCommit.get(1).get("violations")); + assertEquals(2, f.policies); assertEquals(6, f.attempts); assertEquals(6, f.operands.size()); + assertEquals(6, f.sql.writes); assertEquals(2, f.begins); assertEquals(1, f.commits); + assertEquals(1, f.rollbacks); assertEquals(3, f.audits); + f.committed(rejected); + assertEquals("unchanged save cannot reach commit again", 2, f.beforeCommit.size()); + } +} diff --git a/examples/fix-e-alignment/NewEntityIdExampleTest.java b/examples/fix-e-alignment/NewEntityIdExampleTest.java new file mode 100644 index 000000000..b3b971491 --- /dev/null +++ b/examples/fix-e-alignment/NewEntityIdExampleTest.java @@ -0,0 +1,103 @@ +package io.teaql.examples.fixe; + +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.Q; +import io.teaql.core.EntityKey; +import io.teaql.core.checker.CheckException; +import java.math.BigDecimal; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Ordinary generated Q/E and audited saves; SQL below is a read-only oracle. */ +public class NewEntityIdExampleTest { + @Test public void generatedFactoriesAssignRealIdsBeforeReturningAndSaveNeverReallocatesThem() throws Exception { + var f = new ContextRootProbe.Fixture(System.getenv("TEAQL_FIX_E_DB") + ".new-entity-id.sqlite"); + int rowsBefore = f.storage().size(); var factoryBefore = f.counters(); + var order = f.parent(); var abandoned = f.parent(); var independent = f.parent(); + var item = Q.orderItems().comment("Prepare a newly identified graph child") + .purpose("Verify real identity precedes relation assignment and audited save").newEntity(f.context); + long orderId = E.purchaseOrder(order).getId().eval(); + long abandonedId = E.purchaseOrder(abandoned).getId().eval(); + long independentId = E.purchaseOrder(independent).getId().eval(); + long itemId = E.orderItem(item).getId().eval(); + assertTrue(orderId > 0 && abandonedId > 0 && independentId > 0 && itemId > 0); + assertEquals(3, Set.of(orderId, abandonedId, independentId).size()); + for (var row : java.util.List.of(order, abandoned, independent, item)) { + assertTrue(row.newItem()); assertNull(row.getVersion()); + assertTrue(row.getEntityMutationLedger().isNew(new EntityKey(row.typeName(), row.getId()))); + assertTrue(row.isPropertyLoaded("id")); + } + assertNotSame(order.getEntityMutationLedger(), item.getEntityMutationLedger()); + assertNotSame(order.getEntityMutationLedger(), independent.getEntityMutationLedger()); + assertNotSame(order.getEntityMutationLedger(), abandoned.getEntityMutationLedger()); + var independentLedger = independent.getEntityMutationLedger(); + var independentPending = Set.copyOf(independent.getUpdatedProperties()); + var factoryEffects = f.delta(factoryBefore); + assertEquals(Integer.valueOf(4), factoryEffects.get("allocations")); + for (String callback : java.util.List.of("policies", "reviews", "audits")) + assertEquals(callback, Integer.valueOf(0), factoryEffects.get(callback)); + assertEquals(rowsBefore, f.storage().size()); + + item.updatePurchaseOrder(order); item.updateProductName("Identified graph child"); item.updateUnitPrice(BigDecimal.ONE); + var saveBefore = f.counters(); + item.auditAs("Persist only the explicitly identified parent and child graph").save(f.context); + var saveEffects = f.delta(saveBefore); + assertEquals(Integer.valueOf(0), saveEffects.get("allocations")); + assertTrue(saveEffects.get("writes") > 0); assertTrue(saveEffects.get("transactions") > 0); + assertEquals(Integer.valueOf(2), saveEffects.get("audits")); + assertEquals(Long.valueOf(orderId), E.purchaseOrder(order).getId().eval()); + assertEquals(Long.valueOf(itemId), E.orderItem(item).getId().eval()); + assertEquals(Long.valueOf(1), E.purchaseOrder(order).getVersion().eval()); + assertEquals(Long.valueOf(1), E.orderItem(item).getVersion().eval()); + assertEquals("5550987", E.purchaseOrder(f.loaded(orderId)).getContactPhone().eval()); + var child = Q.orderItems().withIdIs(itemId).limit(1) + .comment("Reload the identified graph child") + .purpose("Prove generated E observes the saved factory identity").executeForOne(f.context); + assertEquals(Long.valueOf(itemId), E.orderItem(child).getId().eval()); + assertEquals("Identified graph child", E.orderItem(child).getProductName().eval()); + assertNull(f.loaded(abandonedId)); assertNull(f.loaded(independentId)); + assertSame(independentLedger, independent.getEntityMutationLedger()); + assertEquals(independentPending, Set.copyOf(independent.getUpdatedProperties())); + assertEquals(Set.of(new EntityKey("PurchaseOrder", independentId)), independentLedger.newKeys()); + + // Reserving an ID is allowed before validation; a rejected save must + // neither replace that ID nor turn it into a persisted version. + var rejected = f.parent(); long retryId = E.purchaseOrder(rejected).getId().eval(); + rejected.updateContactPhone(""); var rejectionBefore = f.counters(); + assertThrows(CheckException.class, () -> rejected.auditAs("Reject invalid business input without reallocating its identity").save(f.context)); + var rejectionEffects = f.delta(rejectionBefore); + assertTrue(rejectionEffects.toString(), rejectionEffects.values().stream().allMatch(v -> v == 0)); + assertEquals(Long.valueOf(retryId), E.purchaseOrder(rejected).getId().eval()); + assertNull(rejected.getVersion()); assertTrue(rejected.newItem()); + assertTrue(rejected.getEntityMutationLedger().isNew(new EntityKey("PurchaseOrder", retryId))); + rejected.updateContactPhone("5550222"); var retryBefore = f.counters(); + rejected.auditAs("Retry the corrected object with its original assigned identity").save(f.context); + var retryEffects = f.delta(retryBefore); + assertEquals(Integer.valueOf(0), retryEffects.get("allocations")); + assertEquals(Long.valueOf(retryId), E.purchaseOrder(rejected).getId().eval()); + assertEquals(Long.valueOf(1), E.purchaseOrder(f.loaded(retryId)).getVersion().eval()); + assertEquals("5550222", E.purchaseOrder(f.loaded(retryId)).getContactPhone().eval()); + assertEquals(rowsBefore + 2, f.storage().size()); + try (var connection = f.raw.getConnection(); var statement = connection.prepareStatement( + "SELECT version,purchase_order,product_name FROM order_item_data WHERE id=?")) { + statement.setLong(1, itemId); + try (var row = statement.executeQuery()) { + assertTrue(row.next()); assertEquals(1L, row.getLong(1)); assertEquals(orderId, row.getLong(2)); + assertEquals("Identified graph child", row.getString(3)); assertFalse(row.next()); + } + } + var result = new LinkedHashMap(); + result.put("language", "java"); result.put("case", "new-entity-id-before-return"); result.put("passed", true); + result.put("orderId", orderId); result.put("itemId", itemId); result.put("retryId", retryId); + result.put("abandonedId", abandonedId); result.put("independentId", independentId); + result.put("factoryEffects", factoryEffects); result.put("saveEffects", saveEffects); + result.put("rejectionEffects", rejectionEffects); result.put("retryEffects", retryEffects); + result.put("rowsBefore", rowsBefore); result.put("rowsAfter", f.storage().size()); + result.put("identityStableThroughSaveAndRetry", true); result.put("independentPendingIntentRetained", true); + result.put("abandonedRowsPersisted", false); result.put("finalStorage", f.storage()); + System.out.println("JAVA_NEW_ENTITY_ID_RESULT=" + ContextRootProbe.JSON.writeValueAsString(result)); + } +} diff --git a/examples/fix-e-alignment/ORIGINAL-LEDGER.md b/examples/fix-e-alignment/ORIGINAL-LEDGER.md new file mode 100644 index 000000000..276f15d16 --- /dev/null +++ b/examples/fix-e-alignment/ORIGINAL-LEDGER.md @@ -0,0 +1,18 @@ +# Direct original Mutation Ledger clauses + +Run `node examples/fix-e-alignment/verify-local.cjs --original-ledger` against +repository-local runtime modules. The default Fix/E example also selects this +test alongside every previous test. + +The same seven ML-01 through ML-07 clauses run twice on one retained SQLite +store. They cover independent new roots, deferred B saving, clearing only A's +committed intent, two separate queries for the same ID, explicit typed child +attachment, and an actual trigger-induced save failure. B must still save while +A is failed; then the same A object retries with its original optimistic version. + +Business writes use generated mutation/audited Save, and business readback uses +typed Q/E. Direct SQL only observes storage or installs/removes the named fault +trigger. Runtime origins are asserted and class bytes are reported. The runner +preserves the evaluated model and generated library hashes, retains logs, JUnit +and the database, and removes its disposable source reactor and build outputs. +This does not qualify ML-08 through ML-13 or a published package by itself. diff --git a/examples/fix-e-alignment/OriginalLedgerExampleTest.java b/examples/fix-e-alignment/OriginalLedgerExampleTest.java new file mode 100644 index 000000000..993a9f578 --- /dev/null +++ b/examples/fix-e-alignment/OriginalLedgerExampleTest.java @@ -0,0 +1,179 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import io.teaql.runtime.RuntimeLogSink; +import io.teaql.runtime.AppAuditEventSink; +import java.math.BigDecimal; +import java.nio.file.Path; +import java.security.MessageDigest; +import java.sql.Connection; +import java.sql.SQLException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Test; +import org.sqlite.Function; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Original ML-01..07, without substituting list-result isolation for two queries. */ +public class OriginalLedgerExampleTest { + static final class WatchedSource extends SQLiteDataSource { + final AtomicInteger trips = new AtomicInteger(); + @Override public Connection getConnection() throws SQLException { + var connection = super.getConnection(); + Function.create(connection, "core236_ml07", new Function() { + protected void xFunc() throws SQLException { trips.incrementAndGet(); result(1); } + }); + return connection; + } + } + static PurchaseOrder owner(UserContext context, String phone) { + var value = Q.purchaseOrders().comment("Prepare an independent ledger owner") + .purpose("Verify original mutation ownership clauses").newEntity(context); + value.updateContactPhone(phone); value.updateInternalNote(null); return value; + } + static PurchaseOrder load(UserContext context, long id) { + return Q.purchaseOrders().withIdIs(id).limit(1).comment("Load one independent ledger snapshot") + .purpose("Verify separate queries retain separate pending intent").executeForOne(context); + } + static void emit(String clause, int round, Map details) throws Exception { + System.out.println("JAVA_ORIGINAL_LEDGER_CASE=" + new ObjectMapper().writeValueAsString( + Map.of("case", clause, "round", round, "passed", true, "details", details))); + } + static void origins() throws Exception { + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + var result = new TreeMap(); + for (var type : List.of(UserContext.class, EntityMutationLedger.class, TeaQLRuntime.class, + SqliteDataServiceExecutor.class, JdbcSqlExecutor.class, IdSpaceIdGenerator.class)) { + var origin = Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath(); + assertTrue(type.getName() + " must use the admitted runtime", origin.startsWith(expected)); + var entry = type.getName().replace('.', '/') + ".class"; + try (var input = type.getResourceAsStream("/" + entry)) { + assertNotNull(input); + result.put(entry, Map.of("origin", origin.toString(), "sha256", + HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(input.readAllBytes())))); + } + } + System.out.println("JAVA_ORIGINAL_LEDGER_ORIGINS=" + new ObjectMapper().writeValueAsString(result)); + } + @Test public void originalSevenClausesUseIndependentGeneratedRootsAndRetryTheSameObject() throws Exception { + origins(); int round = Integer.parseInt(System.getenv("TEAQL_FIX_E_ROUND")); + var source = new WatchedSource(); source.setUrl("jdbc:sqlite:" + System.getenv("TEAQL_FIX_E_DB") + ".original-ledger.sqlite"); + var sql = new JdbcSqlExecutor(source); var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); + ids.ensureIdSpaceTable(); var service = new SqliteDataServiceExecutor("sqlite", sql, source); + var audits = new AtomicInteger(); var plans = new ArrayList(); + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { return new MutationPolicyIdentity("original-ledger", "1", "ML01-07"); } + public MutationDecision review(UserContext caller, MutationPlan plan) { plans.add(plan); return MutationDecision.allow(); } + }; + var now = LocalDateTime.of(2032, 5, 6, 7, 8, 9); + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext caller) { return now.toLocalDate(); } + public LocalDateTime businessDateTime(UserContext caller) { return now; } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service).idGenerationService(ids) + .businessClock(clock).executionLogging(false).mutationPolicyRegistry(key -> Optional.of(policy)) + .logSink(new RuntimeLogSink() { public void writeExecutionLog(UserContext caller, ExecutionMetadata event) {} }) + .build().install(GeneratedRuntimeModule.module()); + UserContext context = new GeneratedFixEExampleTest.Context(runtime); + context.putAttribute(AppAuditEventSink.class.getName(), (AppAuditEventSink)(caller,event)->audits.incrementAndGet()); + context.ensureSchema(); + try (var c = source.getConnection(); var s = c.createStatement(); var rows = s.executeQuery("SELECT count(*) FROM purchase_order_data")) { + assertTrue(rows.next()); assertEquals((round-1)*2, rows.getInt(1)); + } + + var a = owner(context,"5551000"); var b = owner(context,"5552000"); + long aid=a.getId(),bid=b.getId(); assertTrue(aid>0&&bid>0); assertNotEquals(aid,bid); + var ak=new EntityKey("PurchaseOrder",aid); var bk=new EntityKey("PurchaseOrder",bid); + assertNotSame(a.getEntityMutationLedger(),b.getEntityMutationLedger()); + assertTrue(a.getEntityMutationLedger().newKeys().contains(ak)); assertFalse(a.getEntityMutationLedger().newKeys().contains(bk)); + assertTrue(b.getEntityMutationLedger().newKeys().contains(bk)); assertNull(a.getEntityMutationLedger().get(bk,"contact_phone")); + assertNull(b.getEntityMutationLedger().get(ak,"contact_phone")); + emit("ML-01",round,Map.of("a",aid,"b",bid,"distinctPendingKeys",true)); + a.auditAs("Save only the first independent root").save(context); + assertNull(load(context,bid)); assertEquals(Long.valueOf(1),a.getVersion()); + emit("ML-03",round,Map.of("a",aid,"b",bid,"unrelatedRowsWritten",0)); + assertTrue(b.getEntityMutationLedger().newKeys().contains(bk)); assertEquals("5552000",b.getEntityMutationLedger().get(bk,"contact_phone")); + assertTrue(a.getEntityMutationLedger().newKeys().isEmpty()); assertTrue(a.getEntityMutationLedger().changedFieldNames(ak).isEmpty()); + emit("ML-06",round,Map.of("a",aid,"b",bid,"committedRootClear",true,"otherRootPending",true)); + b.auditAs("Save the still-pending second root").save(context); assertEquals(Long.valueOf(bid),b.getId()); assertEquals(Long.valueOf(1),b.getVersion()); + assertEquals("5552000",E.purchaseOrder(load(context,bid)).getContactPhone().eval()); assertTrue(b.getEntityMutationLedger().newKeys().isEmpty()); + emit("ML-04",round,Map.of("b",bid,"reservedIdRetained",true,"version",1)); + + var left=load(context,aid); var right=load(context,aid); assertNotSame(left,right); + left.updateContactPhone("5551001"); right.updateContactPhone("5551002"); + assertNotSame(left.getEntityMutationLedger(),right.getEntityMutationLedger()); + assertEquals("5551001",left.getEntityMutationLedger().get(ak,"contact_phone")); + assertEquals("5551002",right.getEntityMutationLedger().get(ak,"contact_phone")); + left.auditAs("Save the first independently queried snapshot").save(context); + assertEquals(Long.valueOf(2),left.getVersion()); assertEquals(Long.valueOf(1),right.getVersion()); + assertEquals(Long.valueOf(1),right.getEntityMutationLedger().getOriginalVersion(ak)); + assertEquals("5551002",right.getEntityMutationLedger().get(ak,"contact_phone")); + assertTrue(left.getEntityMutationLedger().changedFieldNames(ak).isEmpty()); + assertEquals("5551001",E.purchaseOrder(load(context,aid)).getContactPhone().eval()); + emit("ML-02",round,Map.of("id",aid,"otherIntentRetained",true,"otherOriginalVersion",1,"savedVersion",2)); + + var composed=Q.purchaseOrders().withIdIs(aid).limit(1) + .selectOrderItemListWith(Q.orderItems().limit(10).comment("Load the owner's bounded child list")) + .comment("Load a complete owner for explicit child attachment") + .purpose("Verify pending-intent composition without unrelated writes").executeForOne(context); + var item=Q.orderItems().comment("Prepare an independently pending child") + .purpose("Verify explicit pending-intent composition").newEntity(context); + item.updateProductName("ML05 child"); item.updateUnitPrice(BigDecimal.TEN); long cid=item.getId(); + var ck=new EntityKey("OrderItem",cid); assertFalse(composed.getEntityMutationLedger().newKeys().contains(ck)); + composed.addOrderItem(item); + assertEquals(Long.valueOf(cid),E.purchaseOrder(composed).getOrderItemList().get(0).getId().eval()); + // Java merges reachable entity ledgers during Save preparation, not add. + // Verify the reviewed business plan and committed graph, not eager storage layout. + int beforeAttachmentAudits=audits.get(); plans.clear(); + composed.auditAs("Persist an explicitly composed child through its owner").save(context); + assertEquals(1,plans.size()); assertEquals(1,plans.get(0).operations().size()); + var attachedOperation=plans.get(0).operations().get(0); + assertEquals(ck,attachedOperation.entity()); assertEquals(MutationOperationKind.CREATE,attachedOperation.kind()); + assertNull(attachedOperation.originalVersion()); assertEquals(beforeAttachmentAudits+1,audits.get()); + assertSame(composed.getEntityMutationLedger(),item.getEntityMutationLedger()); + assertTrue(item.getEntityMutationLedger().newKeys().isEmpty()); + assertEquals(Long.valueOf(2),composed.getVersion()); assertEquals(Long.valueOf(1),item.getVersion()); + var loadedItem=Q.orderItems().withIdIs(cid).limit(1).comment("Read the explicitly composed child") + .purpose("Verify owner save persisted child intent").executeForOne(context); + assertNotNull(loadedItem); assertEquals("ML05 child",E.orderItem(loadedItem).getProductName().eval()); + assertEquals(Long.valueOf(1),E.orderItem(loadedItem).getVersion().eval()); + assertEquals(0,BigDecimal.TEN.compareTo(E.orderItem(loadedItem).getUnitPrice().eval())); + assertTrue(composed.getEntityMutationLedger().newKeys().isEmpty()); assertTrue(composed.getEntityMutationLedger().changedFieldNames(ck).isEmpty()); + emit("ML-05",round,Map.of("a",aid,"child",cid,"childVersion",1,"ownerVersion",2,"receivingLedgerClear",true)); + + var failed=load(context,aid); var unrelated=load(context,bid); + failed.updateContactPhone("5551003"); unrelated.updateContactPhone("5552001"); + try (var c=source.getConnection(); var s=c.createStatement()) { + s.execute("CREATE TRIGGER core236_ml07_failure BEFORE UPDATE ON purchase_order_data WHEN NEW.id="+aid+" AND NEW.contact_phone='5551003' BEGIN SELECT core236_ml07(); SELECT RAISE(ABORT,'CORE236_ML07'); END"); + } + audits.set(0); plans.clear(); + var error=assertThrows(RuntimeException.class,()->failed.auditAs("Reject one root without altering the other root").save(context)); + boolean triggerError=false; for(Throwable cause=error;cause!=null;cause=cause.getCause())if(String.valueOf(cause.getMessage()).contains("CORE236_ML07"))triggerError=true; + assertTrue(triggerError); assertEquals(1,source.trips.get()); assertEquals(0,audits.get()); + assertEquals("5551003",failed.getEntityMutationLedger().get(ak,"contact_phone")); assertEquals(Long.valueOf(2),failed.getEntityMutationLedger().getOriginalVersion(ak)); + assertEquals("5552001",unrelated.getEntityMutationLedger().get(bk,"contact_phone")); assertEquals(Long.valueOf(1),unrelated.getEntityMutationLedger().getOriginalVersion(bk)); + assertEquals("5551001",E.purchaseOrder(load(context,aid)).getContactPhone().eval()); assertEquals(Long.valueOf(2),load(context,aid).getVersion()); + unrelated.auditAs("Commit the unrelated root while A remains failed").save(context); assertEquals(Long.valueOf(2),unrelated.getVersion()); + assertEquals("5551003",failed.getEntityMutationLedger().get(ak,"contact_phone")); + try(var c=source.getConnection();var s=c.createStatement()){s.execute("DROP TRIGGER core236_ml07_failure");} + failed.auditAs("Retry the same failed root without affecting B").save(context); assertEquals(Long.valueOf(3),failed.getVersion()); + assertTrue(failed.getEntityMutationLedger().changedFieldNames(ak).isEmpty()); assertTrue(unrelated.getEntityMutationLedger().changedFieldNames(bk).isEmpty()); + assertEquals("5552001",E.purchaseOrder(load(context,bid)).getContactPhone().eval()); assertEquals(2,audits.get()); + emit("ML-07",round,Map.of("a",aid,"b",bid,"auditsAfterFailure",0,"finalA",3,"finalB",2,"retrySameRoot",true,"triggerTrips",1)); + } +} diff --git a/examples/fix-e-alignment/OwnershipProbe.java b/examples/fix-e-alignment/OwnershipProbe.java new file mode 100644 index 000000000..2d5e2c7d6 --- /dev/null +++ b/examples/fix-e-alignment/OwnershipProbe.java @@ -0,0 +1,45 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.Q; +import io.teaql.core.UserContext; +import java.util.Map; +import static org.junit.Assert.*; + +final class OwnershipProbe { + static void verify(UserContext context) throws Exception { + int before = Q.purchaseOrders().limit(20).comment("Inspect the initial ownership fixture") + .purpose("Verify independent roots do not share pending changes").executeForList(context).size(); + var first = Q.purchaseOrders().comment("Prepare independent new owner A") + .purpose("Verify Context does not own mutation ledgers").newEntity(context); + var second = Q.purchaseOrders().comment("Prepare independent new owner B") + .purpose("Verify Context does not own mutation ledgers").newEntity(context); + first.updateContactPhone("5550300"); first.updateInternalNote(null); + second.updateContactPhone("5550400"); second.updateInternalNote(null); + var savedA = first.auditAs("Save only independent new owner A").save(context); + assertEquals(before + 1, Q.purchaseOrders().limit(20).comment("Inspect A's save before saving B") + .purpose("Verify the unsaved new owner did not leak into persistence").executeForList(context).size()); + var savedB = second.auditAs("Explicitly save independent new owner B").save(context); + var batch = Q.purchaseOrders().limit(20).comment("Load independent owners in one batch") + .purpose("Verify list roots have separate mutation boundaries").executeForList(context); + assertEquals(before + 2, batch.size()); + var ownerA = batch.stream().filter(row -> row.getId().equals(savedA.getId())).findFirst().orElseThrow(); + var ownerB = batch.stream().filter(row -> row.getId().equals(savedB.getId())).findFirst().orElseThrow(); + ownerA.updateContactPhone("5550301"); ownerB.updateContactPhone("5550401"); + ownerA.auditAs("Save only A from the multi-root result").save(context); + var unchanged = Q.purchaseOrders().withIdIs(savedB.getId()).limit(1) + .comment("Inspect B after saving only A").purpose("Verify A neither persists nor commits B").executeForOne(context); + assertEquals("5550400", E.purchaseOrder(unchanged).getContactPhone().eval()); + assertEquals(Long.valueOf(1), E.purchaseOrder(unchanged).getVersion().eval()); + ownerB.auditAs("Save B after A without discarding its pending mutation").save(context); + var changed = Q.purchaseOrders().withIdIs(savedB.getId()).limit(1) + .comment("Inspect the later independent B save").purpose("Verify B's pending mutation survived A's save").executeForOne(context); + assertEquals("5550401", E.purchaseOrder(changed).getContactPhone().eval()); + assertEquals(Long.valueOf(2), E.purchaseOrder(changed).getVersion().eval()); + PageStreamOwnershipProbe.verify(context, savedA.getId(), savedB.getId()); + System.out.println("CORE_MUTATION_OWNERSHIP=" + new ObjectMapper().writeValueAsString(Map.of( + "language", "java", "passed", true, "independentNewRoots", true, + "batchRootIsolation", true, "siblingVersionUnchanged", true, "siblingPendingMutationRetained", true))); + } +} diff --git a/examples/fix-e-alignment/PageStreamOwnershipProbe.java b/examples/fix-e-alignment/PageStreamOwnershipProbe.java new file mode 100644 index 000000000..45c172e6d --- /dev/null +++ b/examples/fix-e-alignment/PageStreamOwnershipProbe.java @@ -0,0 +1,58 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.UserContext; +import java.util.List; +import java.util.Map; +import static org.junit.Assert.*; + +final class PageStreamOwnershipProbe { + static void verify(UserContext context, Long idA, Long idB) throws Exception { + int before = Q.purchaseOrders().limit(20).comment("Inspect the page ownership fixture") + .purpose("Establish the bounded exact total").executeForList(context).size(); + var sentinel = Q.purchaseOrders().comment("Prepare the page-offset sentinel") + .purpose("Exercise a genuine nonzero page offset").newEntity(context); + sentinel.updateContactPhone("5550500"); sentinel.updateInternalNote(null); + sentinel.auditAs("Save the synthetic page sentinel").save(context); + var page = Q.purchaseOrders().orderByIdDescending().offset(1, 2).count() + .comment("Load a nonzero-offset page of independent roots") + .purpose("Verify exact count and page ownership").executeForList(context); + assertEquals(2, page.size()); assertEquals(before + 1, page.getTotalCount()); + exercise(context, page.stream().toList(), idA, idB, "a nonzero-offset page", "5550401", "5550402", 2); + List streamed; + try (var stream = Q.purchaseOrders().orderByIdAscending().limit(20) + .comment("Stream independent scalar roots") + .purpose("Verify deferred-save ownership after stream consumption").executeForStream(context)) { + streamed = stream.toList(); + } + assertEquals(before + 1, streamed.size()); + exercise(context, streamed, idA, idB, "a fully consumed scalar stream", "5550402", "5550403", 3); + System.out.println("CORE_MUTATION_PAGING=" + new ObjectMapper().writeValueAsString(Map.of( + "language", "java", "passed", true, "pageOffset", 1, "pageSize", 2, + "exactCount", before + 1, "pageRootIsolation", true, "deferredSaveAfterContextReuse", true, + "streamProfile", "scalar-typed-provider-controlled-chunks", "streamRootIsolation", true, + "siblingPendingMutationRetained", true))); + } + + private static void exercise(UserContext context, List rows, Long idA, Long idB, + String label, String previous, String next, long version) { + var a = rows.stream().filter(row -> row.getId().equals(idA)).findFirst().orElseThrow(); + var b = rows.stream().filter(row -> row.getId().equals(idB)).findFirst().orElseThrow(); + a.updateContactPhone("55503" + next.substring(next.length() - 2)); b.updateContactPhone(next); + Q.tenantsWithMinimalFields().limit(1).comment("Run an unrelated query before deferred saves") + .purpose("Verify deferred ownership survives Context reuse").executeForList(context); + a.auditAs("Save only A from " + label).save(context); + var persisted = Q.purchaseOrders().withIdIs(idB).limit(1).comment("Inspect B after deferred A save") + .purpose("Verify unrelated root value and version remain untouched").executeForOne(context); + assertEquals(previous, E.purchaseOrder(persisted).getContactPhone().eval()); + assertEquals(Long.valueOf(version), E.purchaseOrder(persisted).getVersion().eval()); + b.auditAs("Save B later from " + label).save(context); + persisted = Q.purchaseOrders().withIdIs(idB).limit(1).comment("Inspect the later deferred B save") + .purpose("Verify B's pending mutation survived A's commit").executeForOne(context); + assertEquals(next, E.purchaseOrder(persisted).getContactPhone().eval()); + assertEquals(Long.valueOf(version + 1), E.purchaseOrder(persisted).getVersion().eval()); + } +} diff --git a/examples/fix-e-alignment/PartialAncestorRootExampleTest.java b/examples/fix-e-alignment/PartialAncestorRootExampleTest.java new file mode 100644 index 000000000..59f273a6c --- /dev/null +++ b/examples/fix-e-alignment/PartialAncestorRootExampleTest.java @@ -0,0 +1,102 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.Q; +import io.teaql.core.ContextRootException; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.internal.CheckerInvocation; +import io.teaql.core.value.TeaQLNotLoadedException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.junit.Test; +import static org.junit.Assert.*; + +/** The managed-root case below two untouched sparse ancestors, through generated Q/E/save. */ +public class PartialAncestorRootExampleTest { + private static List> itemStorage(ContextRootProbe.Fixture f) throws Exception { + var rows = new ArrayList>(); + // Independent read-only oracle; never DDL, seed SQL or a replacement for audited mutation. + try (var connection = f.raw.getConnection(); var statement = connection.createStatement(); + var result = statement.executeQuery( + "SELECT id,version,tenant,purchase_order,product_name FROM order_item_data ORDER BY id")) { + while (result.next()) rows.add(List.of(result.getLong(1), result.getLong(2), + result.getLong(3), result.getLong(4), result.getString(5))); + } + return rows; + } + + private static void released(UserContext context) { + assertNull(CheckerInvocation.current(context)); + for (String key : List.of(Checker.TEAQL_FIX_TIME, Checker.TEAQL_DATA_CHECKED_ITEMS, + Checker.TEAQL_DATA_CHECK_RESULT, UserContext.TEAQL_FIX_EVIDENCE_CURRENT)) + assertNull(key, context.getAttribute(key)); + } + + @Test public void wrongActiveRootCannotBypassUntouchedPartialAncestorsAndRetryPreservesIntent() throws Exception { + var f = new ContextRootProbe.Fixture(System.getenv("TEAQL_FIX_E_DB") + ".partial-ancestor-root.sqlite"); + var order = f.parent(); + var item = Q.orderItems().comment("Prepare a complete root-bound descendant") + .purpose("Verify ownership admission through two untouched sparse ancestors").newEntity(f.context); + item.updatePurchaseOrder(order); item.updateProductName("Partial root original"); + item.updateUnitPrice(BigDecimal.ONE); + item.auditAs("Create the managed-root partial-ancestor control").save(f.context); + var root = PartialAncestorExampleTest.graph(f.context, order.getId(), false); + var parent = E.tenant(root).getPurchaseOrderList().first().eval(); + var leaf = E.purchaseOrder(parent).getOrderItemList().first().eval(); + assertEquals(item.getId(), E.orderItem(leaf).getId().eval()); + assertEquals(Long.valueOf(1), E.orderItem(leaf).getTenant().getId().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.tenant(root).getName().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(parent).getContactPhone().eval()); + var rootState = root.__internalLoadState(); var parentState = parent.__internalLoadState(); + leaf.updateProductName("Partial root accepted retry"); + var pending = Set.copyOf(leaf.getUpdatedProperties()); + assertEquals(Set.of("product_name"), pending); + var originalItems = itemStorage(f); var originalParents = f.storage(); + var wrong = f.withRoot("Tenant", f.otherRoot); + var denials = new ArrayList>(); + for (int attempt = 1; attempt <= 2; attempt++) { + var before = f.counters(); + var error = assertThrows(ContextRootException.class, + () -> root.auditAs("Reject a wrong root below untouched sparse ancestors").save(wrong)); + assertEquals(ContextRootException.Reason.VALUE_MISMATCH, error.getReason()); + var effects = f.delta(before); + assertTrue(effects.toString(), effects.values().stream().allMatch(v -> v == 0)); + assertEquals(originalItems, itemStorage(f)); assertEquals(originalParents, f.storage()); + assertSame(rootState, root.__internalLoadState()); assertSame(parentState, parent.__internalLoadState()); + assertEquals(pending, Set.copyOf(leaf.getUpdatedProperties())); + assertEquals("Partial root accepted retry", E.orderItem(leaf).getProductName().eval()); + assertEquals(Long.valueOf(1), E.orderItem(leaf).getVersion().eval()); + assertTrue(wrong.lastFixEvidence().isEmpty()); released(wrong); + denials.add(Map.of("attempt", attempt, "reason", error.getReason().name(), "effects", effects, + "pendingIntentRetained", true, "physicalStateUnchanged", true, "scopeReleased", true)); + } + var before = f.counters(); + root.auditAs("Retry the same partial graph under its correct active root").save(f.context); + var accepted = f.delta(before); + assertTrue(accepted.get("writes") > 0); assertTrue(accepted.get("transactions") > 0); + assertTrue(accepted.get("reviews") > 0); assertEquals(Integer.valueOf(1), accepted.get("audits")); + assertEquals(Integer.valueOf(0), accepted.get("rootLookups")); + assertSame(rootState, root.__internalLoadState()); assertSame(parentState, parent.__internalLoadState()); + assertEquals(Long.valueOf(1), E.tenant(root).getVersion().eval()); + assertEquals(Long.valueOf(1), E.purchaseOrder(parent).getVersion().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.tenant(root).getName().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(parent).getContactPhone().eval()); + assertTrue(leaf.getUpdatedProperties().isEmpty()); + var stored = Q.orderItems().withIdIs(item.getId()).limit(1) + .comment("Read the authorized descendant update") + .purpose("Verify the managed-root graph retry persisted exactly once").executeForOne(f.context); + assertEquals("Partial root accepted retry", E.orderItem(stored).getProductName().eval()); + assertEquals(Long.valueOf(2), E.orderItem(stored).getVersion().eval()); + assertEquals(Long.valueOf(1), E.orderItem(stored).getTenant().getId().eval()); + assertEquals(originalParents, f.storage()); released(f.context); + System.out.println("JAVA_PARTIAL_ANCESTOR_ROOT_RESULT=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "orderId", order.getId(), "leafId", item.getId(), "otherRootId", f.otherRoot, + "denials", denials, "acceptedEffects", accepted, "ancestorVersions", List.of(1, 1), + "leafVersion", 2, "sameGraphRetry", true, "generatedQAndE", true))); + } +} diff --git a/examples/fix-e-alignment/PostFixExampleTest.java b/examples/fix-e-alignment/PostFixExampleTest.java new file mode 100644 index 000000000..5383e9abf --- /dev/null +++ b/examples/fix-e-alignment/PostFixExampleTest.java @@ -0,0 +1,183 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.UserContext; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.checker.CheckException; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.FixEvidence; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.checker.internal.CheckerInvocation; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Application-owned adversarial vectors over the unchanged three-entity generated library. */ +public class PostFixExampleTest { + private static final LocalDateTime T0 = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + private static final String PHONE = "PRIVATE-FIX-5550100"; + private static final String NOTE = "Private ordinary business input"; + + private static final class Fixture { + final ContextRootProbe.ObservedSql sql; + final UserContext context; + final AtomicInteger clockCalls = new AtomicInteger(); + + Fixture(String name) { + var source = new SQLiteDataSource(); + String database = System.getenv("TEAQL_FIX_E_DB"); + assertNotNull("the example runner owns and retains its databases", database); + source.setUrl("jdbc:sqlite:" + database + ".post-fix-" + name + ".sqlite"); + sql = new ContextRootProbe.ObservedSql(source); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); + ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source); + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext caller) { return T0.toLocalDate(); } + public LocalDateTime businessDateTime(UserContext caller) { + return T0.plusSeconds(clockCalls.getAndIncrement()); + } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(ids).businessClock(clock) + .build().install(GeneratedRuntimeModule.module()); + context = new GeneratedFixEExampleTest.Context(runtime); + context.ensureSchema(); + clockCalls.set(0); + } + + PurchaseOrder order() { + var row = Q.purchaseOrders().comment("Prepare a post-Fix business input") + .purpose("Verify typed managed defaults without rewriting caller fields").newEntity(context); + row.updateContactPhone(PHONE); + row.updateInternalNote(NOTE); + return row; + } + + OrderItem item(PurchaseOrder parent, String name, BigDecimal price) { + var row = Q.orderItems().comment("Prepare the post-Fix child") + .purpose("Verify graph validation and value-free Fix provenance").newEntity(context); + row.updatePurchaseOrder(parent); + row.updateProductName(name); + row.updateUnitPrice(price); + return row; + } + + Map counters() { + return Map.of("queries", sql.queries, "writes", sql.writes, "transactions", sql.transactions); + } + } + + private static void released(UserContext context) { + assertNull(CheckerInvocation.current(context)); + for (String key : List.of(Checker.TEAQL_FIX_TIME, Checker.TEAQL_DATA_CHECKED_ITEMS, + Checker.TEAQL_DATA_CHECK_RESULT, UserContext.TEAQL_FIX_EVIDENCE_CURRENT)) + assertNull(key, context.getAttribute(key)); + } + + private static void receipt(String name, Map facts) throws Exception { + System.out.println("JAVA_POST_FIX_CASE=" + new ObjectMapper().writeValueAsString( + Map.of("case", name, "passed", true, "facts", facts))); + } + + @Test public void generatedRequiredFieldsObserveTypedDefaultsAndPreserveOrdinaryInputs() throws Exception { + var f = new Fixture("typed"); + var order = f.order(); + var item = f.item(order, "Private product input", new BigDecimal("12.34")); + item.auditAs("Save the complete post-Fix control graph").save(f.context); + assertEquals(1, f.clockCalls.get()); + assertEquals(T0, E.purchaseOrder(order).getCreateTime().eval()); + assertEquals(T0, E.purchaseOrder(order).getUpdateTime().eval()); + assertEquals(T0, E.orderItem(item).getCreateTime().eval()); + assertEquals(T0, E.orderItem(item).getUpdateTime().eval()); + assertEquals(Long.valueOf(1), E.purchaseOrder(order).getTenant().getId().eval()); + assertEquals(Long.valueOf(1), E.orderItem(item).getTenant().getId().eval()); + + var loaded = Q.purchaseOrders().withIdIs(order.getId()).limit(1) + .comment("Read the persisted post-Fix caller fields") + .purpose("Verify Fix did not rewrite business inputs").executeForOne(f.context); + assertEquals(PHONE, E.purchaseOrder(loaded).getContactPhone().eval()); + assertEquals(NOTE, E.purchaseOrder(loaded).getInternalNote().eval()); + assertEquals(T0, E.purchaseOrder(loaded).getCreateTime().eval()); + released(f.context); + receipt("typed-defaults-preserve-business-input", Map.of("graphClockCaptures", 1, + "persistedThroughGeneratedQAndE", true, "typedClockAndRoot", true)); + } + + @Test public void fixProvenanceIsCompleteValueFreeAndDetachedForParentChildGraph() throws Exception { + var f = new Fixture("evidence"); + var order = f.order(); + var item = f.item(order, "Private product input", BigDecimal.ONE); + item.auditAs("Observe the Fix receipt for a parent-child graph").save(f.context); + List evidence = f.context.lastFixEvidence(); + Set expected = Set.of("PurchaseOrder:create_time:CLOCK", "PurchaseOrder:update_time:CLOCK", + "PurchaseOrder:tenant:CONTEXT", "OrderItem:create_time:CLOCK", "OrderItem:update_time:CLOCK", + "OrderItem:tenant:CONTEXT"); + assertEquals(expected, evidence.stream().map(row -> row.entityType() + ":" + row.modelPath() + ":" + row.source()) + .collect(Collectors.toSet())); + assertEquals("one receipt per fixed field despite bidirectional graph traversal", expected.size(), evidence.size()); + String wire = new ObjectMapper().writeValueAsString(evidence); + for (String privateValue : List.of(PHONE, NOTE, "Private product input", T0.toString())) + assertFalse(wire, wire.contains(privateValue)); + assertThrows(UnsupportedOperationException.class, () -> evidence.add(evidence.get(0))); + var another = f.order(); + another.auditAs("Run an independent Fix invocation on the same context").save(f.context); + assertEquals(6, evidence.size()); + assertEquals(3, f.context.lastFixEvidence().size()); + assertEquals(2, f.clockCalls.get()); + released(f.context); + receipt("value-free-provenance-and-graph-once", Map.of("firstReceiptFields", 6, + "nextReceiptFields", 3, "detachedAndImmutable", true, "businessValuesExported", false, + "provenance", evidence)); + } + + @Test public void invalidBusinessFieldsRejectAfterFixBeforeAnyProviderEntryAndRetryRechecks() throws Exception { + var f = new Fixture("rejection"); + var order = f.order(); + var item = f.item(order, null, new BigDecimal("-0.01")); + var before = f.counters(); + var error = assertThrows(CheckException.class, + () -> item.auditAs("Reject invalid input after managed Fixes").save(f.context)); + assertEquals(before, f.counters()); + Set paths = error.getViolates().stream() + .map(row -> row.toWire(JsonFieldNamingProfile.SNAKE_CASE).instancePath()).collect(Collectors.toSet()); + assertTrue(paths.toString(), paths.contains("/product_name")); + assertTrue(paths.toString(), paths.contains("/unit_price")); + assertTrue(f.context.lastFixEvidence().stream().anyMatch(row -> + row.entityType().equals("OrderItem") && row.modelPath().equals("create_time") + && row.source() == FixEvidence.Source.CLOCK)); + assertEquals(1, f.clockCalls.get()); + released(f.context); + item.updateProductName("Corrected product input"); + item.updateUnitPrice(BigDecimal.ONE); + item.auditAs("Retry the corrected post-Fix input").save(f.context); + assertEquals(2, f.clockCalls.get()); + assertTrue(f.sql.writes > before.get("writes")); + var loaded = Q.orderItems().withIdIs(item.getId()).limit(1) + .comment("Read the corrected item after rejected save") + .purpose("Verify retry checks and persists the corrected business input").executeForOne(f.context); + assertEquals("Corrected product input", E.orderItem(loaded).getProductName().eval()); + assertEquals(0, BigDecimal.ONE.compareTo(E.orderItem(loaded).getUnitPrice().eval())); + released(f.context); + receipt("post-fix-reject-zero-provider-and-retry", Map.of("rejectedProviderEntries", 0, + "requiredAndRangePaths", paths, "freshInvocationOnRetry", true, "correctedRowPersisted", true)); + } +} diff --git a/examples/fix-e-alignment/RequestIntentExampleTest.java b/examples/fix-e-alignment/RequestIntentExampleTest.java new file mode 100644 index 000000000..e1e8e4e07 --- /dev/null +++ b/examples/fix-e-alignment/RequestIntentExampleTest.java @@ -0,0 +1,139 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.time.*; +import java.util.*; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Generated Q/E and audited-save admission with actual SQLite, in both log modes. */ +public class RequestIntentExampleTest { + record Effects(int sqlQueries, int sqlWrites, int transactions, int commits, + int providerQueries, int providerMutations, int queryPolicies, + int mutationPolicies, int sqlLogs, int audits) {} + static final Effects ZERO = new Effects(0,0,0,0,0,0,0,0,0,0); + static final class Fixture { + final SQLiteDataSource source = new SQLiteDataSource(); + final CheckerBoundaryExampleTest.Observed sql; + final TeaQLRuntime runtime; + final UserContext context; + final String database; + boolean armed; + int providerQueries, providerMutations, queryPolicies, mutationPolicies, sqlLogs, audits; + Fixture(boolean logging) { + database = Objects.requireNonNull(System.getenv("TEAQL_FIX_E_DB")) + ".request-admission-" + (logging ? "on" : "off") + ".sqlite"; + source.setUrl("jdbc:sqlite:" + database); sql = new CheckerBoundaryExampleTest.Observed(source); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source) { + @Override public QueryResult query(UserContext caller, QueryRequest request) { + if (armed) providerQueries++; return super.query(caller, request); + } + @Override public MutationResult mutate(UserContext caller, PersistenceMutation request) { + if (armed) providerMutations++; return super.mutate(caller, request); + } + }; + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext caller) { return LocalDate.of(2032,2,29); } + public LocalDateTime businessDateTime(UserContext caller) { return businessDate(caller).atTime(10,15,30); } + }; + runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default",service).dataService("sqlite",service).idGenerationService(ids) + .businessClock(clock).executionLogging(logging) + .queryPolicy(new QueryPolicy() { + @Override public void enforceSelect(UserContext caller, SearchRequest request) { if (armed) queryPolicies++; } + }).mutationPolicyRegistry(key -> { if (armed) mutationPolicies++; return Optional.empty(); }) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller, ExecutionMetadata event) { if (armed) sqlLogs++; } + public void writeAuditEvent(UserContext caller, RawAuditEvent event) { if (armed) audits++; } + }).build().install(GeneratedRuntimeModule.module()); + context = new GeneratedFixEExampleTest.Context(runtime); context.ensureSchema(); + } + void reset() { + sql.queries=0; sql.writes=0; sql.transactions=0; sql.commits=0; + providerQueries=0; providerMutations=0; queryPolicies=0; mutationPolicies=0; sqlLogs=0; audits=0; + } + Effects effects() { return new Effects(sql.queries,sql.writes,sql.transactions,sql.commits,providerQueries,providerMutations,queryPolicies,mutationPolicies,sqlLogs,audits); } + // The independent oracle has a read-only SQLite connection and cannot + // create runtime evidence or increment the observed application adapter. + Map>> physical() throws Exception { + var readOnly = new SQLiteDataSource(); readOnly.setUrl("jdbc:sqlite:file:" + database + "?mode=ro"); + var result = new TreeMap>>(); + try (var connection=readOnly.getConnection()) { + for (String table : List.of("purchase_order_data","order_item_data","teaql_id_space")) { + var rows = new ArrayList>(); + try (var statement=connection.createStatement();var data=statement.executeQuery("SELECT * FROM " + table + " ORDER BY " + (table.equals("teaql_id_space") ? "type_name" : "id"))) { + var meta=data.getMetaData();while(data.next()) {var row=new TreeMap();for(int n=1;n<=meta.getColumnCount();n++)row.put(meta.getColumnName(n),data.getObject(n));rows.add(row);} + } + result.put(table,rows); + } + } + return result; + } + } + static final ObjectMapper JSON = new ObjectMapper(); + static void emit(String key, Object value) throws Exception { System.out.println(key + "=" + JSON.writeValueAsString(value)); } + + @Test public void invalidRootIntentRejectsAnnotatedGeneratedGraphBeforePolicyProviderAndSql() throws Exception { + int round=Integer.parseInt(Objects.requireNonNull(System.getenv("TEAQL_FIX_E_ROUND")));assertTrue(round==1||round==2); + String[] blanks={null,""," \t\r\n","\u0085","\u00a0","\u2003"}; + String[] kinds={"missing","empty","ascii-whitespace","NEL","NBSP","em-space"}; + int cases=0; + for(boolean logging:new boolean[]{false,true}) { + var f=new Fixture(logging); + var parent=Q.purchaseOrders().comment("Prepare the request admission parent").purpose("Use a real generated mutation graph").newEntity(f.context); + parent.updateContactPhone("5550801"); parent.updateInternalNote(null); + var child=Q.orderItems().comment("Prepare the annotated child").purpose("Child intent must not supply missing root intent").newEntity(f.context); + child.updateProductName("admission child " + round); child.updateUnitPrice(BigDecimal.ONE); + child.setComment("annotated child SECRET-CANARY"); parent.addOrderItem(child); + long parentID=parent.getId(),childID=child.getId();assertTrue(parentID>0&&childID>0); + var baseline=f.physical(); f.armed=true; + for(String action:List.of("query-comment","query-purpose","mutation-comment"))for(int index=0;index0&&effects.sqlWrites()>0&&effects.transactions()>0&&effects.commits()>0); + assertTrue(effects.providerQueries()>0&&effects.providerMutations()>0&&effects.queryPolicies()>0&&effects.mutationPolicies()>0&&effects.audits()>0); + if(logging)assertTrue(effects.sqlLogs()>0);else assertEquals(0,effects.sqlLogs()); + var stored=f.physical();assertEquals(round,stored.get("purchase_order_data").size());assertEquals(round,stored.get("order_item_data").size()); + emit("JAVA_REQUEST_ADMISSION_CONTROL",Map.ofEntries(Map.entry("round",round),Map.entry("logging",logging),Map.entry("parentID",parentID),Map.entry("childID",childID), + Map.entry("effects",effects),Map.entry("parents",round),Map.entry("children",round),Map.entry("eProviderReads",0),Map.entry("passed",true))); + } + assertEquals(36,cases);emit("JAVA_REQUEST_ADMISSION_RESULT",Map.of("round",round,"cases",cases,"controls",2,"passed",true)); + } +} diff --git a/examples/fix-e-alignment/ReviewedPlanExampleTest.java b/examples/fix-e-alignment/ReviewedPlanExampleTest.java new file mode 100644 index 000000000..040db756d --- /dev/null +++ b/examples/fix-e-alignment/ReviewedPlanExampleTest.java @@ -0,0 +1,208 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.*; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Real two-object SQLite saves through unchanged generated Q/E and audited APIs. */ +public class ReviewedPlanExampleTest { + enum Phase { NONE, POLICY, APPROVAL, WARNING, TRANSACTION, PROVIDER } + private static final LocalDateTime NOW = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + + private static final class Fixture { + final Phase phase; + final String database; + final ContextRootProbe.ObservedSql sql; + final UserContext context; + final PurchaseOrder order; + final OrderItem item; + final List> writeOperands = new ArrayList<>(); + boolean armed, tamper = true; + int policies, begins, commits, rollbacks, audits; + String reviewedPhone; + BigDecimal reviewedPrice; + + Fixture(Phase phase) { + this.phase = phase; + String base = System.getenv("TEAQL_FIX_E_DB"); + assertNotNull("the runner owns and retains the actual SQLite files", base); + database = base + ".reviewed-plan-" + phase.name().toLowerCase(Locale.ROOT) + ".sqlite"; + var source = new SQLiteDataSource(); source.setUrl("jdbc:sqlite:" + database); + sql = new ContextRootProbe.ObservedSql(source); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); + ids.ensureIdSpaceTable(); + var service = new SqliteDataServiceExecutor("sqlite", sql, source) { + @Override public T executeInTransaction(UserContext caller, TransactionCallback action) { + if (armed) begins++; + try { + T result = super.executeInTransaction(caller, () -> { + edit(Phase.TRANSACTION); + return action.doInTransaction(); + }); + if (armed) commits++; + return result; + } catch (RuntimeException | Error error) { + if (armed) rollbacks++; + throw error; + } + } + @Override public MutationResult mutate(UserContext caller, PersistenceMutation request) { + if (armed) { + var target = (BaseEntity) ((EntityPersistenceMutation) request).getEntity(); + String field = target.typeName().equals("PurchaseOrder") ? "contact_phone" : "unit_price"; + Object expected = field.equals("contact_phone") ? reviewedPhone : reviewedPrice; + assertEquals("the provider must consume the value actually reviewed", expected, + target.__internalGet(field)); + writeOperands.add(Map.of("entity", target.typeName(), "field", field, + "value", target.__internalGet(field).toString(), "originalVersion", target.getVersion())); + } + MutationResult result = super.mutate(caller, request); + // Both actual writes have happened, but the transaction has + // not committed. A late edit must roll back the whole graph. + if (armed && writeOperands.size() == 2) edit(Phase.PROVIDER); + return result; + } + }; + var clock = new BusinessClock() { + public LocalDate businessDate(UserContext caller) { return NOW.toLocalDate(); } + public LocalDateTime businessDateTime(UserContext caller) { return NOW; } + }; + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { + return new MutationPolicyIdentity("reviewed-sqlite-example", "1", "sha256:reviewed-sqlite-example"); + } + public MutationDecision review(UserContext caller, MutationPlan plan) { + if (armed) { + policies++; + assertEquals(2, plan.operations().size()); + for (var operation : plan.operations()) { + assertEquals(MutationOperationKind.UPDATE, operation.kind()); + assertEquals(Long.valueOf(1), operation.originalVersion()); + if (operation.entity().entity().equals("PurchaseOrder")) + reviewedPhone = (String) operation.changedValues().get("contact_phone"); + else if (operation.entity().entity().equals("OrderItem")) + reviewedPrice = (BigDecimal) operation.changedValues().get("unit_price"); + else fail("unexpected entity in the reviewed graph"); + } + assertNotNull(reviewedPhone); assertNotNull(reviewedPrice); + edit(Phase.POLICY); + } + return MutationDecision.allow(); + } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(ids).businessClock(clock).executionLogging(false) + .mutationPolicyRegistry(key -> Optional.of(policy)) + .mutationPolicyApprovalProvider(identity -> { edit(Phase.APPROVAL); return Optional.empty(); }) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller, ExecutionMetadata event) {} + public void writeMutationGovernanceEvent(UserContext caller, MutationGovernanceEvent event) { + edit(Phase.WARNING); + } + }).build().install(GeneratedRuntimeModule.module()); + context = new GeneratedFixEExampleTest.Context(runtime); + context.putAttribute(AppAuditEventSink.class.getName(), + (AppAuditEventSink) (caller, event) -> { if (armed) audits++; }); + context.ensureSchema(); + order = Q.purchaseOrders().comment("Prepare a reviewed parent mutation") + .purpose("Verify reviewed graph values against actual SQLite storage").newEntity(context); + order.updateContactPhone("initial"); order.updateInternalNote("reviewed graph control"); + item = Q.orderItems().comment("Prepare the reviewed child mutation") + .purpose("Verify that parent and child commit or roll back together").newEntity(context); + item.updatePurchaseOrder(order); item.updateProductName("Reviewed item"); item.updateUnitPrice(BigDecimal.ONE); + item.auditAs("Persist the unchanged generated graph control").save(context); + assertEquals(Long.valueOf(1), order.getVersion()); assertEquals(Long.valueOf(1), item.getVersion()); + sql.writes = 0; sql.transactions = 0; + order.updateContactPhone("reviewed"); item.updateUnitPrice(new BigDecimal("2")); + armed = true; + } + + void edit(Phase current) { + if (armed && tamper && phase == current) order.updateContactPhone("not-reviewed"); + } + void save() { item.auditAs("Persist exactly the reviewed parent and child plan").save(context); } + void storage(String phone, BigDecimal price, long version) { + var parent = Q.purchaseOrders().withIdIs(order.getId()).limit(1) + .comment("Read the authoritative reviewed parent") + .purpose("Verify that rejected or accepted graph values match storage").executeForOne(context); + var child = Q.orderItems().withIdIs(item.getId()).limit(1) + .comment("Read the authoritative reviewed child") + .purpose("Verify that the two graph rows share the expected commit outcome").executeForOne(context); + assertEquals(phone, E.purchaseOrder(parent).getContactPhone().eval()); + assertEquals(0, price.compareTo(E.orderItem(child).getUnitPrice().eval())); + assertEquals(Long.valueOf(version), parent.getVersion()); + assertEquals(Long.valueOf(version), child.getVersion()); + } + Map effects() { + return Map.of("policies", policies, "providerWrites", writeOperands.size(), "sqlWrites", sql.writes, + "begins", begins, "commits", commits, "rollbacks", rollbacks, "audits", audits); + } + void receipt(Map rejected) throws Exception { + var result = new LinkedHashMap(); + result.put("phase", phase.name()); result.put("round", Integer.parseInt(System.getenv("TEAQL_FIX_E_ROUND"))); + result.put("passed", true); result.put("orderId", order.getId()); result.put("itemId", item.getId()); + result.put("database", java.nio.file.Path.of(database).getFileName().toString()); + result.put("rejected", rejected); result.put("final", effects()); result.put("writeOperands", writeOperands); + result.put("storedPhone", phase == Phase.NONE ? "reviewed" : "not-reviewed"); + result.put("storedPrice", "2"); result.put("storedVersion", 2); + result.put("generatedQAndEReadback", true); + System.out.println("JAVA_REVIEWED_SQLITE_CASE=" + new ObjectMapper().writeValueAsString(result)); + } + } + + @Test public void stableReviewedGraphCommitsBothRows() throws Exception { + var f = new Fixture(Phase.NONE); f.save(); + assertEquals(1, f.policies); assertEquals(2, f.writeOperands.size()); + assertEquals(1, f.begins); assertEquals(1, f.commits); assertEquals(0, f.rollbacks); assertEquals(2, f.audits); + assertEquals(2, f.sql.writes); + f.storage("reviewed", new BigDecimal("2"), 2); + assertTrue(f.item.getEntityMutationLedger().currentChangeSet().changes().isEmpty()); + f.receipt(Map.of()); + } + @Test public void policyEditRejectsBeforeWriteAndRetryRechecks() throws Exception { rejects(Phase.POLICY); } + @Test public void approvalEditRejectsBeforeWriteAndRetryRechecks() throws Exception { rejects(Phase.APPROVAL); } + @Test public void warningEditRejectsBeforeWriteAndRetryRechecks() throws Exception { rejects(Phase.WARNING); } + @Test public void transactionEditRollsBackBeforeWriteAndRetryRechecks() throws Exception { rejects(Phase.TRANSACTION); } + @Test public void lateProviderEditRollsBackBothWritesAndRetryRechecks() throws Exception { rejects(Phase.PROVIDER); } + + private static void rejects(Phase phase) throws Exception { + var f = new Fixture(phase); + var error = assertThrows(TeaQLRuntimeException.class, f::save); + assertTrue(error.getMessage(), error.getMessage().contains("MUTATION_PLAN_CHANGED_AFTER_REVIEW")); + assertFalse(error.getMessage().contains("not-reviewed")); + assertEquals(1, f.policies); assertEquals(0, f.commits); assertEquals(0, f.audits); + int initialWrites = phase == Phase.PROVIDER ? 2 : 0; + boolean transaction = phase == Phase.TRANSACTION || phase == Phase.PROVIDER; + assertEquals(initialWrites, f.writeOperands.size()); assertEquals(initialWrites, f.sql.writes); + assertEquals(transaction ? 1 : 0, f.begins); assertEquals(transaction ? 1 : 0, f.rollbacks); + assertEquals(Long.valueOf(1), f.order.getVersion()); assertEquals(Long.valueOf(1), f.item.getVersion()); + assertEquals("not-reviewed", E.purchaseOrder(f.order).getContactPhone().eval()); + assertFalse(f.item.getEntityMutationLedger().currentChangeSet().changes().isEmpty()); + f.storage("initial", BigDecimal.ONE, 1); + var rejected = new LinkedHashMap<>(f.effects()); + rejected.put("code", "MUTATION_PLAN_CHANGED_AFTER_REVIEW"); rejected.put("bothStoredRowsUnchanged", true); + f.tamper = false; f.save(); + assertEquals(2, f.policies); assertEquals(initialWrites + 2, f.writeOperands.size()); + assertEquals(initialWrites + 2, f.sql.writes); assertEquals(1, f.commits); assertEquals(2, f.audits); + assertEquals(Long.valueOf(2), f.order.getVersion()); assertEquals(Long.valueOf(2), f.item.getVersion()); + assertTrue(f.item.getEntityMutationLedger().currentChangeSet().changes().isEmpty()); + f.storage("not-reviewed", new BigDecimal("2"), 2); f.receipt(rejected); + } +} diff --git a/examples/fix-e-alignment/fixture-manifest.json b/examples/fix-e-alignment/fixture-manifest.json new file mode 100644 index 000000000..3c9b3f9d2 --- /dev/null +++ b/examples/fix-e-alignment/fixture-manifest.json @@ -0,0 +1,45 @@ +{ + "schema": "teaql.generated-example-fixture/v1", + "language": "java", + "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", + "generatedManifestSha256": "e15383d75949d87ec5c8f1dc7007b6c7d191cc5d028c41c8170b498805d89a03", + "producerReceiptSha256": "d521abd42de7b783e25ed775b883dd97fd217b61060945b4ad9096985768f053", + "producerSource": { + "commit": "e776e14adfd215512faa1961e0f8adb371d3a2ae", + "diff": "4be236084a3599770907f796885c2f718b2f3507be541136640b3ed74031bf5d", + "status": "c8ce30fc42924a698d1c1b33806144774f457d5abd38129d36d2d0c8f52eac08", + "sourceContentsSha256": "9b803af5eef454981b06c6b99b384e5cce503080cf452d6916445b2ba4a31d68" + }, + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 4, + "files": { + "lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java": "1f485bccf6c28ccef60f0b6220d87e30b2135599c2e42840893549ed0c5c0ba2", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java": "6cc1f14e73294d30589fc3d911fd7c74b4e56d7150e988f7356a5be4452e7dea", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java": "720f8fa4d518c0926c6beb1d6bd4687a5854b6709eb687e301fd5edfdfde2852", + "lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "82b9c9efe540331e915852a59470576d1b1ae7a11efcd6ee998bb3eee8e8838c", + "lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java": "f48ef9116244bd114f9335095334e2090404a71e7aec6e4fc4952c3e2d62b133", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java": "d1d66e7c91d0bf50febb551c79acb2a7cfa3bf470a745606a143877f504caacf", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java": "0f20dfe18779ad411ac9d3848fbf163090b091e44fd05bf563f18a474f15ff98", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java": "d6f02514a43866feb38fe121384083203f0eb85a944e4a83d2eec3f07ab51e6b", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java": "758175bbb1694344e892cabdd5cdedf3e785e533b9780e368607ddae93f8a0c3", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java": "6c37ba6ab252b50f5b520ac048b714f491ff73c2333f9480245e78dea3e7fce2", + "lib/src/main/java/com/teaql/checkerfixadvanced/E.java": "866a318903fe482396ff28d529c14a827872d2fd7457cda57af5ffdaf1671cd1", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java": "5446849fcb34da25e1ce3a984fd8930d11d363f5454b94cc81de18a29eb80161", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java": "3ff0b93627835982e58293ccfcaccbeae321900d7546cbdaa2ac50450ac15659", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java": "38ed52b714534d7a96ff550fb4e1f78acb8a9522522c58b7e12eb5d00796dcc3", + "lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java": "69732def8bf31885c5a15fab50e002cdd5f722581b26cafd55fd09beaa95a4c2", + "lib/src/main/java/com/teaql/checkerfixadvanced/Q.java": "1d20fed9963ce79b3b229a799dfb6210c9ad15a2ee408900d613ad9d9bd2dcb8", + "lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java": "13bd28eaa0b207f409b99a0cb7d5fdfd6eb646b5be4f063175d0792449fa5551", + "lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java": "96ca920d9dfcf9502e97ff9ba2c4bb11c9e65d8dd889d5a8844ade4799f19dab", + "lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java": "4d59b88226da8f98578508bbf89fc8bc9ddb49befbdce56ae16d625a819de368", + "lib/pom.xml": "639b421130265f58e4c51404a03a4c3a4dedf59cd4e06d9258f0537374149ed1", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java": "06c8a404d600cdef9396a49ad58377d876fce388ff3eeaba00e91c70f9c2df1a", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java": "d634b613c64c8a74d01b84f17743af34667dbab4a03e4b6fad7311ac9c98e96e", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java": "1bfe964e5553b3d4b0097eaa259def4be1b16611baed05f326f9d842c32c8204" + } +} diff --git a/examples/fix-e-alignment/generated/lib/pom.xml b/examples/fix-e-alignment/generated/lib/pom.xml new file mode 100644 index 000000000..342fd2ddd --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.teaql + checker-fix-advanced-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 1.555-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.555-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/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java new file mode 100644 index 000000000..43c910926 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.checkerfixadvanced; + +import io.teaql.core.UserContext; +public interface CheckerFixAdvancedUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java new file mode 100644 index 000000000..6862c47e3 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.checkerfixadvanced; + +import com.teaql.checkerfixadvanced.tenant.Tenant; + +public interface Constants { + public static final long TENANT_ID = 1l; + public static final Tenant TENANT = Tenant.refer(TENANT_ID); +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/E.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/E.java new file mode 100644 index 000000000..307aeb458 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/E.java @@ -0,0 +1,23 @@ + +package com.teaql.checkerfixadvanced; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemExpression; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderExpression; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static TenantExpression tenant(Tenant tenant){ + return new TenantExpression(new ValueExpression(tenant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.tenant()")); + } + public static PurchaseOrderExpression purchaseOrder(PurchaseOrder purchaseOrder){ + return new PurchaseOrderExpression(new ValueExpression(purchaseOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.purchaseOrder()")); + } + public static OrderItemExpression orderItem(OrderItem orderItem){ + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java new file mode 100644 index 000000000..ace38c54d --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java @@ -0,0 +1,374 @@ + +package com.teaql.checkerfixadvanced; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerTenant(); + registerPurchaseOrder(); + registerOrderItem(); + } + private void registerTenant() { + FieldLayout.installGenerated(com.teaql.checkerfixadvanced.tenant.Tenant.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.tenant.Tenant.class); + entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.tenant.Tenant::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("isPassword", "false") + .with("max", "80") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Tenant Name") + .with("sqlType", "VARCHAR()") + .with("min", "1") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } + private void registerPurchaseOrder() { + FieldLayout.installGenerated(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor tenant = + entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE, com.teaql.checkerfixadvanced.tenant.Tenant.PURCHASE_ORDER_LIST_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.class) + ; + PropertyDescriptor contactPhone = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY, String.class) + ; + PropertyDescriptor internalNote = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_NOTE_PROPERTY, String.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("contextRoot", "true"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("isPassword", "false") + .with("max", "32") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("min", "1") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_NOTE_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } + private void registerOrderItem() { + FieldLayout.installGenerated(com.teaql.checkerfixadvanced.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.checkerfixadvanced.orderitem.OrderItem.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.orderitem.OrderItem.class); + entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.orderitem.OrderItem::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY, Long.class) + ; + PropertyDescriptor purchaseOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.orderitem.OrderItem.PURCHASE_ORDER_PROPERTY, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_TYPE, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class) + ; + PropertyDescriptor tenant = + entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE, com.teaql.checkerfixadvanced.tenant.Tenant.ORDER_ITEM_LIST_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.class) + ; + PropertyDescriptor productName = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY, String.class) + ; + PropertyDescriptor unitPrice = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PURCHASE_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("contextRoot", "true"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("isPassword", "false") + .with("max", "80") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("min", "1") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("isPassword", "false") + .with("max", "1000000") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("min", "0.01") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java new file mode 100644 index 000000000..dfd32d430 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.teaql.checkerfixadvanced; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.checkerfixadvanced.tenant.TenantChecker(), new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker(), new com.teaql.checkerfixadvanced.orderitem.OrderItemChecker()) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Tenant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("PurchaseOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("tenant", "tenant"), java.util.Map.entry("contact_phone", "contactPhone"), java.util.Map.entry("internal_note", "internalNote"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("purchase_order", "purchaseOrder"), java.util.Map.entry("tenant", "tenant"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("unit_price", "unitPrice"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.tenants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.checkerfixadvanced.tenant.Tenant domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.checkerfixadvanced.tenant.Tenant(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Tenant Name"); + domainRoot.auditAs("create generated Domain Root Tenant").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Tenant", domainRoot.getId())); + } +} diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java new file mode 100644 index 000000000..cc57960a1 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.checkerfixadvanced; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.checkerfixadvanced.tenant.TenantRequest tenants(){ + return new com.teaql.checkerfixadvanced.tenant.TenantRequest(com.teaql.checkerfixadvanced.tenant.Tenant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.checkerfixadvanced.tenant.TenantRequest tenantsWithMinimalFields(){ + return new com.teaql.checkerfixadvanced.tenant.TenantRequest(com.teaql.checkerfixadvanced.tenant.Tenant.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest purchaseOrders(){ + return new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest purchaseOrdersWithMinimalFields(){ + return new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.checkerfixadvanced.orderitem.OrderItemRequest orderItems(){ + return new com.teaql.checkerfixadvanced.orderitem.OrderItemRequest(com.teaql.checkerfixadvanced.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.checkerfixadvanced.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ + return new com.teaql.checkerfixadvanced.orderitem.OrderItemRequest(com.teaql.checkerfixadvanced.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java new file mode 100644 index 000000000..7b7b028a8 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java @@ -0,0 +1,200 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderItem extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderItem"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7d17fd30f99ff7729c89502083418f85d482d6c6b7448972408e96e73ae79d75"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("purchase_order", 1), java.util.Map.entry("tenant", 2), java.util.Map.entry("product_name", 3), java.util.Map.entry("unit_price", 4), java.util.Map.entry("create_time", 5), java.util.Map.entry("update_time", 6), java.util.Map.entry("version", 7)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("purchase_order", java.util.List.of("purchaseOrder", "purchase_order")), java.util.Map.entry("tenant", java.util.List.of("tenant", "tenant")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("unit_price", java.util.List.of("unitPrice", "unit_price")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PURCHASE_ORDER_PROPERTY = "purchase_order"; + public static final String TENANT_PROPERTY = "tenant"; + public static final String PRODUCT_NAME_PROPERTY = "product_name"; + public static final String UNIT_PRICE_PROPERTY = "unit_price"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private PurchaseOrder purchaseOrder; + + private Tenant tenant; + + private String productName; + + private BigDecimal unitPrice; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public PurchaseOrder getPurchaseOrder(){ + return this.purchaseOrder; + } + + public Tenant getTenant(){ + return this.tenant; + } + + public String getProductName(){ + return this.productName; + } + + public BigDecimal getUnitPrice(){ + return this.unitPrice; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public OrderItem updatePurchaseOrder(PurchaseOrder purchaseOrder){ + if(isPropertyLoaded(PURCHASE_ORDER_PROPERTY) && Objects.equals(this.purchaseOrder, purchaseOrder)){ + return this; + } + handleUpdate(PURCHASE_ORDER_PROPERTY, getPurchaseOrder(), purchaseOrder); + this.purchaseOrder = purchaseOrder; + return this; + } + + OrderItem updateTenant(Tenant tenant){ + if(isPropertyLoaded(TENANT_PROPERTY) && Objects.equals(this.tenant, tenant)){ + return this; + } + handleUpdate(TENANT_PROPERTY, getTenant(), tenant); + this.tenant = tenant; + return this; + } + + public OrderItem updateProductName(String productName){ + productName = (productName == null ? null : productName.trim()); + if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ + return this; + } + handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); + this.productName = productName; + return this; + } + + public OrderItem updateUnitPrice(BigDecimal unitPrice){ + if(isPropertyLoaded(UNIT_PRICE_PROPERTY) && Objects.equals(this.unitPrice, unitPrice)){ + return this; + } + handleUpdate(UNIT_PRICE_PROPERTY, getUnitPrice(), unitPrice); + this.unitPrice = unitPrice; + return this; + } + + public OrderItem updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public OrderItem updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static OrderItem refer(Long id){ + OrderItem refer = new OrderItem(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderItem comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "purchase_order": this.purchaseOrder = (PurchaseOrder) value; break; + + case "tenant": this.tenant = (Tenant) value; break; + + case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; + + case "unit_price": this.unitPrice = (BigDecimal) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "purchase_order": return this.purchaseOrder; + case "tenant": return this.tenant; + case "product_name": return this.productName; + case "unit_price": return this.unitPrice; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java new file mode 100644 index 000000000..2bd7f558a --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java @@ -0,0 +1,124 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +public class OrderItemChecker implements Checker{ + + public String type(){ + return OrderItem.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if(needCheck(_context, orderItem)){ + markAsChecked(_context, orderItem); + doCheck(_context, orderItem, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if((orderItem == null)){ + return; + } + if(orderItem.needPersist()){ + verifyContextRoot(_context, orderItem, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); + + } + if(orderItem.newItem()){ + if(orderItem.getTenant() == null){ + orderItem.updateTenant(Tenant.refer(_context.requireActiveRoot("Tenant").id())); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "tenant", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "activeRoot:Tenant")); + }else{ + _context.verifyActiveRoot("Tenant", orderItem.getTenant().getId()); + } + if(orderItem.getCreateTime() == null){ + orderItem.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + }if(orderItem.getUpdateTime() == null){ + orderItem.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + } + }else if(orderItem.updateItem()){ + orderItem.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(!orderItem.isPropertyLoaded("purchase_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "purchase_order"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("tenant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "tenant"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("product_name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("unit_price")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "unit_price"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkPurchaseOrder(_context, orderItem.getProperty(OrderItem.PURCHASE_ORDER_PROPERTY), newLocation(_parentLocation, "purchase_order")); + checkTenant(_context, orderItem.getProperty(OrderItem.TENANT_PROPERTY), newLocation(_parentLocation, "tenant")); + checkProductName(_context, orderItem.getProperty(OrderItem.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); + checkUnitPrice(_context, orderItem.getProperty(OrderItem.UNIT_PRICE_PROPERTY), newLocation(_parentLocation, "unit_price")); + checkCreateTime(_context, orderItem.getProperty(OrderItem.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, orderItem.getProperty(OrderItem.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkPurchaseOrder(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, purchaseOrder); + if((purchaseOrder == null)){ + return; + } + new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, _parentLocation); + } + public void checkTenant(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, tenant); + if((tenant == null)){ + return; + } + new TenantChecker().checkAndFix(_context, tenant, _parentLocation); + } + public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, productName); + if((productName == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, productName); + maxStringCheck(_context, _parentLocation, 80, productName); + + } + public void checkUnitPrice(UserContext _context, BigDecimal unitPrice, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, unitPrice); + if((unitPrice == null)){ + return; + } + minNumberCheck(_context, _parentLocation, 0.01, unitPrice); + maxNumberCheck(_context, _parentLocation, 1000000, unitPrice); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java new file mode 100644 index 000000000..282d0ad15 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java @@ -0,0 +1,86 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderExpression; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderItemExpression(Expression expression){ + super(expression); + } + + public OrderItemExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderItemExpression updateId(Long id){ + return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); + } + + public OrderItemExpression save(UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderItemExpression save(String intent, UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PurchaseOrderExpression getPurchaseOrder(){ + return new PurchaseOrderExpression(loaded("purchase_order", "getPurchaseOrder", OrderItem::getPurchaseOrder)); + } + + public OrderItemExpression updatePurchaseOrder(PurchaseOrder purchaseOrder){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updatePurchaseOrder(purchaseOrder)); + } + + public TenantExpression getTenant(){ + return new TenantExpression(loaded("tenant", "getTenant", OrderItem::getTenant)); + } + + public OrderItemExpression updateTenant(Tenant tenant){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateTenant(tenant)); + } + + public Expression getProductName(){ + return loaded("product_name", "getProductName", OrderItem::getProductName); + } + public OrderItemExpression updateProductName(String productName){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateProductName(productName)); + } + + public Expression getUnitPrice(){ + return loaded("unit_price", "getUnitPrice", OrderItem::getUnitPrice); + } + public OrderItemExpression updateUnitPrice(BigDecimal unitPrice){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUnitPrice(unitPrice)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", OrderItem::getCreateTime); + } + public OrderItemExpression updateCreateTime(LocalDateTime createTime){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", OrderItem::getUpdateTime); + } + public OrderItemExpression updateUpdateTime(LocalDateTime updateTime){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java new file mode 100644 index 000000000..d1274ee3d --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderItemListExpression extends SmartListExpression { + public OrderItemListExpression(Expression> expression){ + super(expression); + } + + public OrderItemListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderItemExpression first() { + return new OrderItemExpression(super.first()); + } + + public OrderItemExpression get(int index) { + return new OrderItemExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java new file mode 100644 index 000000000..cc63277e4 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java @@ -0,0 +1,1180 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Date; + +public class OrderItemRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderItemRequest(Class returnType){ + this(returnType, () -> (T) new OrderItem()); + } + + protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderItemRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderItemRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderItemRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderItemRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderItemRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderItemRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ + super.internalMatchAny(orderItem); + return this; + } + + public OrderItemRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderItemRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderItemRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderItemRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPurchaseOrderIdOnly().selectTenantIdOnly().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public OrderItemRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderItem.ID_PROPERTY); + selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + selectProperty(OrderItem.TENANT_PROPERTY); + selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + selectProperty(OrderItem.UNIT_PRICE_PROPERTY); + selectProperty(OrderItem.CREATE_TIME_PROPERTY); + selectProperty(OrderItem.UPDATE_TIME_PROPERTY); + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest selectAll(){ + super.selectAll(); + return selectId().selectPurchaseOrder().selectTenant().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public OrderItemRequest selectChildren(){ + super.selectAny(); + return selectId().selectPurchaseOrder().selectTenant().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public OrderItemRequest selectId(){ + selectProperty(OrderItem.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectId(){ + unselectProperty(OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest selectPurchaseOrderIdOnly(){ + selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest selectPurchaseOrder(){ + return selectPurchaseOrderWith(Q.purchaseOrders().unlimited().selectSelf()); + } + + public OrderItemRequest selectPurchaseOrderWith(PurchaseOrderRequest purchaseOrder){ + selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + enhanceRelation(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderWith", null, OrderItem.PURCHASE_ORDER_PROPERTY)); + return this; + } + + public OrderItemRequest unselectPurchaseOrder(){ + unselectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + public OrderItemRequest selectTenantIdOnly(){ + selectProperty(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest selectTenant(){ + return selectTenantWith(Q.tenants().unlimited().selectSelf()); + } + + public OrderItemRequest selectTenantWith(TenantRequest tenant){ + selectProperty(OrderItem.TENANT_PROPERTY); + enhanceRelation(OrderItem.TENANT_PROPERTY, tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTenantWith", null, OrderItem.TENANT_PROPERTY)); + return this; + } + + public OrderItemRequest unselectTenant(){ + unselectProperty(OrderItem.TENANT_PROPERTY); + return this; + } + public OrderItemRequest selectProductName(){ + selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + /** + * fill the productName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS productName) to fetch productName property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectProductName(){ + unselectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest selectUnitPrice(){ + selectProperty(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + /** + * fill the unitPrice with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS unitPrice) to fetch unitPrice property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the unitPrice with customized aggrFunction, TEAQL uses ({aggrFunction}(unitPrice) AS unitPrice to fetch unitPrice property. + * @param aggrFunction aggrFunction + */ + public OrderItemRequest selectUnitPrice(AggrFunction aggrFunction){ + selectProperty(OrderItem.UNIT_PRICE_PROPERTY, aggrFunction); + return this; + } + + + public OrderItemRequest unselectUnitPrice(){ + unselectProperty(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest selectCreateTime(){ + selectProperty(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectCreateTime(){ + unselectProperty(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest selectUpdateTime(){ + selectProperty(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectUpdateTime(){ + unselectProperty(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest selectVersion(){ + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectVersion(){ + unselectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); + } + + public OrderItemRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderItemRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderItemRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderItemRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderItemRequest filterByPurchaseOrder(PurchaseOrder... purchaseOrder){ + if (purchaseOrder == null || purchaseOrder.length == 0) { + throw new IllegalArgumentException("filterByPurchaseOrder parameter purchaseOrder cannot be empty"); + } + return appendSearchCriteria(createPurchaseOrderCriteria(Operator.EQUAL, (Object[])purchaseOrder)); + } + + public OrderItemRequest withPurchaseOrder(Operator operator, Object... values){ + return appendSearchCriteria(createPurchaseOrderCriteria(operator, values)); + } + + public OrderItemRequest withPurchaseOrderIsUnknown(){ + return withPurchaseOrder(Operator.IS_NULL); + } + + public OrderItemRequest withPurchaseOrderIsKnown(){ + return withPurchaseOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPurchaseOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, operator, values); + } + + public OrderItemRequest filterByPurchaseOrder(Long purchaseOrder){ + if(purchaseOrder == null){ + return this; + } + return withPurchaseOrder(Operator.EQUAL, purchaseOrder); + } + public OrderItemRequest withPurchaseOrderMatching(PurchaseOrderRequest purchaseOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, PurchaseOrder.ID_PROPERTY)); + } + + public OrderItemRequest withoutPurchaseOrderMatching(PurchaseOrderRequest purchaseOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, PurchaseOrder.ID_PROPERTY))); + } + + public OrderItemRequest filterByTenant(Tenant... tenant){ + if (tenant == null || tenant.length == 0) { + throw new IllegalArgumentException("filterByTenant parameter tenant cannot be empty"); + } + return appendSearchCriteria(createTenantCriteria(Operator.EQUAL, (Object[])tenant)); + } + + public OrderItemRequest withTenant(Operator operator, Object... values){ + return appendSearchCriteria(createTenantCriteria(operator, values)); + } + + public OrderItemRequest withTenantIsUnknown(){ + return withTenant(Operator.IS_NULL); + } + + public OrderItemRequest withTenantIsKnown(){ + return withTenant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTenantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.TENANT_PROPERTY, operator, values); + } + + public OrderItemRequest filterByTenant(Long tenant){ + if(tenant == null){ + return this; + } + return withTenant(Operator.EQUAL, tenant); + } + public OrderItemRequest withTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY)); + } + + public OrderItemRequest withoutTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY))); + } + + public OrderItemRequest filterByProductName(String... productName){ + if (productName == null || productName.length == 0) { + throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); + } + return appendSearchCriteria(createProductNameCriteria(Operator.EQUAL, (Object[])productName)); + } + + public OrderItemRequest withProductName(Operator operator, Object... values){ + return appendSearchCriteria(createProductNameCriteria(operator, values)); + } + + public OrderItemRequest withProductNameIsUnknown(){ + return withProductName(Operator.IS_NULL); + } + + public OrderItemRequest withProductNameIsKnown(){ + return withProductName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createProductNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.PRODUCT_NAME_PROPERTY, operator, values); + } + + public OrderItemRequest withProductNameIsNot(String productName){ + return withProductName(Operator.NOT_EQUAL, productName); + } + + public OrderItemRequest withProductNameIn(String... productName){ + return withProductName(Operator.IN, (Object[])productName); + } + + public OrderItemRequest withProductNameNotIn(String... productName){ + return withProductName(Operator.NOT_IN, (Object[])productName); + } + public OrderItemRequest withProductNameGreaterThan(String productName){ + return withProductName(Operator.GREATER_THAN, productName); + } + + public OrderItemRequest withProductNameGreaterThanOrEqualTo(String productName){ + return withProductName(Operator.GREATER_THAN_OR_EQUAL, productName); + } + + public OrderItemRequest withProductNameLessThan(String productName){ + return withProductName(Operator.LESS_THAN, productName); + } + + public OrderItemRequest withProductNameLessThanOrEqualTo(String productName){ + return withProductName(Operator.LESS_THAN_OR_EQUAL, productName); + } + + public OrderItemRequest withProductNameBetween(String startOfProductName, String endOfProductName){ + return withProductName(Operator.BETWEEN, startOfProductName, endOfProductName); + } + public OrderItemRequest withProductNameStartingWith(String productName){ + return withProductName(Operator.BEGIN_WITH, productName); + } + public OrderItemRequest withProductNameContaining(String productName){ + return withProductName(Operator.CONTAIN, productName); + } + + public OrderItemRequest withProductNameNotContaining(String productName){ + return withProductName(Operator.NOT_CONTAIN, productName); + } + + public OrderItemRequest withProductNameNotStartingWith(String productName){ + return withProductName(Operator.NOT_BEGIN_WITH, productName); + } + + public OrderItemRequest withProductNameEndingWith(String productName){ + return withProductName(Operator.END_WITH, productName); + } + + public OrderItemRequest withProductNameNotEndingWith(String productName){ + return withProductName(Operator.NOT_END_WITH, productName); + } + + public OrderItemRequest withProductNameIs(String productName){ + return withProductName(Operator.EQUAL, productName); + } + + public OrderItemRequest withProductNameSoundingLike(String productName){ + return withProductName(Operator.SOUNDS_LIKE, productName); + } + + + + public OrderItemRequest filterByUnitPrice(BigDecimal... unitPrice){ + if (unitPrice == null || unitPrice.length == 0) { + throw new IllegalArgumentException("filterByUnitPrice parameter unitPrice cannot be empty"); + } + return appendSearchCriteria(createUnitPriceCriteria(Operator.EQUAL, (Object[])unitPrice)); + } + + public OrderItemRequest withUnitPrice(Operator operator, Object... values){ + return appendSearchCriteria(createUnitPriceCriteria(operator, values)); + } + + public OrderItemRequest withUnitPriceIsUnknown(){ + return withUnitPrice(Operator.IS_NULL); + } + + public OrderItemRequest withUnitPriceIsKnown(){ + return withUnitPrice(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUnitPriceCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.UNIT_PRICE_PROPERTY, operator, values); + } + + public OrderItemRequest withUnitPriceIs(BigDecimal unitPrice){ + return withUnitPrice(Operator.EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceIsNot(BigDecimal unitPrice){ + return withUnitPrice(Operator.NOT_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceIn(BigDecimal... unitPrice){ + return withUnitPrice(Operator.IN, (Object[])unitPrice); + } + + public OrderItemRequest withUnitPriceNotIn(BigDecimal... unitPrice){ + return withUnitPrice(Operator.NOT_IN, (Object[])unitPrice); + } + public OrderItemRequest withUnitPriceGreaterThan(BigDecimal unitPrice){ + return withUnitPrice(Operator.GREATER_THAN, unitPrice); + } + + public OrderItemRequest withUnitPriceGreaterThanOrEqualTo(BigDecimal unitPrice){ + return withUnitPrice(Operator.GREATER_THAN_OR_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceLessThan(BigDecimal unitPrice){ + return withUnitPrice(Operator.LESS_THAN, unitPrice); + } + + public OrderItemRequest withUnitPriceLessThanOrEqualTo(BigDecimal unitPrice){ + return withUnitPrice(Operator.LESS_THAN_OR_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceBetween(BigDecimal startOfUnitPrice, BigDecimal endOfUnitPrice){ + return withUnitPrice(Operator.BETWEEN, startOfUnitPrice, endOfUnitPrice); + } + + + + public OrderItemRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public OrderItemRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public OrderItemRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public OrderItemRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.CREATE_TIME_PROPERTY, operator, values); + } + + public OrderItemRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public OrderItemRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public OrderItemRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderItemRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderItemRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public OrderItemRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderItemRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderItemRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderItemRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderItemRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public OrderItemRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public OrderItemRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public OrderItemRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public OrderItemRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.UPDATE_TIME_PROPERTY, operator, values); + } + + public OrderItemRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public OrderItemRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public OrderItemRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public OrderItemRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public OrderItemRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderItemRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderItemRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderItemRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); + } + + public OrderItemRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderItemRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderItemRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderItemRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderItemRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderItemRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderItemRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderItemRequest minUnitPrice(){ + return minUnitPriceAs(prefix("minOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest minUnitPriceAs(String retName){ + super.min(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest maxUnitPrice(){ + return maxUnitPriceAs(prefix("maxOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest maxUnitPriceAs(String retName){ + super.max(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest sumUnitPrice(){ + return sumUnitPriceAs(prefix("sumOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest sumUnitPriceAs(String retName){ + super.sum(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest avgUnitPrice(){ + return avgUnitPriceAs(prefix("avgOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest avgUnitPriceAs(String retName){ + super.avg(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest standardDeviationUnitPrice(){ + return standardDeviationUnitPriceAs(prefix("standardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest standardDeviationUnitPriceAs(String retName){ + super.standardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPrice(){ + return squareRootOfPopulationStandardDeviationUnitPriceAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPriceAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest sampleVarianceUnitPrice(){ + return sampleVarianceUnitPriceAs(prefix("sampleVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest sampleVarianceUnitPriceAs(String retName){ + super.sampleVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest samplePopulationVarianceUnitPrice(){ + return samplePopulationVarianceUnitPriceAs(prefix("samplePopulationVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest samplePopulationVarianceUnitPriceAs(String retName){ + super.samplePopulationVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest groupByPurchaseOrderWithDetails(){ + return groupByPurchaseOrderWithDetails(Q.purchaseOrders().unlimited()); + } + + public OrderItemRequest groupByPurchaseOrderWithDetails(PurchaseOrderRequest subRequest){ + aggregate(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest); + return this; + } + + public OrderItemRequest groupByTenantWithDetails(){ + return groupByTenantWithDetails(Q.tenants().unlimited()); + } + + public OrderItemRequest groupByTenantWithDetails(TenantRequest subRequest){ + aggregate(OrderItem.TENANT_PROPERTY, subRequest); + return this; + } + + + + + + + + public OrderItemRequest groupById(){ + groupBy(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdAs(String retName){ + groupBy(retName, OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.ID_PROPERTY, function); + return this; + } + public OrderItemRequest groupByPurchaseOrderWith(PurchaseOrderRequest subRequest){ + groupBy(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest); + return this; + } + public OrderItemRequest groupByPurchaseOrder(){ + groupBy(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByPurchaseOrderAs(String retName){ + groupBy(retName, OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByPurchaseOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.PURCHASE_ORDER_PROPERTY, function); + return this; + } + public OrderItemRequest groupByTenantWith(TenantRequest subRequest){ + groupBy(OrderItem.TENANT_PROPERTY, subRequest); + return this; + } + public OrderItemRequest groupByTenant(){ + groupBy(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest groupByTenantAs(String retName){ + groupBy(retName, OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest groupByTenantWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.TENANT_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByProductName(){ + groupBy(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByProductNameAs(String retName){ + groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByProductNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByUnitPrice(){ + groupBy(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest groupByUnitPriceAs(String retName){ + groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest groupByUnitPriceWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByCreateTime(){ + groupBy(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByCreateTimeAs(String retName){ + groupBy(retName, OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.CREATE_TIME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByUpdateTime(){ + groupBy(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.UPDATE_TIME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByVersion(){ + groupBy(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionAs(String retName){ + groupBy(retName, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.VERSION_PROPERTY, function); + return this; + } + + + + public OrderItemRequest orderByIdAscending(){ + addOrderByAscending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByIdDescending(){ + addOrderByDescending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByPurchaseOrderAscending(){ + addOrderByAscending(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByPurchaseOrderDescending(){ + addOrderByDescending(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByTenantAscending(){ + addOrderByAscending(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest orderByTenantDescending(){ + addOrderByDescending(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameAscending(){ + addOrderByAscending(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameDescending(){ + addOrderByDescending(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByProductNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByUnitPriceAscending(){ + addOrderByAscending(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest orderByUnitPriceDescending(){ + addOrderByDescending(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest orderByCreateTimeAscending(){ + addOrderByAscending(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByCreateTimeDescending(){ + addOrderByDescending(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByUpdateTimeAscending(){ + addOrderByAscending(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByUpdateTimeDescending(){ + addOrderByDescending(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionAscending(){ + addOrderByAscending(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionDescending(){ + addOrderByDescending(OrderItem.VERSION_PROPERTY); + return this; + } + + + public PurchaseOrderRequest rollUpToPurchaseOrder(){ + PurchaseOrderRequest purchaseOrder = Q.purchaseOrders().unlimited(); + this.withPurchaseOrderMatching(purchaseOrder) + .groupByPurchaseOrderWith(purchaseOrder); + return purchaseOrder; + } + + public TenantRequest rollUpToTenant(){ + TenantRequest tenant = Q.tenants().unlimited(); + this.withTenantMatching(tenant) + .groupByTenantWith(tenant); + return tenant; + } + + + + + + + + public OrderItemRequest facetByPurchaseOrderAs(String facetName, PurchaseOrderRequest purchaseOrder){ + return facetByPurchaseOrderAs(facetName, purchaseOrder, true); + } + + public OrderItemRequest facetByPurchaseOrderAs(String facetName, PurchaseOrderRequest purchaseOrder, boolean includeAllFacets){ + addFacet(facetName, OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPurchaseOrderAs", facetName, OrderItem.PURCHASE_ORDER_PROPERTY)); + return this; + } + public OrderItemRequest facetByTenantAs(String facetName, TenantRequest tenant){ + return facetByTenantAs(facetName, tenant, true); + } + + public OrderItemRequest facetByTenantAs(String facetName, TenantRequest tenant, boolean includeAllFacets){ + addFacet(facetName, OrderItem.TENANT_PROPERTY, tenant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTenantAs", facetName, OrderItem.TENANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderItemRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderItemRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderItemRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderItemRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderItemRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderItemRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java new file mode 100644 index 000000000..466012e5b --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java @@ -0,0 +1,202 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class PurchaseOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "PurchaseOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "fc779222657a345b62cacc08e4beb1351e6097a5fd25927366703543a4afdd39"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("tenant", 1), java.util.Map.entry("contact_phone", 2), java.util.Map.entry("internal_note", 3), java.util.Map.entry("create_time", 4), java.util.Map.entry("update_time", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("tenant", java.util.List.of("tenant", "tenant")), java.util.Map.entry("contact_phone", java.util.List.of("contactPhone", "contact_phone")), java.util.Map.entry("internal_note", java.util.List.of("internalNote", "internal_note")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + PurchaseOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String TENANT_PROPERTY = "tenant"; + public static final String CONTACT_PHONE_PROPERTY = "contact_phone"; + public static final String INTERNAL_NOTE_PROPERTY = "internal_note"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + private Tenant tenant; + + private String contactPhone; + + private String internalNote; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList orderItemList; + + public Tenant getTenant(){ + return this.tenant; + } + + public String getContactPhone(){ + return this.contactPhone; + } + + public String getInternalNote(){ + return this.internalNote; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getOrderItemList(){ + return this.orderItemList; + } + PurchaseOrder updateTenant(Tenant tenant){ + if(isPropertyLoaded(TENANT_PROPERTY) && Objects.equals(this.tenant, tenant)){ + return this; + } + handleUpdate(TENANT_PROPERTY, getTenant(), tenant); + this.tenant = tenant; + return this; + } + + public PurchaseOrder updateContactPhone(String contactPhone){ + contactPhone = (contactPhone == null ? null : contactPhone.trim()); + if(isPropertyLoaded(CONTACT_PHONE_PROPERTY) && Objects.equals(this.contactPhone, contactPhone)){ + return this; + } + handleUpdate(CONTACT_PHONE_PROPERTY, getContactPhone(), contactPhone); + this.contactPhone = contactPhone; + return this; + } + + public PurchaseOrder updateInternalNote(String internalNote){ + internalNote = (internalNote == null ? null : internalNote.trim()); + if(isPropertyLoaded(INTERNAL_NOTE_PROPERTY) && Objects.equals(this.internalNote, internalNote)){ + return this; + } + handleUpdate(INTERNAL_NOTE_PROPERTY, getInternalNote(), internalNote); + this.internalNote = internalNote; + return this; + } + + public PurchaseOrder updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public PurchaseOrder updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public PurchaseOrder addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + this.orderItemList = new SmartList<>(); + } + + this.orderItemList.add(orderItem); + orderItem.updatePurchaseOrder(this); + return this; + } + + public static PurchaseOrder refer(Long id){ + PurchaseOrder refer = new PurchaseOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public PurchaseOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "tenant": this.tenant = (Tenant) value; break; + + case "contact_phone": this.contactPhone = (value == null ? null : ((String)value).trim()); break; + + case "internal_note": this.internalNote = (value == null ? null : ((String)value).trim()); break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "order_item_list": this.orderItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "tenant": return this.tenant; + case "contact_phone": return this.contactPhone; + case "internal_note": return this.internalNote; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "order_item_list": return this.orderItemList; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java new file mode 100644 index 000000000..5b578889b --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java @@ -0,0 +1,114 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemChecker; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class PurchaseOrderChecker implements Checker{ + + public String type(){ + return PurchaseOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, purchaseOrder)){ + markAsChecked(_context, purchaseOrder); + doCheck(_context, purchaseOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if((purchaseOrder == null)){ + return; + } + if(purchaseOrder.needPersist()){ + verifyContextRoot(_context, purchaseOrder, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); + + } + if(purchaseOrder.newItem()){ + if(purchaseOrder.getTenant() == null){ + purchaseOrder.updateTenant(Tenant.refer(_context.requireActiveRoot("Tenant").id())); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "tenant", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "activeRoot:Tenant")); + }else{ + _context.verifyActiveRoot("Tenant", purchaseOrder.getTenant().getId()); + } + if(purchaseOrder.getCreateTime() == null){ + purchaseOrder.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + }if(purchaseOrder.getUpdateTime() == null){ + purchaseOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + } + }else if(purchaseOrder.updateItem()){ + purchaseOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(!purchaseOrder.isPropertyLoaded("tenant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "tenant"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("contact_phone")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "contact_phone"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("internal_note")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "internal_note"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkTenant(_context, purchaseOrder.getProperty(PurchaseOrder.TENANT_PROPERTY), newLocation(_parentLocation, "tenant")); + checkContactPhone(_context, purchaseOrder.getProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY), newLocation(_parentLocation, "contact_phone")); + checkInternalNote(_context, purchaseOrder.getProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY), newLocation(_parentLocation, "internal_note")); + checkCreateTime(_context, purchaseOrder.getProperty(PurchaseOrder.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, purchaseOrder.getProperty(PurchaseOrder.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; purchaseOrder.getOrderItemList() != null && i < purchaseOrder.getOrderItemList().size(); i++){ + OrderItem orderItem = purchaseOrder.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + } + + public void checkTenant(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, tenant); + if((tenant == null)){ + return; + } + new TenantChecker().checkAndFix(_context, tenant, _parentLocation); + } + public void checkContactPhone(UserContext _context, String contactPhone, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contactPhone); + if((contactPhone == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, contactPhone); + maxStringCheck(_context, _parentLocation, 32, contactPhone); + + } + public void checkInternalNote(UserContext _context, String internalNote, ObjectLocation _parentLocation){ + if((internalNote == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, internalNote); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java new file mode 100644 index 000000000..0bd20c34e --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java @@ -0,0 +1,83 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemListExpression; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class PurchaseOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PurchaseOrderExpression(Expression expression){ + super(expression); + } + + public PurchaseOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public PurchaseOrderExpression updateId(Long id){ + return new PurchaseOrderExpression(this, $it -> {((PurchaseOrder)$it).__internalSet("id", id); return this;}); + } + + public PurchaseOrderExpression save(UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PurchaseOrderExpression save(String intent, UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public TenantExpression getTenant(){ + return new TenantExpression(loaded("tenant", "getTenant", PurchaseOrder::getTenant)); + } + + public PurchaseOrderExpression updateTenant(Tenant tenant){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateTenant(tenant)); + } + + public Expression getContactPhone(){ + return loaded("contact_phone", "getContactPhone", PurchaseOrder::getContactPhone); + } + public PurchaseOrderExpression updateContactPhone(String contactPhone){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateContactPhone(contactPhone)); + } + + public Expression getInternalNote(){ + return loaded("internal_note", "getInternalNote", PurchaseOrder::getInternalNote); + } + public PurchaseOrderExpression updateInternalNote(String internalNote){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateInternalNote(internalNote)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", PurchaseOrder::getCreateTime); + } + public PurchaseOrderExpression updateCreateTime(LocalDateTime createTime){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", PurchaseOrder::getUpdateTime); + } + public PurchaseOrderExpression updateUpdateTime(LocalDateTime updateTime){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateUpdateTime(updateTime)); + } + + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", PurchaseOrder::getOrderItemList)); + } + public PurchaseOrderExpression addOrderItem(OrderItem orderItem){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).addOrderItem(orderItem)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java new file mode 100644 index 000000000..89d8bd843 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PurchaseOrderListExpression extends SmartListExpression { + public PurchaseOrderListExpression(Expression> expression){ + super(expression); + } + + public PurchaseOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PurchaseOrderExpression first() { + return new PurchaseOrderExpression(super.first()); + } + + public PurchaseOrderExpression get(int index) { + return new PurchaseOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java new file mode 100644 index 000000000..f736c5bd9 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java @@ -0,0 +1,1240 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemRequest; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; + +public class PurchaseOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PurchaseOrderRequest(Class returnType){ + this(returnType, () -> (T) new PurchaseOrder()); + } + + protected PurchaseOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PurchaseOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PurchaseOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PurchaseOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PurchaseOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PurchaseOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PurchaseOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PurchaseOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PurchaseOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public PurchaseOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PurchaseOrderRequest matchingAnyOf(PurchaseOrderRequest purchaseOrder){ + super.internalMatchAny(purchaseOrder); + return this; + } + + public PurchaseOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PurchaseOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PurchaseOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PurchaseOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectTenantIdOnly().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PurchaseOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public PurchaseOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(PurchaseOrder.ID_PROPERTY); + selectProperty(PurchaseOrder.TENANT_PROPERTY); + selectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); + selectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + selectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); + selectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectTenant().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PurchaseOrderRequest selectChildren(){ + super.selectAny(); + selectOrderItemList(); + return selectId().selectTenant().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public PurchaseOrderRequest selectId(){ + selectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectId(){ + unselectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest selectTenantIdOnly(){ + selectProperty(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectTenant(){ + return selectTenantWith(Q.tenants().unlimited().selectSelf()); + } + + public PurchaseOrderRequest selectTenantWith(TenantRequest tenant){ + selectProperty(PurchaseOrder.TENANT_PROPERTY); + enhanceRelation(PurchaseOrder.TENANT_PROPERTY, tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTenantWith", null, PurchaseOrder.TENANT_PROPERTY)); + return this; + } + + public PurchaseOrderRequest unselectTenant(){ + unselectProperty(PurchaseOrder.TENANT_PROPERTY); + return this; + } + public PurchaseOrderRequest selectContactPhone(){ + selectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + /** + * fill the contactPhone with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contactPhone) to fetch contactPhone property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectContactPhone(){ + unselectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest selectInternalNote(){ + selectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + /** + * fill the internalNote with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS internalNote) to fetch internalNote property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectInternalNote(){ + unselectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest selectCreateTime(){ + selectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectCreateTime(){ + unselectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest selectUpdateTime(){ + selectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectUpdateTime(){ + unselectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest selectVersion(){ + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectVersion(){ + unselectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + public PurchaseOrderRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public PurchaseOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.ID_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PurchaseOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PurchaseOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PurchaseOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PurchaseOrderRequest filterByTenant(Tenant... tenant){ + if (tenant == null || tenant.length == 0) { + throw new IllegalArgumentException("filterByTenant parameter tenant cannot be empty"); + } + return appendSearchCriteria(createTenantCriteria(Operator.EQUAL, (Object[])tenant)); + } + + public PurchaseOrderRequest withTenant(Operator operator, Object... values){ + return appendSearchCriteria(createTenantCriteria(operator, values)); + } + + public PurchaseOrderRequest withTenantIsUnknown(){ + return withTenant(Operator.IS_NULL); + } + + public PurchaseOrderRequest withTenantIsKnown(){ + return withTenant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTenantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.TENANT_PROPERTY, operator, values); + } + + public PurchaseOrderRequest filterByTenant(Long tenant){ + if(tenant == null){ + return this; + } + return withTenant(Operator.EQUAL, tenant); + } + public PurchaseOrderRequest withTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY)); + } + + public PurchaseOrderRequest withoutTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(PurchaseOrder.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY))); + } + + public PurchaseOrderRequest filterByContactPhone(String... contactPhone){ + if (contactPhone == null || contactPhone.length == 0) { + throw new IllegalArgumentException("filterByContactPhone parameter contactPhone cannot be empty"); + } + return appendSearchCriteria(createContactPhoneCriteria(Operator.EQUAL, (Object[])contactPhone)); + } + + public PurchaseOrderRequest withContactPhone(Operator operator, Object... values){ + return appendSearchCriteria(createContactPhoneCriteria(operator, values)); + } + + public PurchaseOrderRequest withContactPhoneIsUnknown(){ + return withContactPhone(Operator.IS_NULL); + } + + public PurchaseOrderRequest withContactPhoneIsKnown(){ + return withContactPhone(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContactPhoneCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.CONTACT_PHONE_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withContactPhoneIsNot(String contactPhone){ + return withContactPhone(Operator.NOT_EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneIn(String... contactPhone){ + return withContactPhone(Operator.IN, (Object[])contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotIn(String... contactPhone){ + return withContactPhone(Operator.NOT_IN, (Object[])contactPhone); + } + public PurchaseOrderRequest withContactPhoneGreaterThan(String contactPhone){ + return withContactPhone(Operator.GREATER_THAN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneGreaterThanOrEqualTo(String contactPhone){ + return withContactPhone(Operator.GREATER_THAN_OR_EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneLessThan(String contactPhone){ + return withContactPhone(Operator.LESS_THAN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneLessThanOrEqualTo(String contactPhone){ + return withContactPhone(Operator.LESS_THAN_OR_EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneBetween(String startOfContactPhone, String endOfContactPhone){ + return withContactPhone(Operator.BETWEEN, startOfContactPhone, endOfContactPhone); + } + public PurchaseOrderRequest withContactPhoneStartingWith(String contactPhone){ + return withContactPhone(Operator.BEGIN_WITH, contactPhone); + } + public PurchaseOrderRequest withContactPhoneContaining(String contactPhone){ + return withContactPhone(Operator.CONTAIN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotContaining(String contactPhone){ + return withContactPhone(Operator.NOT_CONTAIN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotStartingWith(String contactPhone){ + return withContactPhone(Operator.NOT_BEGIN_WITH, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneEndingWith(String contactPhone){ + return withContactPhone(Operator.END_WITH, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotEndingWith(String contactPhone){ + return withContactPhone(Operator.NOT_END_WITH, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneIs(String contactPhone){ + return withContactPhone(Operator.EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneSoundingLike(String contactPhone){ + return withContactPhone(Operator.SOUNDS_LIKE, contactPhone); + } + + + + public PurchaseOrderRequest filterByInternalNote(String... internalNote){ + if (internalNote == null || internalNote.length == 0) { + throw new IllegalArgumentException("filterByInternalNote parameter internalNote cannot be empty"); + } + return appendSearchCriteria(createInternalNoteCriteria(Operator.EQUAL, (Object[])internalNote)); + } + + public PurchaseOrderRequest withInternalNote(Operator operator, Object... values){ + return appendSearchCriteria(createInternalNoteCriteria(operator, values)); + } + + public PurchaseOrderRequest withInternalNoteIsUnknown(){ + return withInternalNote(Operator.IS_NULL); + } + + public PurchaseOrderRequest withInternalNoteIsKnown(){ + return withInternalNote(Operator.IS_NOT_NULL); + } + + public SearchCriteria createInternalNoteCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.INTERNAL_NOTE_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withInternalNoteIsNot(String internalNote){ + return withInternalNote(Operator.NOT_EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteIn(String... internalNote){ + return withInternalNote(Operator.IN, (Object[])internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotIn(String... internalNote){ + return withInternalNote(Operator.NOT_IN, (Object[])internalNote); + } + public PurchaseOrderRequest withInternalNoteGreaterThan(String internalNote){ + return withInternalNote(Operator.GREATER_THAN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteGreaterThanOrEqualTo(String internalNote){ + return withInternalNote(Operator.GREATER_THAN_OR_EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteLessThan(String internalNote){ + return withInternalNote(Operator.LESS_THAN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteLessThanOrEqualTo(String internalNote){ + return withInternalNote(Operator.LESS_THAN_OR_EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteBetween(String startOfInternalNote, String endOfInternalNote){ + return withInternalNote(Operator.BETWEEN, startOfInternalNote, endOfInternalNote); + } + public PurchaseOrderRequest withInternalNoteStartingWith(String internalNote){ + return withInternalNote(Operator.BEGIN_WITH, internalNote); + } + public PurchaseOrderRequest withInternalNoteContaining(String internalNote){ + return withInternalNote(Operator.CONTAIN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotContaining(String internalNote){ + return withInternalNote(Operator.NOT_CONTAIN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotStartingWith(String internalNote){ + return withInternalNote(Operator.NOT_BEGIN_WITH, internalNote); + } + + public PurchaseOrderRequest withInternalNoteEndingWith(String internalNote){ + return withInternalNote(Operator.END_WITH, internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotEndingWith(String internalNote){ + return withInternalNote(Operator.NOT_END_WITH, internalNote); + } + + public PurchaseOrderRequest withInternalNoteIs(String internalNote){ + return withInternalNote(Operator.EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteSoundingLike(String internalNote){ + return withInternalNote(Operator.SOUNDS_LIKE, internalNote); + } + + + + public PurchaseOrderRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public PurchaseOrderRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public PurchaseOrderRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public PurchaseOrderRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.CREATE_TIME_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public PurchaseOrderRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public PurchaseOrderRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public PurchaseOrderRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public PurchaseOrderRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public PurchaseOrderRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public PurchaseOrderRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public PurchaseOrderRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.UPDATE_TIME_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public PurchaseOrderRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public PurchaseOrderRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public PurchaseOrderRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public PurchaseOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PurchaseOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PurchaseOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PurchaseOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.VERSION_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PurchaseOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PurchaseOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PurchaseOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PurchaseOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PurchaseOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PurchaseOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PurchaseOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.ID_PROPERTY, orderItemRequest, OrderItem.PURCHASE_ORDER_PROPERTY)); + } + + public PurchaseOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(PurchaseOrder.ID_PROPERTY, orderItemRequest, OrderItem.PURCHASE_ORDER_PROPERTY))); + } + + public PurchaseOrderRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PurchaseOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PurchaseOrderRequest groupByTenantWithDetails(){ + return groupByTenantWithDetails(Q.tenants().unlimited()); + } + + public PurchaseOrderRequest groupByTenantWithDetails(TenantRequest subRequest){ + aggregate(PurchaseOrder.TENANT_PROPERTY, subRequest); + return this; + } + + + + + + + public PurchaseOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public PurchaseOrderRequest groupById(){ + groupBy(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdAs(String retName){ + groupBy(retName, PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.ID_PROPERTY, function); + return this; + } + public PurchaseOrderRequest groupByTenantWith(TenantRequest subRequest){ + groupBy(PurchaseOrder.TENANT_PROPERTY, subRequest); + return this; + } + public PurchaseOrderRequest groupByTenant(){ + groupBy(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByTenantAs(String retName){ + groupBy(retName, PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByTenantWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.TENANT_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByContactPhone(){ + groupBy(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByContactPhoneAs(String retName){ + groupBy(retName, PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByContactPhoneWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.CONTACT_PHONE_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByInternalNote(){ + groupBy(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByInternalNoteAs(String retName){ + groupBy(retName, PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByInternalNoteWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.INTERNAL_NOTE_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByCreateTime(){ + groupBy(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByCreateTimeAs(String retName){ + groupBy(retName, PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.CREATE_TIME_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByUpdateTime(){ + groupBy(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.UPDATE_TIME_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByVersion(){ + groupBy(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionAs(String retName){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY, function); + return this; + } + + + + public PurchaseOrderRequest orderByIdAscending(){ + addOrderByAscending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByIdDescending(){ + addOrderByDescending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByTenantAscending(){ + addOrderByAscending(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByTenantDescending(){ + addOrderByDescending(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByContactPhoneAscending(){ + addOrderByAscending(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByContactPhoneDescending(){ + addOrderByDescending(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByContactPhoneAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByContactPhoneDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByInternalNoteAscending(){ + addOrderByAscending(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByInternalNoteDescending(){ + addOrderByDescending(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByInternalNoteAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByInternalNoteDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByCreateTimeAscending(){ + addOrderByAscending(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByCreateTimeDescending(){ + addOrderByDescending(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByUpdateTimeAscending(){ + addOrderByAscending(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByUpdateTimeDescending(){ + addOrderByDescending(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByVersionAscending(){ + addOrderByAscending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByVersionDescending(){ + addOrderByDescending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + + public PurchaseOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public PurchaseOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public TenantRequest rollUpToTenant(){ + TenantRequest tenant = Q.tenants().unlimited(); + this.withTenantMatching(tenant) + .groupByTenantWith(tenant); + return tenant; + } + + + + + + + public PurchaseOrderRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.PURCHASE_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.PURCHASE_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest minUnitPriceOfOrderItems(){ + addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest minUnitPriceOfOrderItemsAs(String name){ + return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest maxUnitPriceOfOrderItems(){ + addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest maxUnitPriceOfOrderItemsAs(String name){ + return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest sumUnitPriceOfOrderItems(){ + addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest sumUnitPriceOfOrderItemsAs(String name){ + return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest avgUnitPriceOfOrderItems(){ + addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest avgUnitPriceOfOrderItemsAs(String name){ + return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ + return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ + return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ + return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest facetByTenantAs(String facetName, TenantRequest tenant){ + return facetByTenantAs(facetName, tenant, true); + } + + public PurchaseOrderRequest facetByTenantAs(String facetName, TenantRequest tenant, boolean includeAllFacets){ + addFacet(facetName, PurchaseOrder.TENANT_PROPERTY, tenant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTenantAs", facetName, PurchaseOrder.TENANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public PurchaseOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PurchaseOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PurchaseOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PurchaseOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PurchaseOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PurchaseOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java new file mode 100644 index 000000000..1fd71c084 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java @@ -0,0 +1,144 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Tenant extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Tenant"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "85c7e7a1c8e2088fabba9ff66843736d36af1abc05a96ca7c72123129cf55183"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "purchase_order_list", "order_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Tenant.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String PURCHASE_ORDER_LIST_PROPERTY = "purchase_order_list"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + private String name; + + private SmartList purchaseOrderList; + private SmartList orderItemList; + + public String getName(){ + return this.name; + } + + public SmartList getPurchaseOrderList(){ + return this.purchaseOrderList; + } + public SmartList getOrderItemList(){ + return this.orderItemList; + } + public Tenant updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Tenant addPurchaseOrder(PurchaseOrder purchaseOrder){ + if (purchaseOrder == null){ + return this; + } + + if(null == this.purchaseOrderList){ + this.purchaseOrderList = new SmartList<>(); + } + + this.purchaseOrderList.add(purchaseOrder); + purchaseOrder.cacheRelation(PurchaseOrder.TENANT_PROPERTY, this); + return this; + } + public Tenant addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + this.orderItemList = new SmartList<>(); + } + + this.orderItemList.add(orderItem); + orderItem.cacheRelation(OrderItem.TENANT_PROPERTY, this); + return this; + } + + public static Tenant refer(Long id){ + Tenant refer = new Tenant(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Tenant comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "purchase_order_list": this.purchaseOrderList = (SmartList) value; break; + case "order_item_list": this.orderItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "purchase_order_list": return this.purchaseOrderList; + case "order_item_list": return this.orderItemList; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java new file mode 100644 index 000000000..38973dd24 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java @@ -0,0 +1,58 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemChecker; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class TenantChecker implements Checker{ + + public String type(){ + return Tenant.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + if(needCheck(_context, tenant)){ + markAsChecked(_context, tenant); + doCheck(_context, tenant, _parentLocation); + } + } + + public void doCheck(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + if((tenant == null)){ + return; + } + if(tenant.needPersist()){ + } + if(tenant.newItem()){ + }else if(tenant.updateItem()){ + if(!tenant.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, tenant.getProperty(Tenant.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; tenant.getPurchaseOrderList() != null && i < tenant.getPurchaseOrderList().size(); i++){ + PurchaseOrder purchaseOrder = tenant.getPurchaseOrderList().get(i); + new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, newLocation(_parentLocation, "purchase_order_list", i)); + } + for(int i = 0; tenant.getOrderItemList() != null && i < tenant.getOrderItemList().size(); i++){ + OrderItem orderItem = tenant.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, name); + maxStringCheck(_context, _parentLocation, 80, name); + + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java new file mode 100644 index 000000000..1f1109d3b --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java @@ -0,0 +1,59 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemListExpression; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class TenantExpression extends ExpressionAdaptor implements BaseEntityExpression { + public TenantExpression(Expression expression){ + super(expression); + } + + public TenantExpression(Expression expression, Function function){ + super(expression, function); + } + + public TenantExpression updateId(Long id){ + return new TenantExpression(this, $it -> {((Tenant)$it).__internalSet("id", id); return this;}); + } + + public TenantExpression save(UserContext userContext){ + return new TenantExpression(this, $it -> ((Tenant)$it).auditAs("Saved by Expression").save(userContext)); + } + + public TenantExpression save(String intent, UserContext userContext){ + return new TenantExpression(this, $it -> ((Tenant)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Tenant::getName); + } + public TenantExpression updateName(String name){ + return new TenantExpression(this, $it -> ((Tenant)$it).updateName(name)); + } + + public PurchaseOrderListExpression getPurchaseOrderList(){ + return new PurchaseOrderListExpression(loaded("purchase_order_list", "getPurchaseOrderList", Tenant::getPurchaseOrderList)); + } + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", Tenant::getOrderItemList)); + } + public TenantExpression addPurchaseOrder(PurchaseOrder purchaseOrder){ + return new TenantExpression(this, $it -> ((Tenant)$it).addPurchaseOrder(purchaseOrder)); + } + public TenantExpression addOrderItem(OrderItem orderItem){ + return new TenantExpression(this, $it -> ((Tenant)$it).addOrderItem(orderItem)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java new file mode 100644 index 000000000..e808ab0ae --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class TenantListExpression extends SmartListExpression { + public TenantListExpression(Expression> expression){ + super(expression); + } + + public TenantListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public TenantExpression first() { + return new TenantExpression(super.first()); + } + + public TenantExpression get(int index) { + return new TenantExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java new file mode 100644 index 000000000..f481fff40 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java @@ -0,0 +1,791 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemRequest; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; + +public class TenantRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public TenantRequest(Class returnType){ + this(returnType, () -> (T) new Tenant()); + } + + protected TenantRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public TenantRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public TenantRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public TenantRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public TenantRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public TenantRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public TenantRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public TenantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public TenantRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public TenantRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public TenantRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public TenantRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (TenantRequest)super.appendSearchCriteria(searchCriteria); + } + + public TenantRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public TenantRequest matchingAnyOf(TenantRequest tenant){ + super.internalMatchAny(tenant); + return this; + } + + public TenantRequest enhanceChildrenIfNeeded(){ + return this; + } + + public TenantRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public TenantRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public TenantRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public TenantRequest selectSelfFields(){ + return selectSelf(); + } + + public TenantRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Tenant.ID_PROPERTY); + selectProperty(Tenant.NAME_PROPERTY); + selectProperty(Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public TenantRequest selectChildren(){ + super.selectAny(); + selectPurchaseOrderList().selectOrderItemList(); + return selectId().selectName().selectVersion(); + } + + + public TenantRequest selectId(){ + selectProperty(Tenant.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TenantRequest unselectId(){ + unselectProperty(Tenant.ID_PROPERTY); + return this; + } + public TenantRequest selectName(){ + selectProperty(Tenant.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TenantRequest unselectName(){ + unselectProperty(Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest selectVersion(){ + selectProperty(Tenant.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TenantRequest unselectVersion(){ + unselectProperty(Tenant.VERSION_PROPERTY); + return this; + } + public TenantRequest selectPurchaseOrderList(){ + return selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()); + } + + public TenantRequest selectPurchaseOrderListWith(PurchaseOrderRequest purchaseOrderList){ + enhanceRelation(Tenant.PURCHASE_ORDER_LIST_PROPERTY, purchaseOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderListWith", null, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + public TenantRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public TenantRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(Tenant.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Tenant.ID_PROPERTY, operator, values); + } + + public TenantRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public TenantRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public TenantRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public TenantRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public TenantRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public TenantRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public TenantRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public TenantRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Tenant.NAME_PROPERTY, operator, values); + } + + public TenantRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public TenantRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public TenantRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public TenantRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public TenantRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public TenantRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public TenantRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public TenantRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public TenantRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public TenantRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public TenantRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public TenantRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public TenantRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public TenantRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public TenantRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public TenantRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public TenantRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public TenantRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public TenantRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public TenantRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Tenant.VERSION_PROPERTY, operator, values); + } + + public TenantRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public TenantRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public TenantRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public TenantRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public TenantRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public TenantRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public TenantRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public TenantRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public TenantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public TenantRequest withPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.TENANT_PROPERTY)); + } + + public TenantRequest withoutPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.TENANT_PROPERTY))); + } + + public TenantRequest havePurchaseOrders(){ + return withPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + + public TenantRequest haveNoPurchaseOrders(){ + return withoutPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + public TenantRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, orderItemRequest, OrderItem.TENANT_PROPERTY)); + } + + public TenantRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, orderItemRequest, OrderItem.TENANT_PROPERTY))); + } + + public TenantRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public TenantRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + + public TenantRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public TenantRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public TenantRequest groupByPurchaseOrdersWithDetails(PurchaseOrderRequest subRequest){ + aggregate(Tenant.PURCHASE_ORDER_LIST_PROPERTY, subRequest); + return this; + } + public TenantRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(Tenant.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public TenantRequest groupById(){ + groupBy(Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest groupByIdAs(String retName){ + groupBy(retName, Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Tenant.ID_PROPERTY, function); + return this; + } + + public TenantRequest groupByName(){ + groupBy(Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest groupByNameAs(String retName){ + groupBy(retName, Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Tenant.NAME_PROPERTY, function); + return this; + } + + public TenantRequest groupByVersion(){ + groupBy(Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest groupByVersionAs(String retName){ + groupBy(retName, Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Tenant.VERSION_PROPERTY, function); + return this; + } + + + + public TenantRequest orderByIdAscending(){ + addOrderByAscending(Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest orderByIdDescending(){ + addOrderByDescending(Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest orderByNameAscending(){ + addOrderByAscending(Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest orderByNameDescending(){ + addOrderByDescending(Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest orderByVersionAscending(){ + addOrderByAscending(Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest orderByVersionDescending(){ + addOrderByDescending(Tenant.VERSION_PROPERTY); + return this; + } + + + public TenantRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(name, subRequest, false); + } + + public TenantRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, PurchaseOrder.TENANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPurchaseOrdersAs", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public TenantRequest statsFromPurchaseOrders(PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(REFINEMENTS, subRequest); + } + public TenantRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public TenantRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public TenantRequest countPurchaseOrders(){ + addRelationCount("Count", Q.purchaseOrders().unlimited(), PurchaseOrder.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrders", null, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public TenantRequest countPurchaseOrdersAs(String name){ + addRelationCount(name, Q.purchaseOrders().unlimited(), PurchaseOrder.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersAs", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public TenantRequest countPurchaseOrdersWith(String name, PurchaseOrderRequest subRequest){ + addRelationCount(name, subRequest, PurchaseOrder.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersWith", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + public TenantRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest minUnitPriceOfOrderItems(){ + addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest minUnitPriceOfOrderItemsAs(String name){ + return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest maxUnitPriceOfOrderItems(){ + addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest maxUnitPriceOfOrderItemsAs(String name){ + return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest sumUnitPriceOfOrderItems(){ + addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest sumUnitPriceOfOrderItemsAs(String name){ + return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest avgUnitPriceOfOrderItems(){ + addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest avgUnitPriceOfOrderItemsAs(String name){ + return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest standardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ + return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest sampleVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ + return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest samplePopulationVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ + return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public TenantRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public TenantRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public TenantRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public TenantRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public TenantRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public TenantRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/fix-e-alignment/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..bba37cf30 --- /dev/null +++ b/examples/fix-e-alignment/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.checkerfixadvanced.EntityMetaRegistry \ No newline at end of file diff --git a/examples/fix-e-alignment/model.xml b/examples/fix-e-alignment/model.xml new file mode 100644 index 000000000..72bd684f7 --- /dev/null +++ b/examples/fix-e-alignment/model.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/examples/fix-e-alignment/owned-command.cjs b/examples/fix-e-alignment/owned-command.cjs new file mode 100644 index 000000000..8470e4157 --- /dev/null +++ b/examples/fix-e-alignment/owned-command.cjs @@ -0,0 +1,79 @@ +"use strict"; +// POSIX compiler/test runner. The detached group belongs only to this command; +// no service, shared cache or other session is a termination target. +const cp = require('node:child_process'); +const fs = require('node:fs'), path = require('node:path'); +const delay = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds)); +function alive(pid) { + try { process.kill(-pid, 0); return true; } + catch (error) { if (error.code === 'ESRCH') return false; throw error; } +} +function signal(pid, name) { + if (!pid) return; + try { process.kill(-pid, name); } + catch (error) { if (error.code !== 'ESRCH') throw error; } +} +function createOwnedRunner() { + let active, interrupted, unsafeGroup, killer; + const terminateActive = () => { + if (!active?.pid) return; + signal(active.pid, 'SIGTERM'); + killer ||= setTimeout(() => { if (active?.pid) signal(active.pid, 'SIGKILL'); }, 500); + }; + const cancel = name => { + interrupted ||= name; + terminateActive(); + }; + const onInt = () => cancel('SIGINT'), onTerm = () => cancel('SIGTERM'); + process.on('SIGINT', onInt); process.on('SIGTERM', onTerm); + return { + get interrupted() { return interrupted; }, + get unsafeGroup() { return unsafeGroup; }, + get safeToClean() { return !active && !unsafeGroup; }, + cancel, + async run(command, options) { + if (active) throw new Error('owned commands must be awaited, not overlapped'); + if (interrupted) return {status: interrupted === 'SIGINT' ? 130 : 143, signal: interrupted}; + let timedOut = false, timer; + const {timeout, ...spawnOptions} = options; + const child = cp.spawn(command[0], command.slice(1), {...spawnOptions, detached: true}); + active = child; + try { + const result = await new Promise(resolve => { + child.once('error', error => resolve({status: null, signal: null, error: error.message})); + child.once('close', (status, childSignal) => resolve({status, signal: childSignal})); + timer = setTimeout(() => { timedOut = true; terminateActive(); }, timeout); + }); + clearTimeout(timer); + // Reap the direct child and stop any compiler descendants which outlive + // it. Keep signal handlers installed until the complete owned group ends. + if (child.pid && alive(child.pid)) { + signal(child.pid, 'SIGTERM'); + for (let attempt = 0; attempt < 100 && alive(child.pid); attempt++) { + if (attempt === 10) signal(child.pid, 'SIGKILL'); + await delay(25); + } + if (alive(child.pid)) { unsafeGroup = child.pid; throw new Error('owned process group remains live: ' + child.pid); } + } + if (timedOut) return {...result, status: 124}; + if (interrupted) return {...result, status: interrupted === 'SIGINT' ? 130 : 143}; + return result; + } finally { clearTimeout(timer); clearTimeout(killer); killer = undefined; active = undefined; } + }, + dispose() { + if (active) throw new Error('cannot dispose a live owned command'); + process.off('SIGINT', onInt); process.off('SIGTERM', onTerm); + }, + }; +} +function ownedBytes(directory) { + const seen = new Set(); + function visit(file) { + const stat = fs.lstatSync(file), key = stat.dev + ':' + stat.ino; + if (seen.has(key)) return 0; + seen.add(key); + return stat.size + (stat.isDirectory() ? fs.readdirSync(file).reduce((sum, name) => sum + visit(path.join(file, name)), 0) : 0); + } + return visit(directory); +} +module.exports = {createOwnedRunner, alive, ownedBytes}; diff --git a/examples/fix-e-alignment/partial-ancestors/PartialAncestorExampleTest.java b/examples/fix-e-alignment/partial-ancestors/PartialAncestorExampleTest.java new file mode 100644 index 000000000..b49292779 --- /dev/null +++ b/examples/fix-e-alignment/partial-ancestors/PartialAncestorExampleTest.java @@ -0,0 +1,137 @@ +package io.teaql.examples.fixe; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.teaql.checkerfixadvanced.E; +import com.teaql.checkerfixadvanced.GeneratedRuntimeModule; +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import io.teaql.core.UserContext; +import io.teaql.core.businessid.BusinessClock; +import io.teaql.core.checker.CheckException; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; +import org.sqlite.SQLiteDataSource; +import org.junit.Test; +import static org.junit.Assert.*; + +/** A complete changed leaf below two untouched sparse ancestors; generated Q/E/save only. */ +public class PartialAncestorExampleTest { + static Tenant graph(UserContext context, Long orderId, boolean sparseLeaf) { + var leaf = sparseLeaf ? Q.orderItemsWithMinimalFields() : Q.orderItems(); + return Q.tenantsWithMinimalFields().withIdIs(1L) + .selectPurchaseOrderListWith(Q.purchaseOrdersWithMinimalFields().withIdIs(orderId) + .selectOrderItemListWith(leaf.orderByIdAscending().limit(10) + .comment("Load explicitly selected child records")) + .orderByIdAscending().limit(10).comment("Load the parent identity and its child list")) + .limit(1).comment("Load two sparse ancestors above an explicitly selected leaf") + .purpose("Only the modified entity must be complete before saving the graph") + .executeForOne(context); + } + + @Test public void completeModifiedLeafThroughUntouchedPartialAncestors() throws Exception { + var source = new SQLiteDataSource(); + source.setUrl("jdbc:sqlite:" + System.getenv("TEAQL_FIX_E_DB") + ".partial-ancestors.sqlite"); + var sql = new ExpressionBoundaryProbe.ObservedSql(source); + var ids = new IdSpaceIdGenerator(new GeneratedFixEExampleTest.DatabaseBridge(sql)); + ids.ensureIdSpaceTable(); + var clockValue = new AtomicReference<>(LocalDateTime.of(2032, 2, 29, 10, 15, 30)); + BusinessClock clock = new BusinessClock() { + public LocalDate businessDate(UserContext context) { return clockValue.get().toLocalDate(); } + public LocalDateTime businessDateTime(UserContext context) { return clockValue.get(); } + }; + var service = new SqliteDataServiceExecutor("sqlite", sql, source); + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(ids).businessClock(clock).build().install(GeneratedRuntimeModule.module()); + UserContext context = new GeneratedFixEExampleTest.Context(runtime); + context.ensureSchema(); + var order = Q.purchaseOrders().comment("Prepare a complete ancestor control") + .purpose("Exercise partial graph traversal against real SQLite").newEntity(context); + order.updateContactPhone("5550600"); order.updateInternalNote(null); + var item = Q.orderItems().comment("Prepare a complete leaf control") + .purpose("Persist the graph only through generated audited saves").newEntity(context); + item.updatePurchaseOrder(order); item.updateProductName("Partial graph original"); + item.updateUnitPrice(new BigDecimal("10.00")); + item.auditAs("Create the complete partial-ancestor fixture").save(context); + assertEquals(Long.valueOf(1), E.purchaseOrder(order).getVersion().eval()); + assertEquals(Long.valueOf(1), E.orderItem(item).getVersion().eval()); + + var root = graph(context, order.getId(), false); + var parent = E.tenant(root).getPurchaseOrderList().first().eval(); + var leaf = E.purchaseOrder(parent).getOrderItemList().first().eval(); + assertNotNull(parent); assertNotNull(leaf); + assertEquals(item.getId(), E.orderItem(leaf).getId().eval()); + int before = sql.calls.get(); + var rootState = root.__internalLoadState(); var parentState = parent.__internalLoadState(); + assertThrows(TeaQLNotLoadedException.class, () -> E.tenant(root).getName().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(parent).getContactPhone().eval()); + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context)) + .registerModule(new JavaTimeModule()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + var json = mapper.readTree(mapper.writeValueAsString(root)); + assertFalse(json.has("name")); + assertFalse(json.get("purchaseOrderList").get(0).has("contactPhone")); + assertEquals(before, sql.calls.get()); + assertSame(rootState, root.__internalLoadState()); assertSame(parentState, parent.__internalLoadState()); + var cases = new ArrayList(); + cases.add("partial-ancestor-guards-and-JSON-no-I/O"); + + var createdAt = E.orderItem(leaf).getCreateTime().eval(); + var changedAt = clockValue.get().plusDays(1); clockValue.set(changedAt); + leaf.updateProductName("Partial graph updated"); + before = sql.calls.get(); + root.auditAs("Save a complete modified descendant through untouched sparse ancestors").save(context); + assertTrue("Successful save must calibrate the actual provider observer", sql.calls.get() > before); + assertSame(rootState, root.__internalLoadState()); assertSame(parentState, parent.__internalLoadState()); + assertThrows(TeaQLNotLoadedException.class, () -> E.tenant(root).getName().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.purchaseOrder(parent).getContactPhone().eval()); + assertEquals(Long.valueOf(1), E.tenant(root).getVersion().eval()); + assertEquals(Long.valueOf(1), E.purchaseOrder(parent).getVersion().eval()); + var stored = Q.orderItems().withIdIs(item.getId()).limit(1) + .comment("Read back the modified complete leaf").purpose("Verify actual graph persistence").executeForOne(context); + assertEquals("Partial graph updated", E.orderItem(stored).getProductName().eval()); + assertEquals(Long.valueOf(2), E.orderItem(stored).getVersion().eval()); + assertEquals(createdAt, E.orderItem(stored).getCreateTime().eval()); + assertEquals(changedAt, E.orderItem(stored).getUpdateTime().eval()); + cases.add("complete-leaf-saved-through-two-untouched-partial-ancestors"); + + var sparseRoot = graph(context, order.getId(), true); + var sparseParent = E.tenant(sparseRoot).getPurchaseOrderList().first().eval(); + var sparseLeaf = E.purchaseOrder(sparseParent).getOrderItemList().first().eval(); + sparseLeaf.updateProductName("Rejected partial leaf"); + var rejections = new ArrayList(); + for (int attempt = 0; attempt < 2; attempt++) { + before = sql.calls.get(); + var error = assertThrows(CheckException.class, + () -> sparseRoot.auditAs("Reject an incomplete modified descendant").save(context)); + assertEquals("Rejection must happen before any provider entry", before, sql.calls.get()); + assertFalse(error.getViolates().isEmpty()); + assertEquals("Rejected partial leaf", E.orderItem(sparseLeaf).getProductName().eval()); + assertEquals(Long.valueOf(2), E.orderItem(sparseLeaf).getVersion().eval()); + assertTrue(sparseLeaf.getUpdatedProperties().contains("product_name")); + rejections.add(error.getViolates().stream().map(v -> v.toWire(JsonFieldNamingProfile.CAMEL_CASE)).toList()); + } + stored = Q.orderItems().withIdIs(item.getId()).limit(1) + .comment("Read after both rejected save attempts").purpose("Verify no partial writes or version bump").executeForOne(context); + assertEquals("Partial graph updated", E.orderItem(stored).getProductName().eval()); + assertEquals(Long.valueOf(2), E.orderItem(stored).getVersion().eval()); + cases.add("partial-leaf-rejected-twice-before-provider-with-intent-retained"); + System.out.println("JAVA_PARTIAL_ANCESTORS_RESULT=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "cases", cases, "orderId", order.getId(), "leafId", item.getId(), + "ancestorVersions", List.of(1, 1), "leafVersion", 2, "rejections", rejections, + "calibratedProvider", true, "generatedImplementationsModified", false))); + } +} diff --git a/examples/fix-e-alignment/partial-ancestors/README.md b/examples/fix-e-alignment/partial-ancestors/README.md new file mode 100644 index 000000000..0dee7cbd7 --- /dev/null +++ b/examples/fix-e-alignment/partial-ancestors/README.md @@ -0,0 +1,45 @@ +# Saving a complete descendant through sparse ancestors + +Run the regular source-paired example from the runtime repository: + +```bash +node examples/fix-e-alignment/verify-local.cjs +``` + +`PartialAncestorExampleTest` uses the unchanged three-entity model and generated +Q/E APIs. The query explicitly loads Tenant → PurchaseOrder → OrderItem, with +identity-only ancestors and a complete leaf. Only the leaf is changed; saving +the root must persist that leaf without loading or updating either ancestor. + +The same test checks that JSON omits unselected fields and that E raises +NotLoaded without provider access. Modifying an identity-only leaf must reject +twice before provider entry, retain the pending mutation, and leave stored values +and versions unchanged. Business time comes from an injected BusinessClock. + +Both this test and the original Fix/E suite run twice on their respective +unchanged SQLite databases. The verifier checks generated-fixture hashes, uses a +disposable source-paired Maven reactor, and retains compact logs and databases +while removing owned build output. It does not install or publish runtime jars. + +The additional JSON dependencies belong to this test consumer, not the domain +library. No generated implementation or production runtime code is modified. + +## Active-root admission below sparse ancestors + +`PartialAncestorRootExampleTest` loads the same two sparse ancestors and a +complete OrderItem, then changes only the child's product name. Saving the graph +with a different existing Tenant as the active root must reject twice with +`ContextRootException.VALUE_MISMATCH`. Both attempts assert zero provider queries, +writes, transactions, ID allocations, policies, reviews, audit records and root +lookups. The independent read-only SQLite oracle checks that stored rows are +unchanged, while the pending child mutation and both ancestors' load states +remain intact. + +The test then saves that exact graph with its correct context. One audited child +update succeeds; both ancestors retain version 1 and their unselected fields, +and a generated Q/E read confirms the child value and version 2. Each verifier +run executes this scenario twice against the same retained SQLite database. + +This is a parent/child ownership case, not proof of cyclic or repeated-reference +graph traversal. Those cases require a separately supported relationship API and +their own tests; the retained Assist used here does not expose that operation. diff --git a/examples/fix-e-alignment/verify-local.cjs b/examples/fix-e-alignment/verify-local.cjs new file mode 100644 index 000000000..48aaf2141 --- /dev/null +++ b/examples/fix-e-alignment/verify-local.cjs @@ -0,0 +1,202 @@ +#!/usr/bin/env node +"use strict"; +// Source-paired reactor: no shared Maven install/deploy and no generator needed. +const fs = require("node:fs"), path = require("node:path"), os = require("node:os"), cp = require("node:child_process"), crypto = require("node:crypto"), assert = require("node:assert/strict"); +const example = __dirname, repo = path.resolve(example, "../.."), sha = bytes => crypto.createHash("sha256").update(bytes).digest("hex"); +assert(process.argv.length===2 || process.argv.length===3 && process.argv[2]==='--original-ledger'); +const originalLedgerOnly=process.argv[2]==='--original-ledger'; +function fingerprint() { + const m = JSON.parse(fs.readFileSync(path.join(example, "fixture-manifest.json"))); + assert.equal(m.language, "java"); assert.equal(m.evaluationErrors, 0); + assert.equal(sha(fs.readFileSync(path.join(example, "model.xml"))), m.modelSha256); + const actual = []; + function walk(dir, prefix = "") { for (const e of fs.readdirSync(dir, {withFileTypes: true})) { + const name = path.join(prefix, e.name), file = path.join(dir, e.name); assert(!e.isSymbolicLink()); + if (e.isDirectory()) walk(file, name); else { assert(e.isFile()); actual.push(name); } + } } + walk(path.join(example, "generated")); assert.deepEqual(actual.sort(), Object.keys(m.files).sort()); + for (const [name, expected] of Object.entries(m.files)) assert.equal(sha(fs.readFileSync(path.join(example, "generated", name))), expected, name); + return m; +} +const requested = process.env.TEAQL_FIX_E_EVIDENCE_DIR; +const evidence = requested ? path.resolve(requested) : fs.mkdtempSync(path.join(os.tmpdir(), "teaql-java-fix-e-evidence-")); +if (requested) { assert(path.isAbsolute(requested) && !fs.existsSync(evidence)); fs.mkdirSync(evidence, {recursive: true}); } +const scratch = fs.mkdtempSync(path.join(os.tmpdir(), "teaql-java-fix-e-build-")); +const report = {schema: "teaql.java-fix-e-example/v1", passed: false, rounds: [], sameDatabase: true, + localRuntime: repo, databaseRetained: true, sharedMavenInstall: false}; +report.contextRootApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ContextRootProbe.java'))); +report.contextRootSubtypeApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ContextRootSubtypeProbe.java'))); +report.partialAncestorApplicationSha256 = sha(fs.readFileSync(path.join(example, 'partial-ancestors/PartialAncestorExampleTest.java'))); +report.postFixApplicationSha256 = sha(fs.readFileSync(path.join(example, 'PostFixExampleTest.java'))); +report.partialAncestorRootApplicationSha256 = sha(fs.readFileSync(path.join(example, 'PartialAncestorRootExampleTest.java'))); +report.newEntityIdApplicationSha256 = sha(fs.readFileSync(path.join(example, 'NewEntityIdExampleTest.java'))); +report.checkerBoundaryApplicationSha256 = sha(fs.readFileSync(path.join(example, 'CheckerBoundaryExampleTest.java'))); +report.reviewedPlanApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ReviewedPlanExampleTest.java'))); +report.mixedGraphApplicationSha256 = sha(fs.readFileSync(path.join(example, 'MixedGraphExampleTest.java'))); +report.concurrentQueryApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ConcurrentQueryExampleTest.java'))); +report.requestIntentApplicationSha256 = sha(fs.readFileSync(path.join(example, 'RequestIntentExampleTest.java'))); +report.cancelledNewGraphApplicationSha256 = sha(fs.readFileSync(path.join(example, 'CancelledNewGraphExampleTest.java'))); +report.originalLedgerApplicationSha256 = sha(fs.readFileSync(path.join(example, 'OriginalLedgerExampleTest.java'))); +report.originalLedgerRounds=[]; +const {createOwnedRunner, ownedBytes} = require('./owned-command.cjs'), runner = createOwnedRunner(); +async function main() { +try { + const disk = fs.statfsSync(scratch); assert(disk.bavail * disk.bsize > 8 * 1024 ** 3); + const m = fingerprint(); report.modelSha256 = m.modelSha256; + const runtime = path.join(scratch, "source"), generated = path.join(scratch, "generated"), consumer = path.join(scratch, "consumer"), reactor = path.join(scratch, "reactor"); + const sourceFiles = cp.execFileSync("git", ["-C", repo, "ls-files", "-z", "--cached", "--others", "--exclude-standard"]).toString().split("\0").filter(Boolean); + for (const file of new Set(sourceFiles)) { + const from = path.join(repo, file); if (!fs.existsSync(from)) continue; + assert(fs.lstatSync(from).isFile(), "source copy requires regular files"); + fs.mkdirSync(path.dirname(path.join(runtime, file)), {recursive: true}); fs.copyFileSync(from, path.join(runtime, file)); + } + fs.cpSync(path.join(example, "generated/lib"), generated, {recursive: true}); + report.libraryMetadata = require('../../scripts/pin-local-example-pom.cjs').pin(path.join(generated, 'pom.xml'), repo, scratch); + fs.mkdirSync(path.join(consumer, "src/test/java/io/teaql/examples/fixe"), {recursive: true}); + for (const file of fs.readdirSync(example).filter(file => file.endsWith(".java"))) + fs.copyFileSync(path.join(example, file), path.join(consumer, "src/test/java/io/teaql/examples/fixe", file)); + fs.copyFileSync(path.join(example, 'partial-ancestors/PartialAncestorExampleTest.java'), + path.join(consumer, 'src/test/java/io/teaql/examples/fixe/PartialAncestorExampleTest.java')); + const version = fs.readFileSync(path.join(repo, "pom.xml"), "utf8").match(/([^<]+)<\/version>/)[1]; + const pom = `4.0.0 + io.teaqlteaql-java-parent${version}../source/pom.xml + io.teaql.examplesteaql-fix-e-example${version} + + com.teaqlchecker-fix-advanced-core0.0.1-SNAPSHOT + io.teaqlteaql-runtime${version} + io.teaqlteaql-sqlite${version} + io.teaqlteaql-jackson${version} + io.teaqlteaql-tfp-endpoint${version} + com.fasterxml.jackson.datatypejackson-datatype-jsr310test + junitjunit4.13.2test + org.apache.maven.pluginsmaven-surefire-pluginfalse`; + fs.writeFileSync(path.join(consumer, "pom.xml"), pom); fs.writeFileSync(path.join(evidence, "consumer-pom.xml"), pom); + fs.mkdirSync(reactor); + fs.writeFileSync(path.join(reactor, "pom.xml"), '4.0.0io.teaql.testfix-e-reactor0.0.0pom../source../generated../consumer'); + for (const round of [1, 2]) { + const command = ['mvn', '-o', '-B', '-ntp', '-f', path.join(reactor, 'pom.xml'), '-pl', ':teaql-fix-e-example', '-am', 'test', + originalLedgerOnly ? '-Dtest=OriginalLedgerExampleTest' : '-Dtest=GeneratedFixEExampleTest,PartialAncestorExampleTest,PartialAncestorRootExampleTest,PostFixExampleTest,NewEntityIdExampleTest,CheckerBoundaryExampleTest,ReviewedPlanExampleTest,MixedGraphExampleTest,ConcurrentQueryExampleTest,RequestIntentExampleTest,CancelledNewGraphExampleTest,OriginalLedgerExampleTest', '-Dsurefire.failIfNoSpecifiedTests=false', '-Dteaql.version=' + version, + '-Dteaql.expected.runtime.root=' + runtime]; + const log = path.join(evidence, 'round-' + round + '.log'), fd = fs.openSync(log, 'w'); let result; + try { result = await runner.run(command, {cwd: scratch, timeout: 300000, + env: {...process.env, TEAQL_FIX_E_DB: path.join(evidence, 'fixture.sqlite'), TEAQL_FIX_E_ROUND: String(round)}, stdio: ['ignore', fd, fd]}); } + finally { fs.closeSync(fd); } + const bytes = fs.readFileSync(log); + report.rounds.push({command, exitCode: result.status, signal: result.signal, logSha256: sha(bytes)}); + // Retain compact, named test outcomes before disposing this consumer. This + // also keeps useful diagnostics when Maven fails; no build tree is retained. + const reports = path.join(consumer, 'target/surefire-reports'); + report.rounds.at(-1).junit = []; + if (fs.existsSync(reports)) for (const name of fs.readdirSync(reports).filter(name => /^TEST-.+\.xml$/.test(name)).sort()) { + const content = fs.readFileSync(path.join(reports, name)), relative = path.join('junit', 'round-' + round, name); + fs.mkdirSync(path.dirname(path.join(evidence, relative)), {recursive: true}); + fs.writeFileSync(path.join(evidence, relative), content, {flag: 'wx'}); + report.rounds.at(-1).junit.push({file: relative, sha256: sha(content)}); + } + if (result.status !== 0) process.exitCode = result.status || 1; + assert.equal(result.status, 0, bytes.toString().slice(-12000)); + const original=[...bytes.toString().matchAll(/^JAVA_ORIGINAL_LEDGER_CASE=(.+)$/gm)].map(v=>JSON.parse(v[1])); + assert.deepEqual(original.map(v=>v.case).sort(),['ML-01','ML-02','ML-03','ML-04','ML-05','ML-06','ML-07']); + assert(original.every(v=>v.passed&&v.round===round));report.originalLedgerRounds.push({round,cases:original}); + if(originalLedgerOnly) { + assert.match(bytes.toString(),/^\[INFO\] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, .* -- in io\.teaql\.examples\.fixe\.OriginalLedgerExampleTest$/m); + assert.equal(report.rounds.at(-1).junit.length,1);assert.deepEqual(fingerprint(),m);continue; + } + const expected = {GeneratedFixEExampleTest: 1, PartialAncestorExampleTest: 1, + PartialAncestorRootExampleTest: 1, PostFixExampleTest: 3, NewEntityIdExampleTest: 1, CheckerBoundaryExampleTest: 1, ReviewedPlanExampleTest: 6, MixedGraphExampleTest: 3, ConcurrentQueryExampleTest: 1, RequestIntentExampleTest: 1, CancelledNewGraphExampleTest: 1, OriginalLedgerExampleTest: 1}; + assert.deepEqual(fs.readdirSync(path.join(consumer, 'src/test/java/io/teaql/examples/fixe')) + .filter(name => name.endsWith('Test.java')).map(name => name.slice(0, -5)).sort(), Object.keys(expected).sort(), + 'every authored example Test must be selected and verified'); + const summaries = [...bytes.toString().matchAll(/^\[INFO\] Tests run: (\d+), Failures: (\d+), Errors: (\d+), Skipped: (\d+), .* -- in io\.teaql\.examples\.fixe\.([A-Za-z]+)$/gm)]; + assert.deepEqual(summaries.map(row => row[5]).sort(), Object.keys(expected).sort()); + for (const row of summaries) assert.deepEqual(row.slice(1, 5).map(Number), [expected[row[5]], 0, 0, 0]); + assert.match(bytes.toString(), /^\[INFO\] Tests run: 21, Failures: 0, Errors: 0, Skipped: 0$/m); + const cancellations = bytes.toString().split(/\r?\n/).filter(line => line.startsWith('JAVA_CANCELLED_NEW_GRAPH_CASE=')) + .map(line => JSON.parse(line.slice('JAVA_CANCELLED_NEW_GRAPH_CASE='.length))); + assert.deepEqual(cancellations.map(v => v.case).sort(), ['root', 'complete-child', 'incomplete-child', 'composed-child', 'invalid-live-sibling'].sort()); + assert(cancellations.every(v => v.passed && v.generatedQAndE && v.cancelledRowAbsent && v.round === round)); + for (const v of cancellations) assert.deepEqual([v.mutations, v.audits], ['root','invalid-live-sibling'].includes(v.case) ? [0,0] : [2,2]); + const admission=bytes.toString().split(/\r?\n/).filter(line=>line.startsWith('JAVA_REQUEST_ADMISSION_CASE=')) + .map(line=>JSON.parse(line.slice('JAVA_REQUEST_ADMISSION_CASE='.length))); + assert.equal(admission.length,36);assert(admission.every(v=>v.passed&&v.round===round)); + assert(bytes.toString().includes('JAVA_REQUEST_ADMISSION_RESULT=')); + const concurrent = bytes.toString().split(/\r?\n/).filter(line => line.startsWith('JAVA_CONCURRENT_QUERY=')) + .map(line => JSON.parse(line.slice('JAVA_CONCURRENT_QUERY='.length))); + assert.equal(concurrent.length, 1); assert(concurrent[0].passed && concurrent[0].round === round); + assert.equal(concurrent[0].overlapEntered, 2); assert.equal(concurrent[0].events.length, 6); + const mixed = bytes.toString().split(/\r?\n/).filter(line => line.startsWith('JAVA_MIXED_GRAPH_CASE=')) + .map(line => JSON.parse(line.slice('JAVA_MIXED_GRAPH_CASE='.length))); + assert.deepEqual(mixed.map(row => row.case).sort(), ['commit', 'commit-failure', 'rollback']); + assert(mixed.every(row => row.passed && row.round === round && row.generatedQAndEReadback && row.readOnlySqlOracle && row.repeatedSaveIsNoOp)); + const reviewed = bytes.toString().split(/\r?\n/).filter(line => line.startsWith('JAVA_REVIEWED_SQLITE_CASE=')) + .map(line => JSON.parse(line.slice('JAVA_REVIEWED_SQLITE_CASE='.length))); + assert.deepEqual(reviewed.map(row => row.phase).sort(), ['NONE', 'POLICY', 'APPROVAL', 'WARNING', 'TRANSACTION', 'PROVIDER'].sort()); + assert(reviewed.every(row => row.passed && row.round === round && row.generatedQAndEReadback)); + const boundaries = bytes.toString().split(/\r?\n/).filter(line => line.startsWith('JAVA_CHECKER_BOUNDARY_CASE=')) + .map(line => JSON.parse(line.slice('JAVA_CHECKER_BOUNDARY_CASE='.length))); + assert.equal(boundaries.length, 26); assert(boundaries.every(row => row.passed && row.round === round)); + const boundaryResult = bytes.toString().split(/\r?\n/).filter(line => line.startsWith('JAVA_CHECKER_BOUNDARY_RESULT=')) + .map(line => JSON.parse(line.slice('JAVA_CHECKER_BOUNDARY_RESULT='.length))); + assert.equal(boundaryResult.length, 1); assert.equal(boundaryResult[0].passed, true); assert.equal(boundaryResult[0].round, round); + const postFix = bytes.toString().split(/\r?\n/).filter(line => line.startsWith('JAVA_POST_FIX_CASE=')) + .map(line => JSON.parse(line.slice('JAVA_POST_FIX_CASE='.length))); + assert.equal(postFix.length, 3); + assert.deepEqual(postFix.map(row => row.case).sort(), ['typed-defaults-preserve-business-input', + 'value-free-provenance-and-graph-once', 'post-fix-reject-zero-provider-and-retry'].sort()); + for (const row of postFix) assert.equal(row.passed, true); + for (const marker of ['FIX_E_EXAMPLE=', 'CORE_LOAD_EXAMPLE=', 'CORE_MUTATION_OWNERSHIP=', 'CORE_MUTATION_PAGING=', 'JAVA_E_BOUNDARY_RESULT=', 'JAVA_CONTEXT_ROOT_RESULT=', 'JAVA_CONTEXT_ROOT_SUBTYPE_RESULT=', 'JAVA_PARTIAL_ANCESTORS_RESULT=', 'JAVA_PARTIAL_ANCESTOR_ROOT_RESULT=', 'JAVA_NEW_ENTITY_ID_RESULT=']) { + const values = bytes.toString().split(/\r?\n/).filter(line => line.startsWith(marker)).map(line => JSON.parse(line.slice(marker.length))); + assert.equal(values.length, 1, marker); assert.equal(values[0].passed, true, marker); + } + assert.deepEqual(fingerprint(), m); + } + const originalFile='fixture.sqlite.original-ledger.sqlite'; + report.originalLedgerDatabase={file:originalFile,sha256:sha(fs.readFileSync(path.join(evidence,originalFile)))}; + if(originalLedgerOnly){report.passed=true;console.log('PASS Java original ML-01..07 generated Q/E/save boundaries twice');return;} + report.databaseSha256 = sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite'))); + report.expressionBoundaryApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ExpressionBoundaryProbe.java'))); + report.expressionBoundaryDatabase = {file: 'fixture.sqlite.expression-boundaries.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.expression-boundaries.sqlite')))}; + report.contextRootApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ContextRootProbe.java'))); + report.contextRootDatabase = {file: 'fixture.sqlite.context-root.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.context-root.sqlite')))}; + report.contextRootSubtypeDatabase = {file: 'fixture.sqlite.root-subtype.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.root-subtype.sqlite')))}; + report.partialAncestorDatabase = {file: 'fixture.sqlite.partial-ancestors.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.partial-ancestors.sqlite')))}; + report.postFixDatabases = ['typed', 'evidence', 'rejection'].map(name => { + const file = 'fixture.sqlite.post-fix-' + name + '.sqlite'; + return {file, sha256: sha(fs.readFileSync(path.join(evidence, file)))}; + }); + report.partialAncestorRootDatabase = {file: 'fixture.sqlite.partial-ancestor-root.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.partial-ancestor-root.sqlite')))}; + report.newEntityIdDatabase = {file: 'fixture.sqlite.new-entity-id.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.new-entity-id.sqlite')))}; + report.checkerBoundaryDatabase = {file: 'fixture.sqlite.checker-boundaries.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.checker-boundaries.sqlite')))}; + report.reviewedPlanDatabases = ['none', 'policy', 'approval', 'warning', 'transaction', 'provider'].map(name => { + const file = 'fixture.sqlite.reviewed-plan-' + name + '.sqlite'; + return {file, sha256: sha(fs.readFileSync(path.join(evidence, file)))}; + }); + report.mixedGraphDatabases = ['commit', 'rollback', 'commit-failure'].map(name => { + const file = 'fixture.sqlite.mixed-graph-' + name + '.sqlite'; + return {file, sha256: sha(fs.readFileSync(path.join(evidence, file)))}; + }); + report.concurrentQueryDatabase = {file: 'fixture.sqlite.concurrent-query.sqlite', + sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.concurrent-query.sqlite')))}; + report.requestIntentDatabases=['off','on'].map(name=>{ + const file='fixture.sqlite.request-admission-'+name+'.sqlite';return{file,sha256:sha(fs.readFileSync(path.join(evidence,file)))}; + }); + report.passed = true; + console.log('PASS Java retained Fix/E/loading/ownership example twice on one database'); +} catch (error) { console.error(error.stack); process.exitCode ||= 1; } +finally { + report.disposedOwnedBytes = runner.safeToClean ? ownedBytes(scratch) : 0; + if (runner.safeToClean) fs.rmSync(scratch, {recursive: true}); + else report.unsafeBuildRetention = {path: scratch, processGroup: runner.unsafeGroup}; + report.scratchRemoved = !fs.existsSync(scratch); runner.dispose(); + fs.writeFileSync(path.join(evidence, 'receipt.json'), JSON.stringify(report, null, 2) + '\n'); + console.log('Retained compact example evidence: ' + evidence); +} +} +main().catch(error => { console.error(error.stack); process.exitCode ||= 1; }); diff --git a/examples/http-resilience/pom.xml b/examples/http-resilience/pom.xml index 3e4cf2780..bd8ba7119 100644 --- a/examples/http-resilience/pom.xml +++ b/examples/http-resilience/pom.xml @@ -1,6 +1,6 @@ 4.0.0 - io.teaqlteaql-java-parent1.555-RELEASE../../pom.xml + io.teaqlteaql-java-parent1.556-RELEASE../../pom.xml teaql-http-resilience-example io.teaqlteaql-runtime diff --git a/examples/http-resilience/src/test/java/io/teaql/examples/http/HttpResilienceExampleTest.java b/examples/http-resilience/src/test/java/io/teaql/examples/http/HttpResilienceExampleTest.java index 13950e818..b9e502817 100644 --- a/examples/http-resilience/src/test/java/io/teaql/examples/http/HttpResilienceExampleTest.java +++ b/examples/http-resilience/src/test/java/io/teaql/examples/http/HttpResilienceExampleTest.java @@ -18,6 +18,8 @@ import java.time.Duration; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; import static org.junit.Assert.*; @@ -28,39 +30,53 @@ public class HttpResilienceExampleTest { @Test public void postedRequestWithStalledResponseRequiresReconciliation() throws Exception { AtomicInteger requests = new AtomicInteger(); + CountDownLatch received = new CountDownLatch(1), release = new CountDownLatch(1); HttpServer server = HttpServer.create(new InetSocketAddress( InetAddress.getByAddress(new byte[] {127, 0, 0, 1}), 0), 0); server.createContext("/api/payments", exchange -> { requests.incrementAndGet(); assertEquals("POST", exchange.getRequestMethod()); exchange.getRequestBody().readAllBytes(); + received.countDown(); exchange.sendResponseHeaders(200, 2); try (var output = exchange.getResponseBody()) { output.write('x'); output.flush(); - try { Thread.sleep(1200); } catch (InterruptedException interrupted) { + try { release.await(15, TimeUnit.SECONDS); } catch (InterruptedException interrupted) { Thread.currentThread().interrupt(); } } catch (java.io.IOException ignored) { // The client is expected to close the response after its budget expires. } }); + server.createContext("/api/ready", exchange -> { + exchange.sendResponseHeaders(200, 1); + try (var output = exchange.getResponseBody()) { output.write('r'); } + }); server.start(); try { var profile = HttpServiceProfile.builder("payments", URI.create("http://127.0.0.1:" + server.getAddress().getPort() + "/api/")) - .budgets(Duration.ofMillis(1500), Duration.ofMillis(700), Duration.ofMillis(1000)) + .budgets(Duration.ofSeconds(5), Duration.ofSeconds(5), Duration.ofSeconds(5)) .build(); var service = new JdkHttpRequestService(List.of(profile)); var context = new DefaultUserContext(null); context.putAttribute(HttpRequestService.class.getName(), service); + // Exclude cold HTTP/context initialization from the deliberately + // stalled-response case. An unstarted request correctly reports + // TIMEOUT; this test must prove the POST was actually received. + assertEquals(200, context.httpRequests().execute(context, + HttpRequestService.Call.get("payments", "ready", "warm local HTTP transport", + "separate initialization from stalled response")).status()); var call = HttpRequestService.Call.postText("payments", "payments", "PRIVATE_BODY_CANARY", "submit payment", "confirm external effect"); - assertEquals(HttpRequestFailure.Code.AMBIGUOUS_OUTCOME, - assertThrows(HttpRequestFailure.class, - () -> context.httpRequests().execute(context, call)).code()); + var failure = assertThrows(HttpRequestFailure.class, + () -> context.httpRequests().execute(context, call)); + assertTrue("POST must reach the server before classifying its outcome", received.await(1, TimeUnit.SECONDS)); + assertEquals(HttpRequestFailure.Code.AMBIGUOUS_OUTCOME, failure.code()); assertEquals(1, requests.get()); } finally { + release.countDown(); server.stop(0); } } @@ -94,6 +110,10 @@ public class HttpResilienceExampleTest { return (outcome, attempts, elapsedMillis) -> {}; }); + for (int round = 1; round <= 2; round++) { + int before = requests.get(); + assertEquals((round - 1) * 2, before); + assertEquals(before, observed.size()); var response = context.httpRequests().execute(context, HttpRequestService.Call.get("orders", "orders/1?token=PRIVATE_QUERY_CANARY", "load order status", "show the order status") @@ -109,16 +129,21 @@ public class HttpResilienceExampleTest { .purpose("explain the order status") .execute(); assertTrue(viaTool.contains("submitted")); - assertEquals(2, requests.get()); - assertEquals(List.of(TRACEPARENT, TRACEPARENT), traceparents); - assertEquals(2, observed.size()); + assertEquals(round * 2, requests.get()); + assertEquals(java.util.Collections.nCopies(round * 2, TRACEPARENT), traceparents); + assertEquals(round * 2, observed.size()); var mapper = new com.fasterxml.jackson.databind.ObjectMapper(); - assertEquals(3, mapper.readTree(observed.get(0).traceChain()).size()); + assertEquals(3, mapper.readTree(observed.get(before).traceChain()).size()); assertEquals("load order graph", - mapper.readTree(observed.get(0).traceChain()).get(1).get("comment").asText()); - assertEquals(2, mapper.readTree(observed.get(1).traceChain()).size()); + mapper.readTree(observed.get(before).traceChain()).get(1).get("comment").asText()); + assertEquals(2, mapper.readTree(observed.get(before + 1).traceChain()).size()); assertFalse(observed.toString().contains("PRIVATE_QUERY_CANARY")); - assertFalse(observed.get(0).traceChain().contains("PRIVATE_QUERY_CANARY")); + assertFalse(observed.get(before).traceChain().contains("PRIVATE_QUERY_CANARY")); + System.out.println("JAVA_HTTP_CONTRACT_EXAMPLE=" + mapper.writeValueAsString(java.util.Map.of( + "id", "HTTP-16", "round", round, "fixturePort", server.getAddress().getPort(), + "requestsBefore", before, "requestsAfter", requests.get(), "operationsBefore", before, + "operationsAfter", observed.size(), "fixtureReset", false))); + } } finally { server.stop(0); } diff --git a/examples/object-storage/pom.xml b/examples/object-storage/pom.xml index 490cd039a..f5a1cfec4 100644 --- a/examples/object-storage/pom.xml +++ b/examples/object-storage/pom.xml @@ -1,6 +1,6 @@ 4.0.0 - io.teaqlteaql-java-parent1.555-RELEASE../../pom.xml + io.teaqlteaql-java-parent1.556-RELEASE../../pom.xml teaql-object-storage-example io.teaqlteaql-runtime diff --git a/examples/order-management/java-app-console/pom.xml b/examples/order-management/java-app-console/pom.xml index 05ec378ce..b8db1212d 100644 --- a/examples/order-management/java-app-console/pom.xml +++ b/examples/order-management/java-app-console/pom.xml @@ -11,7 +11,7 @@ 21 UTF-8 - 1.555-RELEASE + 1.556-RELEASE diff --git a/examples/order-management/java-lib-core/lib/pom.xml b/examples/order-management/java-lib-core/lib/pom.xml index b8fe9739b..b7291e4a0 100644 --- a/examples/order-management/java-lib-core/lib/pom.xml +++ b/examples/order-management/java-lib-core/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 1.556-RELEASE UTF-8 true diff --git a/examples/round-trip-reference-runtime/pom.xml b/examples/round-trip-reference-runtime/pom.xml index 635f65c95..b780ac77d 100644 --- a/examples/round-trip-reference-runtime/pom.xml +++ b/examples/round-trip-reference-runtime/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../../pom.xml teaql-round-trip-reference-example diff --git a/examples/scalar-type-probe/GeneratedCanonicalNameTest.java b/examples/scalar-type-probe/GeneratedCanonicalNameTest.java new file mode 100644 index 000000000..4681ed43a --- /dev/null +++ b/examples/scalar-type-probe/GeneratedCanonicalNameTest.java @@ -0,0 +1,245 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.checker.*; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.jackson.TeaQLModule; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.*; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.nio.file.Path; +import java.sql.*; +import java.time.*; +import java.util.*; +import java.util.concurrent.atomic.AtomicLong; +import java.util.logging.Logger; +import javax.sql.DataSource; +import org.junit.Test; +import org.sqlite.Function; +import static org.junit.Assert.*; + +/** Ordinary generated Q/E/mutation calls; raw-ledger writes below are explicit negative fault injection. */ +public class GeneratedCanonicalNameTest { + static final class Context extends DefaultUserContext implements ScalarTypeConformanceServiceUserContext { + Context(TeaQLRuntime runtime) { super(runtime); } + } + static final class ObservedDataSource implements DataSource { + final String url; + long calls; + final List written = new ArrayList<>(), rejected = new ArrayList<>(); + ObservedDataSource(String url) { this.url = url; } + public Connection getConnection() throws SQLException { + calls++; + var connection = DriverManager.getConnection(url); + Function.create(connection, "name93_written", new Function() { + protected void xFunc() throws SQLException { written.add(value_long(0)); result(0); } + }); + Function.create(connection, "name93_rejected", new Function() { + protected void xFunc() throws SQLException { rejected.add(value_long(0)); result(0); } + }); + return connection; + } + public Connection getConnection(String user, String password) throws SQLException { return getConnection(); } + public PrintWriter getLogWriter() { return null; } + public void setLogWriter(PrintWriter value) {} + public void setLoginTimeout(int value) {} + 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; } + } + static final class Fixture { + final ObservedDataSource data; + final JdbcSqlExecutor sql; + final List audits = new ArrayList<>(); + final List policies = new ArrayList<>(); + final List> checked = new ArrayList<>(); + final Context context; + Fixture(String url, int round) { + this(url, round, null); + } + Fixture(String url, int round, java.util.function.Consumer customerFix) { + data = new ObservedDataSource(url); + sql = new JdbcSqlExecutor(data); + var service = new SqliteDataServiceExecutor("sqlite", sql, data); + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { return new MutationPolicyIdentity("name93", "1", "sha256:name93"); } + public MutationDecision review(UserContext caller, MutationPlan plan) { policies.add(plan); return MutationDecision.allow(); } + }; + var ids = new AtomicLong(100L * round); + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", service).dataService("sqlite", service) + .idGenerationService(new InternalIdGenerationService() { + public Long generateId(UserContext caller, Entity entity) { return ids.incrementAndGet(); } + public void ensureFloor(String type, long floor) { ids.accumulateAndGet(floor, Math::max); } + }) + .executionLogging(false).mutationPolicyRegistry(key -> Optional.of(policy)) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller, ExecutionMetadata event) {} + public void writeAuditEvent(UserContext caller, RawAuditEvent event) { audits.add(event); } + }).build(); + var module = GeneratedRuntimeModule.module(); runtime.install(module); + for (var original : module.checkers()) if (original.type().equals("ScalarTypeProbe")) { + @SuppressWarnings("unchecked") var delegate = (Checker) original; + runtime.install(RuntimeModule.of().withCheckers(new Checker() { + public String type() { return "ScalarTypeProbe"; } + public void checkAndFix(UserContext caller, ScalarTypeProbe entity, ObjectLocation location) { + var keys = new HashSet<>(entity.getUpdatedProperties()); + assertFalse(keys.contains("type_platform_id")); assertFalse(keys.contains("requiredString")); + checked.add(Set.copyOf(keys)); delegate.checkAndFix(caller, entity, location); + if (customerFix != null) customerFix.accept(entity); + } + })); + } + context = new Context(runtime); context.ensureSchema(); + } + TypePlatform root(String name) { + var value = Q.typePlatforms().comment("Initialize the name graph root") + .purpose("Verify generated root mutations").newEntity(context); + value.updateName(name); value.auditAs("Create the name graph root").save(context); return value; + } + ScalarTypeProbe probe(TypePlatform root, String name) { + var value = Q.scalarTypeProbes().comment("Initialize a typed scalar probe") + .purpose("Verify generated canonical mutation fields").newEntity(context); + value.updateTypePlatform(root); value.updateRequiredString(name); value.updateOptionalString(null); + value.updateRequiredBoolean(true); value.updateRequiredInteger(7); value.updateRequiredLong(8L); + value.updateRequiredDecimal(new BigDecimal("12.50")); value.updateRequiredFloat(1.25f); value.updateRequiredDouble(2.5d); + value.updateRequiredDate(LocalDate.of(2032, 2, 29)); value.updateRequiredTime(LocalTime.of(12, 30)); + value.updateRequiredDatetime(LocalDateTime.of(2032, 2, 29, 12, 30)); return value; + } + ScalarTypeProbe load(long id) { + return Q.scalarTypeProbes().withIdIs(id).limit(1).comment("Reload the complete name probe") + .purpose("Verify persisted identity, version and fields").executeForOne(context); + } + void oracle(long id, String name, long version, long root) throws Exception { + try (var connection = DriverManager.getConnection(data.url); + var statement = connection.prepareStatement("SELECT required_string,version,type_platform FROM scalar_type_probe_data WHERE id=?")) { + statement.setLong(1, id); + try (var rows = statement.executeQuery()) { + assertTrue(rows.next()); assertEquals(name, rows.getString(1)); assertEquals(version, rows.getLong(2)); + assertEquals(root, rows.getLong(3)); assertFalse(rows.next()); + } + } + } + } + @Test public void generatedCanonicalNameFlow() throws Exception { + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(UserContext.class, TeaQLRuntime.class, SqliteDataServiceExecutor.class, TeaQLModule.class)) + assertTrue(type.getName(), Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var f = new Fixture("jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(), round); + var cases = new ArrayList(); + var root = f.root("Name93 root " + round); + var first = f.probe(root, "Name93 first " + round); + assertTrue(first.getUpdatedProperties().containsAll(List.of("required_string", "type_platform"))); + first.auditAs("Create the canonical name probe").save(f.context); + assertEquals(Long.valueOf(1), first.getVersion()); + assertTrue(f.checked.stream().anyMatch(keys -> keys.containsAll(List.of("required_string", "type_platform")))); + assertTrue(f.policies.stream().flatMap(plan -> plan.operations().stream()) + .anyMatch(operation -> operation.changedValues().keySet().containsAll(List.of("required_string", "type_platform")))); + var created = f.audits.get(f.audits.size() - 1); + assertTrue(created.changes().stream().anyMatch(change -> change.field().equals("type_platform"))); + assertTrue(created.changes().stream().anyMatch(change -> change.field().equals("required_string"))); + f.oracle(first.getId(), "Name93 first " + round, 1, root.getId()); cases.add("canonical-create"); + + var loaded = Q.scalarTypeProbes().withIdIs(first.getId()).limit(1) + .selectTypePlatformWith(Q.typePlatformsWithMinimalFields().selectName()) + .comment("Load canonical relation details").purpose("Verify generated Q and E").executeForOne(f.context); + assertEquals(root.getId(), E.scalarTypeProbe(loaded).getTypePlatform().getId().eval()); + assertEquals(root.getName(), E.scalarTypeProbe(loaded).getTypePlatform().getName().eval()); + assertNull(E.scalarTypeProbe(loaded).getOptionalString().eval()); + var partial = Q.scalarTypeProbesWithMinimalFields().withIdIs(first.getId()).selectRequiredString().limit(1) + .comment("Load a minimal name projection").purpose("Distinguish missing fields from loaded null").executeForOne(f.context); + assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(partial).getOptionalString().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(partial).getTypePlatform().getName().eval()); + cases.add("q-e-load-state"); + + var secondRoot = f.root("Name93 destination " + round); + var update = f.load(first.getId()); update.updateTypePlatform(secondRoot); update.updateRequiredString("Name93 moved " + round); + var keys = update.getEntityMutationLedger().changedFieldNames(new EntityKey("ScalarTypeProbe", update.getId())); + assertTrue(keys.containsAll(List.of("type_platform", "required_string"))); assertFalse(keys.contains("typePlatform")); + update.auditAs("Move the canonical relation").save(f.context); + f.oracle(first.getId(), "Name93 moved " + round, 2, secondRoot.getId()); cases.add("canonical-update"); + + int malformed = 0; + for (boolean existing : List.of(false, true)) for (String field : List.of("type_platform_id", "typePlatform", "requiredString", "unknown_field", "equal", "unequal")) { + var bad = existing ? f.load(first.getId()) : f.probe(root, "Name93 invalid"); + var ledger = bad.getEntityMutationLedger(); + var key = new EntityKey("ScalarTypeProbe", bad.getId()); + if (field.equals("equal") || field.equals("unequal")) { + ledger.set(key, "type_platform", root.getId()); + ledger.set(key, "type_platform_id", field.equals("equal") ? root.getId() : secondRoot.getId()); + } else ledger.set(key, field, field.equals("requiredString") ? "PRIVATE_NAME_CANARY" : 1L); + long calls = f.data.calls; int checks = f.checked.size(), policies = f.policies.size(), audits = f.audits.size(); + var error = assertThrows(CheckException.class, () -> bad.auditAs("Reject malformed model fields").save(f.context)); + assertTrue(error.getViolates().stream().allMatch(value -> value.getRuleId() == CheckResult.RuleId.UNKNOWN_FIELD)); + assertFalse(error.getMessage().contains("PRIVATE_NAME_CANARY")); + assertEquals(calls, f.data.calls); assertEquals(checks, f.checked.size()); assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + malformed++; + } + cases.add("malformed-zero-provider"); + for (boolean existing : List.of(false, true)) { + var bad = existing ? f.load(first.getId()) : f.probe(root, "Name93 required"); bad.updateRequiredString(null); + long calls = f.data.calls; int policies = f.policies.size(), audits = f.audits.size(); + var error = assertThrows(CheckException.class, () -> bad.auditAs("Reject a missing required string").save(f.context)); + assertTrue(error.getViolates().stream().anyMatch(value -> value.getLocation().modelPath().equals("required_string"))); + assertEquals(calls, f.data.calls); assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + } + cases.add("required-zero-provider"); + + var mapper = new ObjectMapper().findAndRegisterModules().registerModule(new TeaQLModule(f.context)); + var json = mapper.valueToTree(loaded); + assertTrue(json.has("typePlatform")); assertTrue(json.has("requiredString")); assertFalse(json.has("type_platform")); + assertTrue(json.has("optionalString")); assertTrue(json.get("optionalString").isNull()); + var decoded = mapper.treeToValue(json, ScalarTypeProbe.class); + assertEquals(root.getId(), E.scalarTypeProbe(decoded).getTypePlatform().getId().eval()); + assertEquals(E.scalarTypeProbe(loaded).getRequiredString().eval(), E.scalarTypeProbe(decoded).getRequiredString().eval()); + assertTrue(decoded.getUpdatedProperties().isEmpty()); assertFalse(decoded.__internalHasMutationLedger()); + var duplicate = mapper.createObjectNode().put("requiredString", "same").put("required_string", "same"); + assertThrows(com.fasterxml.jackson.databind.JsonMappingException.class, () -> mapper.treeToValue(duplicate, ScalarTypeProbe.class)); + cases.add("typed-json-default-profile"); + + var a = f.probe(root, "Name93 graph alpha"); var b = f.probe(root, "Name93 graph beta"); + a.auditAs("Seed first graph member").save(f.context); b.auditAs("Seed second graph member").save(f.context); + var graph = Q.typePlatforms().withIdIs(root.getId()).limit(1) + .selectScalarTypeProbeListWith(Q.scalarTypeProbes().orderByIdAscending().limit(10)) + .comment("Load the complete two-member graph").purpose("Verify atomic graph rollback and retry").executeForOne(f.context); + var children = graph.getScalarTypeProbeList(); + var childA = children.stream().filter(row -> row.getId().equals(a.getId())).findFirst().orElseThrow(); + var childB = children.stream().filter(row -> row.getId().equals(b.getId())).findFirst().orElseThrow(); + childA.updateRequiredString("Name93 graph revised"); childB.updateRequiredString("Name93 fail child"); + try (var connection = DriverManager.getConnection(f.data.url); var statement = connection.createStatement()) { + statement.execute("CREATE TRIGGER name93_observe AFTER UPDATE ON scalar_type_probe_data BEGIN SELECT name93_written(NEW.id); END"); + statement.execute("CREATE TRIGGER name93_fail BEFORE UPDATE ON scalar_type_probe_data WHEN NEW.required_string='Name93 fail child' BEGIN SELECT name93_rejected(NEW.id); SELECT RAISE(ABORT,'NAME93_SECOND_UPDATE'); END"); + } + f.data.written.clear(); f.data.rejected.clear(); f.audits.clear(); + assertThrows(RuntimeException.class, () -> graph.auditAs("Revise two name graph members").save(f.context)); + assertEquals(List.of(a.getId()), f.data.written); assertEquals(List.of(b.getId()), f.data.rejected); assertTrue(f.audits.isEmpty()); + f.oracle(a.getId(), "Name93 graph alpha", 1, root.getId()); f.oracle(b.getId(), "Name93 graph beta", 1, root.getId()); + assertEquals(Long.valueOf(1), childA.getVersion()); assertEquals(Long.valueOf(1), childB.getVersion()); + assertTrue(childA.getUpdatedProperties().contains("required_string")); assertTrue(childB.getUpdatedProperties().contains("required_string")); + cases.add("real-second-update-rollback"); + try (var connection = DriverManager.getConnection(f.data.url); var statement = connection.createStatement()) { statement.execute("DROP TRIGGER name93_fail"); } + f.data.written.clear(); graph.auditAs("Revise two name graph members").save(f.context); + assertEquals(List.of(a.getId(), b.getId()), f.data.written); + assertEquals(2, f.audits.size()); assertEquals(Set.of(a.getId(), b.getId()), new HashSet<>(f.audits.stream().map(RawAuditEvent::entityId).toList())); + for (var event : f.audits) { + assertEquals("ScalarTypeProbe", event.entityType()); assertEquals(Long.valueOf(2), event.resultingVersion()); + assertTrue(event.changes().stream().anyMatch(change -> change.field().equals("required_string"))); + assertEquals("Revise two name graph members", event.reason()); + } + f.oracle(a.getId(), "Name93 graph revised", 2, root.getId()); f.oracle(b.getId(), "Name93 fail child", 2, root.getId()); + try (var connection = DriverManager.getConnection(f.data.url); var statement = connection.createStatement()) { statement.execute("DROP TRIGGER name93_observe"); } + cases.add("same-graph-retry"); + System.out.println("JAVA_CANONICAL_NAME=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "round", round, "cases", cases, "malformedRejections", malformed, + "requiredRejections", 2, "rolledBackAfterWrites", 1, "retryAuditEntities", 2, + "ids", List.of(first.getId(), a.getId(), b.getId()), "versions", List.of(2, 2, 2), "wireProfiles", List.of("camelCase")))); + } +} diff --git a/examples/scalar-type-probe/GeneratedExplicitNullTest.java b/examples/scalar-type-probe/GeneratedExplicitNullTest.java new file mode 100644 index 000000000..45d4b2a04 --- /dev/null +++ b/examples/scalar-type-probe/GeneratedExplicitNullTest.java @@ -0,0 +1,92 @@ +package com.example.scalartypeconformanceservice; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import io.teaql.core.value.TeaQLNotLoadedException; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Set; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Explicit null is an edit, not evidence that an unselected value was null. */ +public class GeneratedExplicitNullTest { + @Test public void explicitNullAndLoadedNoopUseDifferentMutationPaths() throws Exception { + int round=Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var f=new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:"+Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(),round); + var root=f.root("Explicit null root "+round); + var created=f.probe(root,"explicit null "+round).updateOptionalInteger(37); + created.auditAs("Persist the explicit-null fixture").save(f.context); + long id=created.getId(); + + // This first assertion is a generated-code negative control: the old + // equals(null,null) shortcut incorrectly skipped an explicit edit. + var typed=Q.scalarTypeProbesWithMinimalFields().withIdIs(id).selectRequiredString().limit(1) + .comment("Load a partial explicit-null probe").purpose("Distinguish unselected from selected null").executeForOne(f.context); + assertFalse(typed.isPropertyLoaded("optional_integer")); + assertThrows(TeaQLNotLoadedException.class,()->E.scalarTypeProbe(typed).getOptionalInteger().eval()); + long before=f.data.calls;int policies=f.policies.size(),audits=f.audits.size(); + typed.updateOptionalInteger(null); + assertTrue("explicit null must select the previously missing field",typed.isPropertyLoaded("optional_integer")); + assertNull(E.scalarTypeProbe(typed).getOptionalInteger().eval()); + assertEquals(Set.of("optional_integer"),Set.copyOf(typed.getUpdatedProperties())); + var key=new EntityKey("ScalarTypeProbe",id);var ledger=typed.getEntityMutationLedger(); + assertTrue(ledger.currentChangeSet().changes().get(key).containsKey("optional_integer")); + assertNull(ledger.currentChangeSet().changes().get(key).get("optional_integer")); + assertEquals(Long.valueOf(1),typed.getOriginalVersion()); + // Unknown original value must remain unknown after multiple edits. + typed.updateOptionalInteger(99);typed.updateOptionalInteger(null);typed.updateOptionalInteger(null); + assertEquals(Set.of("optional_integer"),Set.copyOf(typed.getUpdatedProperties())); + assertTrue(ledger.changedFieldNames(key).contains("optional_integer")); + assertThrows(CheckException.class,()->typed.auditAs("Reject a still-incomplete edited object").save(f.context)); + assertEquals(before,f.data.calls);assertEquals(policies,f.policies.size());assertEquals(audits,f.audits.size()); + + var generic=Q.scalarTypeProbesWithMinimalFields().withIdIs(id).selectRequiredString().limit(1) + .comment("Load a generic explicit-null probe").purpose("Verify the runtime mutation path").executeForOne(f.context); + before=f.data.calls;generic.updateProperty("optional_integer",null); + assertTrue(generic.isPropertyLoaded("optional_integer"));assertNull(E.scalarTypeProbe(generic).getOptionalInteger().eval()); + assertEquals(Set.of("optional_integer"),Set.copyOf(generic.getUpdatedProperties())); + assertTrue(generic.getEntityMutationLedger().currentChangeSet().changes().get(key).containsKey("optional_integer")); + assertThrows(CheckException.class,()->generic.auditAs("Reject the incomplete generic edit").save(f.context)); + assertEquals(before,f.data.calls); + + var full=f.load(id);var state=full.__internalLoadState();before=f.data.calls; + assertFalse(full.__internalHasMutationLedger()); + full.updateOptionalInteger(37);full.updateOptionalString(null); + full.updateProperty("optional_integer",37);full.updateProperty("optional_string",null); + full.handleUpdate("optional_integer",37,37);full.updateId(id);full.updateVersion(1L); + assertSame(state,full.__internalLoadState());assertEquals(EntityStatus.PERSISTED,full.get$status()); + assertTrue(full.getUpdatedProperties().isEmpty());assertFalse(full.__internalHasMutationLedger()); + full.auditAs("Confirm equal loaded values produce no write").save(f.context); + assertEquals(before,f.data.calls);assertEquals(policies,f.policies.size());assertEquals(audits,f.audits.size()); + assertEquals(Long.valueOf(1),full.getVersion()); + + var reference=E.scalarTypeProbe(full).getTypePlatform().eval();var referenceState=reference.__internalLoadState(); + boolean hadLedger=reference.__internalHasMutationLedger(); + var referenceLedger=hadLedger?reference.getEntityMutationLedger():null; + assertFalse(reference.isPropertyLoaded("version")); + assertThrows(TeaQLRuntimeException.class,()->reference.updateVersion(null)); + assertSame(referenceState,reference.__internalLoadState());assertEquals(EntityStatus.REFER,reference.get$status()); + assertEquals(hadLedger,reference.__internalHasMutationLedger()); + if(hadLedger)assertSame(referenceLedger,reference.getEntityMutationLedger()); + + full.updateOptionalInteger(null);full.auditAs("Clear the selected optional integer").save(f.context); + assertEquals(Long.valueOf(2),full.getVersion()); + assertEquals(policies+1,f.policies.size());assertEquals(audits+1,f.audits.size()); + var plan=f.policies.get(policies);assertEquals(1,plan.operations().size()); + assertEquals("ScalarTypeProbe",plan.operations().get(0).entity().entity()); + var loaded=f.load(id);assertTrue(loaded.isPropertyLoaded("optional_integer")); + assertNull(E.scalarTypeProbe(loaded).getOptionalInteger().eval()); + assertEquals("explicit null "+round,E.scalarTypeProbe(loaded).getRequiredString().eval()); + try(var connection=DriverManager.getConnection(f.data.url);var statement=connection.prepareStatement("SELECT optional_integer,version FROM scalar_type_probe_data WHERE id=?")){ + statement.setLong(1,id);try(var rows=statement.executeQuery()){assertTrue(rows.next());assertNull(rows.getObject(1));assertEquals(2L,rows.getLong(2));assertFalse(rows.next());} + } + var result=new LinkedHashMap();result.put("passed",true);result.put("profile","camelCase");result.put("round",round);result.put("id",id);result.put("rootId",root.getId());result.put("finalVersion",2); + for(String flag:List.of("typedExplicitNull","genericExplicitNull","unknownBaselineRetained","partialRejectedBeforeProvider","loadedEqualNoop","referenceNullRejected","savedNullReadback"))result.put(flag,true); + result.put("fullExampleInventoryAccepted",false);result.put("internalArtifactAccepted",false); + System.out.println("JAVA_EXPLICIT_NULL="+new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/scalar-type-probe/GeneratedFiniteScalarTest.java b/examples/scalar-type-probe/GeneratedFiniteScalarTest.java new file mode 100644 index 000000000..3f97cf338 --- /dev/null +++ b/examples/scalar-type-probe/GeneratedFiniteScalarTest.java @@ -0,0 +1,138 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.*; +import java.util.concurrent.atomic.*; +import java.util.function.Consumer; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Ordinary writes use generated Q/E and audited Mutation; SQL is a labelled fault writer only. */ +public class GeneratedFiniteScalarTest { + static int round() { return Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); } + static String database(String suffix) { return "jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB") + suffix).toAbsolutePath(); } + static void rejected(Map result) { + assertEquals(result.toString(),Boolean.TRUE,result.get("contractPass")); assertEquals(Boolean.FALSE,result.get("accepted")); + } + static void emit(String marker,Map value) throws Exception { + System.out.println(marker + "=" + new ObjectMapper().writeValueAsString(value)); + } + @Test public void originalTwentyFiveNegativeScenariosNowRejectBeforeProvider() throws Exception { + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + var origins = new LinkedHashMap(); + for (var type : List.of(io.teaql.core.UserContext.class,io.teaql.core.checker.Checker.class, + io.teaql.runtime.TeaQLRuntime.class,io.teaql.provider.jdbc.JdbcSqlExecutor.class)) { + var origin = Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath(); + assertTrue(type.getName(),origin.startsWith(expected)); origins.put(type.getName(),origin.toString()); + } + emit("JAVA_FINITE_OFFICIAL_ORIGINS",origins); + var bytes = new ByteArrayOutputStream(); PrintStream original = System.out; + try (var captured = new PrintStream(new OutputStream() { + public void write(int value) { original.write(value); bytes.write(value); } + public void write(byte[] value,int offset,int length) { original.write(value,offset,length); bytes.write(value,offset,length); } + },true,StandardCharsets.UTF_8)) { + System.setOut(captured); + try { JavaFiniteScalarProbe.main(new String[]{System.getenv("TEAQL_NAME_DB"),Integer.toString(round())}); } + finally { System.setOut(original); } + } + int cases = 0, summaries = 0; var mapper = new ObjectMapper(); + for (String line : bytes.toString(StandardCharsets.UTF_8).split("\\R")) { + if (line.startsWith("JAVA_FINITE_SCALAR_CASE=")) { + var value = mapper.readTree(line.substring("JAVA_FINITE_SCALAR_CASE=".length())); + assertTrue(value.toString(),value.path("contractPass").asBoolean()); cases++; + } + if (line.startsWith("JAVA_FINITE_SCALAR_RESULT=")) { + var value = mapper.readTree(line.substring("JAVA_FINITE_SCALAR_RESULT=".length())); + assertEquals(25,value.path("cases").asInt()); assertEquals(0,value.path("contractFailures").asInt()); summaries++; + } + } + assertEquals(25,cases); assertEquals(1,summaries); + } + @Test public void actualCustomerFixCanRejectAndRepairEachGeneratedNumericField() throws Exception { + var action = new AtomicReference>(); var calls = new AtomicInteger(); + var f = new GeneratedCanonicalNameTest.Fixture(database(".finite-fix"),round(),row -> { + if (action.get() != null) { calls.incrementAndGet(); action.get().accept(row); } + }); + var root = f.root("Finite Fix root " + round()); int rejected = 0, repaired = 0; + for (String status : List.of("create","update")) for (String field : JavaFiniteScalarProbe.FIELDS) + for (double bad : new double[]{Double.NaN,Double.POSITIVE_INFINITY,Double.NEGATIVE_INFINITY}) { + var row = f.probe(root,"Finite post-Fix " + status + " " + field + " " + bad + " " + round()); + if (status.equals("update")) { + row.auditAs("Create a finite post-Fix control").save(f.context); + row.updateRequiredString(row.getRequiredString() + " requested update"); + } + action.set(value -> JavaFiniteScalarProbe.assign(value,field,bad)); calls.set(0); + rejected(JavaFiniteScalarProbe.outcome(() -> row.auditAs("Reject actual customer Fix non-finite output").save(f.context),field,f)); + assertEquals(1,calls.get()); rejected++; action.set(null); + } + for (String field : JavaFiniteScalarProbe.FIELDS) { + var row = f.probe(root,"Finite repaired " + field + " " + round()); JavaFiniteScalarProbe.assign(row,field,Double.NaN); + action.set(value -> JavaFiniteScalarProbe.assign(value,field,7.5d)); calls.set(0); + row.auditAs("Accept a finite repair from the actual customer Fix").save(f.context); + assertEquals(1,calls.get()); action.set(null); var stored = JavaFiniteScalarProbe.stored(f,row.getId(),field); + assertEquals("7.5",stored.get("number")); assertEquals(1L,stored.get("version")); repaired++; + } + emit("JAVA_FINITE_CUSTOM_FIX",Map.of("round",round(),"rejected",rejected,"repaired",repaired,"oneFixPerSave",true,"passed",true)); + } + @Test public void corruptLegacyInfinityFailsQueryAndLeavesSparseProjectionNotLoaded() throws Exception { + var f = new GeneratedCanonicalNameTest.Fixture(database(".finite-legacy"),round()); + var root = f.root("Finite legacy root " + round()); int cases = 0; + for (String field : JavaFiniteScalarProbe.FIELDS) for (double bad : new double[]{Double.POSITIVE_INFINITY,Double.NEGATIVE_INFINITY}) { + var row = f.probe(root,"Finite legacy " + field + " " + bad + " " + round()); + row.auditAs("Create a finite legacy witness").save(f.context); + // Negative fixture: bypass the runtime to corrupt one test-owned cell. + try (var db = DriverManager.getConnection(f.data.url); var update = db.prepareStatement( + "UPDATE scalar_type_probe_data SET " + field + "=? WHERE id=?")) { + update.setDouble(1,bad); update.setLong(2,row.getId()); assertEquals(1,update.executeUpdate()); + } + var error = assertThrows(RuntimeException.class,() -> f.load(row.getId())); boolean exact = false; + // Generated Q uses typed reads. Their exact-numeric boundary reports + // the projected JDBC label and target type, without the private value + // or its original conversion cause. The untyped legacy message is + // deliberately not the contract of this compiled mapper. + var target = field.endsWith("float") ? Float.class : Double.class; + var diagnostic = java.util.regex.Pattern.compile("Invalid JDBC column [1-9][0-9]* \\(" + + field + "\\) as " + java.util.regex.Pattern.quote(target.getName())); + var observed = new ArrayList(); + for (Throwable cause = error; cause != null; cause = cause.getCause()) { + observed.add(cause.getClass().getName() + ": " + cause.getMessage()); + if (cause instanceof IllegalArgumentException && cause.getMessage() != null + && diagnostic.matcher(cause.getMessage()).matches()) { + assertNull("typed conversion must not retain the untrusted value in a cause",cause.getCause()); + exact = true; + } + } + assertTrue("the actual corrupt column must be identified for " + field + "; " + observed,exact); + var sparse = Q.scalarTypeProbesWithMinimalFields().withIdIs(row.getId()).selectRequiredString().limit(1) + .comment("Read only the safe legacy projection").purpose("Preserve NotLoaded rather than inventing null").executeForOne(f.context); + assertEquals(row.getRequiredString(),E.scalarTypeProbe(sparse).getRequiredString().eval()); + assertThrows(io.teaql.core.value.TeaQLNotLoadedException.class,() -> E.scalarTypeProbe(sparse).getRequiredDouble().eval()); + var stored = JavaFiniteScalarProbe.stored(f,row.getId(),field); + assertEquals(Double.toString(bad),stored.get("number")); assertEquals(1L,stored.get("version")); cases++; + } + emit("JAVA_FINITE_LEGACY",Map.of("round",round(),"cases",cases,"unchangedVersions",true,"passed",true)); + } + @Test public void sameGeneratedGraphRetriesAfterOnlyTheInvalidChildIsRepaired() throws Exception { + var f = new GeneratedCanonicalNameTest.Fixture(database(".finite-retry"),round()); var root = f.root("Finite retry root " + round()); + var first = f.probe(root,"Finite retry first " + round()); first.auditAs("Create first retry witness").save(f.context); + var second = f.probe(root,"Finite retry second " + round()); second.auditAs("Create second retry witness").save(f.context); + var graph = Q.typePlatforms().withIdIs(root.getId()).limit(1) + .selectScalarTypeProbeListWith(Q.scalarTypeProbes().orderByIdAscending().limit(2)) + .comment("Load two complete retry witnesses").purpose("Prove rejected graph intent survives until repair").executeForOne(f.context); + var a = graph.getScalarTypeProbeList().get(0); var b = graph.getScalarTypeProbeList().get(1); + a.updateRequiredDouble(7.5d); b.updateOptionalFloat(Float.POSITIVE_INFINITY); + rejected(JavaFiniteScalarProbe.outcome(() -> graph.auditAs("Reject the late invalid graph child").save(f.context),"optional_float",f)); + assertEquals(1L,JavaFiniteScalarProbe.stored(f,first.getId(),"required_double").get("version")); + b.updateOptionalFloat(-4.5f); graph.auditAs("Retry the same retained graph after scalar repair").save(f.context); + assertEquals(2L,JavaFiniteScalarProbe.stored(f,first.getId(),"required_double").get("version")); + assertEquals(2L,JavaFiniteScalarProbe.stored(f,second.getId(),"optional_float").get("version")); + assertEquals(Double.valueOf(7.5),E.scalarTypeProbe(f.load(first.getId())).getRequiredDouble().eval()); + assertEquals(Float.valueOf(-4.5f),E.scalarTypeProbe(f.load(second.getId())).getOptionalFloat().eval()); + emit("JAVA_FINITE_GRAPH_RETRY",Map.of("round",round(),"children",2,"version",2,"sameGraph",true,"passed",true)); + } +} diff --git a/examples/scalar-type-probe/GeneratedJdbcExactReadTest.java b/examples/scalar-type-probe/GeneratedJdbcExactReadTest.java new file mode 100644 index 000000000..53930820a --- /dev/null +++ b/examples/scalar-type-probe/GeneratedJdbcExactReadTest.java @@ -0,0 +1,114 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Raw SQL below is deliberate legacy corruption, never normal application writes. */ +public class GeneratedJdbcExactReadTest { + private record Vector(String name, String column, String expression, Object restored) {} + private static final List VECTORS = List.of( + new Vector("integer-fraction", "required_integer", "1.9", 7), + new Vector("integer-upper-overflow", "required_integer", "2147483648", 7), + new Vector("integer-lower-overflow", "required_integer", "-2147483649", 7), + new Vector("long-fraction", "required_long", "1.9", 8L), + new Vector("long-rounded-overflow", "required_long", "9223372036854775808.0", 8L), + new Vector("float-overflow", "required_float", "1e40", 1.25f), + new Vector("double-infinity", "required_double", "1e999", 2.5d), + new Vector("decimal-private-text", "required_decimal", "'PRIVATE_JDBC_VALUE_901'", "12.50")); + + private static ScalarTypeProbe read(GeneratedCanonicalNameTest.Fixture f, long id, boolean streaming) { + var query = Q.scalarTypeProbes().withIdIs(id).limit(1) + .comment("Read the exact numeric probe through generated Q") + .purpose("Reject corrupt persisted numerics without returning a misleading entity"); + if (!streaming) return query.executeForOne(f.context); + try (var rows = query.executeForStream(f.context)) { return rows.findFirst().orElseThrow(); } + } + + @Test public void generatedQueriesRejectCorruptionAndPreserveUnselectedFields() throws Exception { + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(TeaQLRuntime.class, JdbcSqlExecutor.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var f = new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(), round); + var root = f.root("JDBC exact root " + round); + var results = new ArrayList(); + for (boolean streaming : List.of(false, true)) for (var v : VECTORS) { + String name = (streaming ? "stream/" : "one/") + v.name; + var row = f.probe(root, "JDBC exact " + round + " " + name); + row.auditAs("Create a generated numeric corruption control").save(f.context); + int audits = f.audits.size(), policies = f.policies.size(); + f.sql.executeInTransaction(() -> { + // Deliberately simulate a pre-constraint legacy/imported row. + // Use the real initialized adapter connection: exact Decimal + // CHECK functions are installed there, not on DriverManager's + // unrelated fresh connection. Restore checks before commit. + f.sql.execute("PRAGMA ignore_check_constraints=ON"); + try { assertEquals(1, f.sql.update("UPDATE scalar_type_probe_data SET " + v.column + "=" + v.expression + " WHERE id=?", new Object[]{row.getId()})); } + finally { f.sql.execute("PRAGMA ignore_check_constraints=OFF"); } + }); + // Establish the physical row independently of generated hydration. + try (var c = DriverManager.getConnection(f.data.url); + var s = c.prepareStatement("SELECT " + v.column + ",version FROM scalar_type_probe_data WHERE id=?")) { + s.setLong(1, row.getId()); + try (var rows = s.executeQuery()) { assertTrue(rows.next()); assertNotNull(rows.getObject(1)); assertEquals(1, rows.getLong(2)); assertFalse(rows.next()); } + } + var failure = assertThrows(RuntimeException.class, () -> read(f, row.getId(), streaming)); + boolean located = false; + for (Throwable cause = failure; cause != null; cause = cause.getCause()) { + assertFalse("private stored value escaped in an error", cause.toString().contains("PRIVATE_JDBC_VALUE_901")); + if (cause instanceof IllegalArgumentException && cause.getMessage().contains("JDBC column")) located = true; + } + assertTrue("missing precise typed JDBC failure for " + name, located); + var partial = Q.scalarTypeProbesWithMinimalFields().withIdIs(row.getId()).selectRequiredString().limit(1) + .comment("Read only an unaffected projection") + .purpose("Do not clear a row or silently load an unselected corrupt field").executeForOne(f.context); + assertEquals(row.getRequiredString(), E.scalarTypeProbe(partial).getRequiredString().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(partial).getRequiredInteger().eval()); + assertEquals(audits, f.audits.size()); assertEquals(policies, f.policies.size()); + // Repair only the explicit fault injection. Normal writes above and + // below continue to use generated audited mutation APIs. + assertEquals(1, f.sql.update("UPDATE scalar_type_probe_data SET " + v.column + "=? WHERE id=?", new Object[]{v.restored, row.getId()})); + var loaded = read(f, row.getId(), streaming); var e = E.scalarTypeProbe(loaded); + assertEquals(Integer.valueOf(7), e.getRequiredInteger().eval()); + assertEquals(Long.valueOf(8), e.getRequiredLong().eval()); + assertEquals(new BigDecimal("12.50"), e.getRequiredDecimal().eval()); + assertEquals(Float.valueOf(1.25f), e.getRequiredFloat().eval()); + assertEquals(Double.valueOf(2.5d), e.getRequiredDouble().eval()); + assertEquals(Long.valueOf(1), loaded.getVersion()); + assertEquals(audits, f.audits.size()); assertEquals(policies, f.policies.size()); + results.add(name); + } + var good = f.probe(root, "JDBC exact bounds " + round); + good.updateRequiredInteger(Integer.MIN_VALUE); good.updateOptionalInteger(Integer.MAX_VALUE); + good.updateRequiredLong(9007199254740993L); good.updateOptionalLong(Long.MIN_VALUE); + good.auditAs("Persist exact native numeric boundary controls").save(f.context); + for (boolean streaming : List.of(false, true)) { + var loaded = read(f, good.getId(), streaming); var e = E.scalarTypeProbe(loaded); + assertEquals(Integer.valueOf(Integer.MIN_VALUE), e.getRequiredInteger().eval()); + assertEquals(Integer.valueOf(Integer.MAX_VALUE), e.getOptionalInteger().eval()); + assertEquals(Long.valueOf(9007199254740993L), e.getRequiredLong().eval()); + assertEquals(Long.valueOf(Long.MIN_VALUE), e.getOptionalLong().eval()); + assertEquals(new BigDecimal("12.50"), e.getRequiredDecimal().eval()); + assertEquals(Long.valueOf(1), loaded.getVersion()); + } + good.updateRequiredString("JDBC exact bounds updated " + round); + good.auditAs("Save a real change after the numeric read controls").save(f.context); + assertEquals(Long.valueOf(2), f.load(good.getId()).getVersion()); + var result = new LinkedHashMap(); + result.put("passed", true); result.put("round", round); result.put("cases", results); + result.put("rootId", root.getId()); result.put("boundaryId", good.getId()); result.put("boundaryVersion", 2); + for (String key : List.of("generatedQ", "loadedE", "unselectedNotLoaded", "physicalCorruptionConfirmed", "queryProducesNoMutation", "privateValuesExcluded", "sameAdapterRecovers", "exactNativeBounds")) result.put(key, true); + System.out.println("JAVA_JDBC_EXACT_READ=" + new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/scalar-type-probe/GeneratedJsonLifecycleTest.java b/examples/scalar-type-probe/GeneratedJsonLifecycleTest.java new file mode 100644 index 000000000..73b7fe404 --- /dev/null +++ b/examples/scalar-type-probe/GeneratedJsonLifecycleTest.java @@ -0,0 +1,115 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.EntityStatus; +import io.teaql.core.MutationOperationKind; +import io.teaql.core.checker.CheckException; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.LinkedHashMap; +import java.util.List; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Real Q -> JSON -> mutation -> SQLite, with no edits to the generated library. */ +public class GeneratedJsonLifecycleTest { + @Test public void decodedExistingGraphsUpdateConflictDeleteAndRecover() throws Exception { + var profile = JsonFieldNamingProfile.fromModelValue(System.getenv("TEAQL_JSON_PROFILE")); + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(TeaQLRuntime.class, TeaQLModule.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + var f = new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(), round); + var root = f.root("JSON lifecycle " + profile + " round " + round); + var created = f.probe(root, "lifecycle " + round); + created.auditAs("Persist the JSON lifecycle probe").save(f.context); + var loaded = Q.scalarTypeProbes().withIdIs(created.getId()).limit(1) + .selectTypePlatformWith(Q.typePlatformsWithMinimalFields()) + .comment("Load the complete probe and a partial reference") + .purpose("Verify decoded lifecycle without loading untouched reference fields").executeForOne(f.context); + var mapper = new ObjectMapper().findAndRegisterModules().registerModule(new TeaQLModule(f.context)); + long codecCalls = f.data.calls; + String json = mapper.writeValueAsString(loaded); + var first = mapper.readValue(json, ScalarTypeProbe.class); + var stale = mapper.readValue(json, ScalarTypeProbe.class); + var unrelated = mapper.readValue(json, ScalarTypeProbe.class); + for (var value : List.of(first, stale, unrelated)) { + assertEquals(EntityStatus.PERSISTED, value.get$status()); + assertFalse(value.needPersist()); assertFalse(value.__internalHasMutationLedger()); + assertEquals(Long.valueOf(1), value.getOriginalVersion()); + assertEquals(root.getId(), E.scalarTypeProbe(value).getTypePlatform().getId().eval()); + var reference = E.scalarTypeProbe(value).getTypePlatform().eval(); + assertFalse(reference.isPropertyLoaded("name")); + assertFalse(reference.needPersist()); + assertFalse(reference.__internalHasMutationLedger()); + } + assertSame(first.__internalLoadState(), stale.__internalLoadState()); + assertEquals(codecCalls, f.data.calls); + first.updateRequiredString("lifecycle " + round + " updated"); + unrelated.updateRequiredString("must remain unpersisted"); + assertNotSame(first.getEntityMutationLedger(), unrelated.getEntityMutationLedger()); + int policies = f.policies.size(), audits = f.audits.size(); + first.auditAs("Update one independently decoded existing object").save(f.context); + assertEquals(Long.valueOf(2), first.getVersion()); assertEquals(EntityStatus.PERSISTED, first.get$status()); + assertEquals(1, f.policies.size() - policies); + var plan = f.policies.get(policies); + assertEquals(1, plan.operations().size()); + assertEquals(MutationOperationKind.UPDATE, plan.operations().get(0).kind()); + assertEquals("ScalarTypeProbe", plan.operations().get(0).entity().entity()); + assertEquals(1, f.audits.size() - audits); + assertTrue(unrelated.needPersist()); assertEquals(Long.valueOf(1), unrelated.getVersion()); + f.oracle(created.getId(), "lifecycle " + round + " updated", 2, root.getId()); + var reloaded = f.load(created.getId()); + assertEquals("lifecycle " + round + " updated", E.scalarTypeProbe(reloaded).getRequiredString().eval()); + + stale.updateRequiredString("stale decoded overwrite"); + int beforeConflictAudits = f.audits.size(); + var conflict = assertThrows(RuntimeException.class, + () -> stale.auditAs("Reject a stale independently decoded version").save(f.context)); + Throwable cause = conflict; + while (cause.getCause() != null) cause = cause.getCause(); + assertEquals("ConcurrentModifyException", cause.getClass().getSimpleName()); + assertEquals(Long.valueOf(1), stale.getVersion()); assertTrue(stale.needPersist()); + assertEquals(beforeConflictAudits, f.audits.size()); + f.oracle(created.getId(), "lifecycle " + round + " updated", 2, root.getId()); + + var partial = Q.scalarTypeProbesWithMinimalFields().withIdIs(created.getId()).selectRequiredString().limit(1) + .comment("Load a partial existing JSON object").purpose("Reject incomplete modified objects before database access") + .executeForOne(f.context); + var partialDecoded = mapper.readValue(mapper.writeValueAsString(partial), ScalarTypeProbe.class); + assertFalse(partialDecoded.needPersist()); partialDecoded.updateRequiredString("incomplete overwrite"); + long beforePartialSave = f.data.calls; + assertThrows(CheckException.class, () -> partialDecoded.auditAs("Reject a modified partial decoded object").save(f.context)); + assertEquals(beforePartialSave, f.data.calls); + assertEquals(Long.valueOf(2), partialDecoded.getVersion()); assertTrue(partialDecoded.needPersist()); + + var deleted = mapper.readValue(mapper.writeValueAsString(reloaded), ScalarTypeProbe.class); + deleted.markForDeletion(); deleted.auditAs("Delete the decoded existing object").save(f.context); + assertEquals(Long.valueOf(-3), deleted.getVersion()); assertEquals(EntityStatus.PERSISTED_DELETED, deleted.get$status()); + f.oracle(created.getId(), "lifecycle " + round + " updated", -3, root.getId()); + long beforeDeletedCodec = f.data.calls; + var recovered = mapper.readValue(mapper.writeValueAsString(deleted), ScalarTypeProbe.class); + assertEquals(EntityStatus.PERSISTED_DELETED, recovered.get$status()); + assertFalse(recovered.needPersist()); assertFalse(recovered.__internalHasMutationLedger()); + assertEquals(Long.valueOf(-3), recovered.getOriginalVersion()); assertEquals(beforeDeletedCodec, f.data.calls); + recovered.markAsRecover(); recovered.auditAs("Recover the decoded deleted object").save(f.context); + assertEquals(Long.valueOf(4), recovered.getVersion()); assertEquals(EntityStatus.PERSISTED, recovered.get$status()); + f.oracle(created.getId(), "lifecycle " + round + " updated", 4, root.getId()); + assertEquals("lifecycle " + round + " updated", E.scalarTypeProbe(f.load(created.getId())).getRequiredString().eval()); + try (var connection = DriverManager.getConnection(f.data.url); + var statement = connection.prepareStatement("SELECT version FROM type_platform_data WHERE id=?")) { + statement.setLong(1, root.getId()); + try (var rows = statement.executeQuery()) { assertTrue(rows.next()); assertEquals(1L, rows.getLong(1)); assertFalse(rows.next()); } + } + var report = new LinkedHashMap(); + report.put("passed", true); report.put("profile", profile.modelValue()); report.put("round", round); + report.put("id", created.getId()); report.put("rootId", root.getId()); report.put("finalVersion", 4); + for (var name : List.of("cleanDecode", "updateNotInsert", "independentLedgers", "staleConflict", "failedIntentRetained", + "partialRejectedBeforeProvider", "untouchedPartialReference", "deleteRecover", "zeroProviderCodec")) report.put(name, true); + System.out.println("JAVA_JSON_LIFECYCLE=" + new ObjectMapper().writeValueAsString(report)); + } +} diff --git a/examples/scalar-type-probe/GeneratedJsonLocalDatetimeTest.java b/examples/scalar-type-probe/GeneratedJsonLocalDatetimeTest.java new file mode 100644 index 000000000..954c41a9c --- /dev/null +++ b/examples/scalar-type-probe/GeneratedJsonLocalDatetimeTest.java @@ -0,0 +1,86 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.nio.file.Path; +import java.time.LocalDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.TimeZone; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Generated model wall-time JSON, not a claim of nanosecond SQL storage or Instant generation. */ +public class GeneratedJsonLocalDatetimeTest { + @Test public void generatedWallDatetimeSurvivesJsonMutationAndSqliteReload() throws Exception { + var profile = JsonFieldNamingProfile.fromModelValue(System.getenv("TEAQL_JSON_PROFILE")); + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(TeaQLRuntime.class, TeaQLModule.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + var f = new GeneratedCanonicalNameTest.Fixture( + "jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(), round); + var root = f.root("JSON LocalDateTime " + profile + " round " + round); + var row = f.probe(root, "local datetime " + round); + // A nonexistent New York wall time must not be normalized into an instant. + var initial = LocalDateTime.of(2024, 3, 10, 2, 30, 0, 123000000); + row.updateRequiredDatetime(initial); + row.auditAs("Persist a zone-free generated datetime").save(f.context); + var loaded = f.load(row.getId()); + assertEquals(initial, E.scalarTypeProbe(loaded).getRequiredDatetime().eval()); + var mapper = new ObjectMapper().registerModule(new TeaQLModule(f.context)); + long before = f.data.calls; + int auditBefore = f.audits.size(), policiesBefore = f.policies.size(); + var field = profile.render("required_datetime"); + var json = mapper.readTree(mapper.writeValueAsString(loaded)); + assertEquals("2024-03-10T02:30:00.123", json.path(field).textValue()); + var restored = mapper.treeToValue(json, ScalarTypeProbe.class); + assertEquals(initial, E.scalarTypeProbe(restored).getRequiredDatetime().eval()); + assertFalse(restored.__internalHasMutationLedger()); + for (var zone : List.of("UTC", "America/New_York", "Asia/Shanghai")) { + var zoned = mapper.copy().setTimeZone(TimeZone.getTimeZone(zone)); + assertEquals(initial, E.scalarTypeProbe(zoned.treeToValue(json, ScalarTypeProbe.class)).getRequiredDatetime().eval()); + assertEquals(json, zoned.readTree(zoned.writeValueAsString(loaded))); + } + var explicitNull = mapper.readValue("{\"" + field + "\":null}", ScalarTypeProbe.class); + assertNull(E.scalarTypeProbe(explicitNull).getRequiredDatetime().eval()); + var absent = mapper.readValue("{}", ScalarTypeProbe.class); + assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(absent).getRequiredDatetime().eval()); + assertFalse(explicitNull.__internalHasMutationLedger()); + assertFalse(absent.__internalHasMutationLedger()); + int invalid = 0; + for (var value : List.of("\"2024-03-10T02:30:00Z\"", "\"2024-03-10T02:30:00+08:00\"", + "\"2023-02-29T12:00:00\"", "[2024,3,10,2,30]", "0", "true", "\"PRIVATE_DATETIME_CANARY\"")) { + var error = assertThrows(JsonMappingException.class, + () -> mapper.readValue("{\"" + field + "\":" + value + "}", ScalarTypeProbe.class)); + assertEquals(field, error.getPath().get(0).getFieldName()); + assertFalse(error.getMessage().contains("PRIVATE_DATETIME_CANARY")); + invalid++; + } + assertEquals(before, f.data.calls); + assertEquals(auditBefore, f.audits.size()); + assertEquals(policiesBefore, f.policies.size()); + var updated = LocalDateTime.of(1960, 2, 29, 23, 59, 59, 456000000); + restored.updateRequiredDatetime(updated); + restored.auditAs("Save a trusted zone-free datetime edit after JSON reconstruction").save(f.context); + var finalRow = f.load(row.getId()); + assertEquals(Long.valueOf(2), finalRow.getVersion()); + assertEquals(updated, E.scalarTypeProbe(finalRow).getRequiredDatetime().eval()); + assertEquals("1960-02-29T23:59:59.456", + mapper.readTree(mapper.writeValueAsString(finalRow)).path(field).textValue()); + var result = new LinkedHashMap(); + result.put("passed", true); result.put("profile", profile.modelValue()); result.put("round", round); + result.put("id", row.getId()); result.put("rootId", root.getId()); result.put("finalVersion", 2); + result.put("invalidInputCases", invalid); + for (var key : List.of("zoneFreeIso", "timezoneIndependent", "loadedNull", "notLoaded", "passiveCodec", + "typedQAndE", "decodedSave", "sqliteMillisReadback")) result.put(key, true); + result.put("generatedInstantAccepted", false); result.put("sqlNanosecondsAccepted", false); + result.put("businessClockChanged", false); + System.out.println("JAVA_JSON_LOCAL_DATETIME=" + new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/scalar-type-probe/GeneratedJsonNumericTest.java b/examples/scalar-type-probe/GeneratedJsonNumericTest.java new file mode 100644 index 000000000..749c523fe --- /dev/null +++ b/examples/scalar-type-probe/GeneratedJsonNumericTest.java @@ -0,0 +1,74 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.nio.file.Path; +import java.util.LinkedHashMap; +import java.util.List; +import static org.junit.Assert.*; +import org.junit.Test; + +/** Generated typed mutation/Q/E and passive numeric JSON use the same native values. */ +public class GeneratedJsonNumericTest { + static void values(ScalarTypeProbe row, String name) { + var e=E.scalarTypeProbe(row); + assertEquals(name,e.getRequiredString().eval());assertEquals("",e.getOptionalString().eval()); + assertEquals("Unicode 雪",e.getLargeText().eval()); + assertEquals(Boolean.TRUE,e.isRequiredBoolean().eval());assertEquals(Boolean.FALSE,e.isOptionalBoolean().eval()); + assertEquals(Integer.valueOf(Integer.MAX_VALUE),e.getRequiredInteger().eval());assertEquals(Integer.valueOf(Integer.MIN_VALUE),e.getOptionalInteger().eval()); + assertEquals(Long.valueOf(9007199254740993L),e.getRequiredLong().eval());assertEquals(Long.valueOf(Long.MIN_VALUE),e.getOptionalLong().eval()); + assertEquals(new BigDecimal("123456789012.3456789"),e.getRequiredDecimal().eval());assertEquals(new BigDecimal("3.50"),e.getOptionalDecimal().eval()); + assertEquals(Float.valueOf(1.5f),e.getRequiredFloat().eval());assertEquals(Float.valueOf(-3.5f),e.getOptionalFloat().eval()); + assertEquals(Double.valueOf(2.25d),e.getRequiredDouble().eval());assertEquals(Double.valueOf(-0.125d),e.getOptionalDouble().eval()); + } + @Test public void generatedExactNumericsPersistAndRoundTripInTheSelectedProfile() throws Exception { + var profile=JsonFieldNamingProfile.fromModelValue(System.getenv("TEAQL_JSON_PROFILE")); + int round=Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var expected=Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for(var type:List.of(TeaQLRuntime.class,TeaQLModule.class))assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + var f=new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:"+Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(),round); + var root=f.root("JSON numeric "+profile+" round "+round); + var row=f.probe(root,"numeric "+round); + row.updateOptionalString("");row.updateLargeText("Unicode 雪");row.updateOptionalBoolean(false); + row.updateRequiredInteger(Integer.MAX_VALUE);row.updateOptionalInteger(Integer.MIN_VALUE); + row.updateRequiredLong(9007199254740993L);row.updateOptionalLong(Long.MIN_VALUE); + row.updateRequiredDecimal(new BigDecimal("123456789012.3456789"));row.updateOptionalDecimal(new BigDecimal("3.50")); + row.updateRequiredFloat(1.5f);row.updateOptionalFloat(-3.5f);row.updateRequiredDouble(2.25d);row.updateOptionalDouble(-0.125d); + row.auditAs("Persist exact generated numeric values").save(f.context); + var loaded=f.load(row.getId());values(loaded,"numeric "+round); + var mapper=new ObjectMapper().findAndRegisterModules().registerModule(new TeaQLModule(f.context)); + long before=f.data.calls; + var json=mapper.readTree(mapper.writeValueAsString(loaded)); + assertEquals(row.getId().toString(),json.path(profile.render("id")).textValue());assertEquals("1",json.path(profile.render("version")).textValue()); + assertEquals("9007199254740993",json.path(profile.render("required_long")).textValue()); + assertEquals(Long.toString(Long.MIN_VALUE),json.path(profile.render("optional_long")).textValue()); + assertEquals("123456789012.3456789",json.path(profile.render("required_decimal")).textValue()); + assertEquals("3.50",json.path(profile.render("optional_decimal")).textValue()); + assertTrue(json.path(profile.render("required_integer")).isIntegralNumber());assertTrue(json.path(profile.render("required_float")).isNumber()); + var restored=mapper.treeToValue(json,ScalarTypeProbe.class);values(restored,"numeric "+round); + assertFalse(restored.__internalHasMutationLedger());assertEquals(before,f.data.calls); + int invalid=0; + for(String[] test:List.of(new String[]{"required_long","9007199254740993"},new String[]{"required_integer","1.5"}, + new String[]{"required_decimal","0.1"},new String[]{"required_float","3.5e38"},new String[]{"required_double","1e-400"}, + new String[]{"required_boolean","\"PRIVATE_SCALAR_CANARY\""})){ + var error=assertThrows(JsonMappingException.class,()->mapper.readValue("{\""+profile.render(test[0])+"\":"+test[1]+"}",ScalarTypeProbe.class)); + assertEquals(profile.render(test[0]),error.getPath().get(0).getFieldName());assertFalse(error.getMessage().contains("PRIVATE_SCALAR_CANARY"));invalid++; + } + assertEquals(before,f.data.calls); + var bad=f.load(row.getId());bad.updateRequiredDouble(Double.NaN); + long beforeBadCodec=f.data.calls; + assertThrows(JsonMappingException.class,()->mapper.writeValueAsString(bad));assertEquals(beforeBadCodec,f.data.calls); + restored.updateRequiredString("numeric "+round+" updated"); + restored.auditAs("Save a trusted edit after exact numeric JSON reconstruction").save(f.context); + var finalRow=f.load(row.getId());values(finalRow,"numeric "+round+" updated");assertEquals(Long.valueOf(2),finalRow.getVersion()); + var result=new LinkedHashMap();result.put("passed",true);result.put("profile",profile.modelValue());result.put("round",round);result.put("id",row.getId()); + result.put("rootId",root.getId());result.put("finalVersion",2);result.put("invalidInputCases",invalid); + for(String key:List.of("exactLong","exactDecimalScale","integerBounds","nativeFloatDouble","passiveCodec","typedQAndE","decodedSave","nonfiniteOutputRejected"))result.put(key,true); + System.out.println("JAVA_JSON_NUMERIC="+new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/scalar-type-probe/GeneratedJsonProfileTest.java b/examples/scalar-type-probe/GeneratedJsonProfileTest.java new file mode 100644 index 000000000..a61304432 --- /dev/null +++ b/examples/scalar-type-probe/GeneratedJsonProfileTest.java @@ -0,0 +1,85 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Compiled separately for each model option; no hand edits to generated code. */ +public class GeneratedJsonProfileTest { + @Test public void generatedModelControlsItsOwnJsonBoundary() throws Exception { + var profile = JsonFieldNamingProfile.fromModelValue(System.getenv("TEAQL_JSON_PROFILE")); + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(TeaQLRuntime.class, TeaQLModule.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + var f = new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(), round); + var root = f.root("JSON profile " + profile + " round " + round); + var value = f.probe(root, "profile " + round); value.auditAs("Persist the generated JSON profile probe").save(f.context); + var loaded = Q.scalarTypeProbes().withIdIs(value.getId()).limit(1) + .selectTypePlatformWith(Q.typePlatformsWithMinimalFields().selectName()) + .comment("Load the selected model JSON graph").purpose("Verify generated Q/E and its chosen wire names").executeForOne(f.context); + var mapper = new ObjectMapper().findAndRegisterModules().registerModule(new TeaQLModule(f.context)); + long before = f.data.calls; + var json = mapper.readTree(mapper.writeValueAsString(loaded)); + assertTrue(json.has(profile.render("id"))); assertTrue(json.has(profile.render("version"))); + assertEquals("profile " + round, json.path(profile.render("required_string")).asText()); + assertTrue(json.get(profile.render("optional_string")).isNull()); + assertEquals(root.getId().longValue(), json.path(profile.render("type_platform")).path(profile.render("id")).asLong()); + assertFalse(json.has("type_platform_id")); + var decoded = mapper.treeToValue(json, ScalarTypeProbe.class); + assertEquals(root.getId(), E.scalarTypeProbe(decoded).getTypePlatform().getId().eval()); + assertEquals("profile " + round, E.scalarTypeProbe(decoded).getRequiredString().eval()); + assertTrue(decoded.getUpdatedProperties().isEmpty()); assertFalse(decoded.__internalHasMutationLedger()); + String key = profile.render("required_string"); + assertThrows(java.io.IOException.class, () -> mapper.readValue("{\"" + key + "\":\"same\",\"" + key + "\":\"same\"}", ScalarTypeProbe.class)); + if (profile != JsonFieldNamingProfile.SNAKE_CASE) { + var aliases = mapper.createObjectNode().put(key, "same").put("required_string", "same"); + assertThrows(com.fasterxml.jackson.databind.JsonMappingException.class, () -> mapper.treeToValue(aliases, ScalarTypeProbe.class)); + } + assertEquals(before, f.data.calls); + var sparse = Q.scalarTypeProbesWithMinimalFields().withIdIs(value.getId()).selectRequiredString().limit(1) + .comment("Project one generated JSON field").purpose("Preserve NotLoaded and model error paths").executeForOne(f.context); + var sparseJson = mapper.readTree(mapper.writeValueAsString(sparse)); assertFalse(sparseJson.has(profile.render("optional_string"))); + var restored = mapper.treeToValue(sparseJson, ScalarTypeProbe.class); + long beforeExpression = f.data.calls; + var error = assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(restored).getOptionalString().eval()); + String expectedPointer = switch (profile) { + case CAMEL_CASE -> "/optionalString"; + case SNAKE_CASE -> "/optional_string"; + case PASCAL_CASE -> "/OptionalString"; + }; + var wire = error.toWire(); + assertEquals(expectedPointer, wire.instancePath()); + assertEquals(expectedPointer, wire.attemptedInstancePath()); + assertEquals(List.of(io.teaql.core.checker.WireLocationSegment.property("optional_string")), wire.location()); + assertEquals(wire.location(), wire.attemptedLocation()); + assertEquals(wire.location(), wire.suggestedFix().location()); + assertEquals("optional_string", wire.breakPoint()); + assertEquals(0, wire.breakPointIndex()); + assertEquals("NOT_LOADED", wire.code()); + assertEquals("E.scalarTypeProbe().getOptionalString().eval()", wire.originalExpression()); + assertEquals("E.scalarTypeProbe().getOptionalString().eval()", wire.expressionWithBrokenPoint()); + assertTrue(error.getMessage(), error.getMessage().startsWith("TeaQLNotLoadedError:")); + assertTrue(error.getMessage(), error.getMessage().contains("access_path=optionalString")); + assertTrue(error.getMessage(), error.getMessage().contains("break_point=optional_string")); + assertTrue(error.getMessage(), error.getMessage().contains(wire.expressionWithBrokenPoint())); + assertFalse(error.getMessage().contains("\"instancePath\"")); + assertEquals(beforeExpression, f.data.calls); + assertFalse(restored.__internalHasMutationLedger()); + System.out.println("GENERATED_E_MODEL_PROFILE=" + new ObjectMapper().writeValueAsString(Map.of( + "language", "java", "profile", profile.modelValue(), "round", round, "passed", true, + "wire", wire, "human", error.getMessage(), "providerEntries", 0, "mutationLedgerCreated", false))); + System.out.println("JAVA_JSON_MODEL_PROFILE=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "profile", profile.modelValue(), "round", round, "id", value.getId(), + "nestedIdentity", true, "loadedNull", true, "notLoaded", true, "zeroProviderCodec", true, + "duplicateKeysRejected", true, "modelErrorPath", error.toWire().instancePath()))); + } +} diff --git a/examples/scalar-type-probe/GeneratedJsonTemporalTest.java b/examples/scalar-type-probe/GeneratedJsonTemporalTest.java new file mode 100644 index 000000000..5f7f732b6 --- /dev/null +++ b/examples/scalar-type-probe/GeneratedJsonTemporalTest.java @@ -0,0 +1,65 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.nio.file.Path; +import java.time.*; +import java.util.LinkedHashMap; +import java.util.List; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Generated Date/Time APIs; no redefinition of the model's LocalDateTime fields. */ +public class GeneratedJsonTemporalTest { + @Test public void generatedDateAndWallTimeStayExactAcrossJsonAndSave()throws Exception{ + var profile=JsonFieldNamingProfile.fromModelValue(System.getenv("TEAQL_JSON_PROFILE")); + int round=Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var expected=Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for(var type:List.of(TeaQLRuntime.class,TeaQLModule.class))assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + var f=new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:"+Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(),round); + var root=f.root("JSON temporal "+profile+" round "+round); + var row=f.probe(root,"temporal "+round); + var date=LocalDate.of(1960,2,29);var time=LocalTime.of(23,59,59,123456789); + row.updateRequiredDate(date);row.updateOptionalDate(LocalDate.of(2024,2,29)); + row.updateRequiredTime(LocalTime.MIDNIGHT);row.updateOptionalTime(time); + row.auditAs("Persist generated calendar and wall-clock values").save(f.context); + var loaded=f.load(row.getId()); + assertEquals(date,E.scalarTypeProbe(loaded).getRequiredDate().eval());assertEquals(time,E.scalarTypeProbe(loaded).getOptionalTime().eval()); + var nativeLocalDateTime=E.scalarTypeProbe(loaded).getRequiredDatetime().eval(); + var mapper=new ObjectMapper().findAndRegisterModules().registerModule(new TeaQLModule(f.context)); + long before=f.data.calls; + var json=mapper.readTree(mapper.writeValueAsString(loaded)); + assertEquals("1960-02-29",json.path(profile.render("required_date")).textValue()); + assertEquals("2024-02-29",json.path(profile.render("optional_date")).textValue()); + assertEquals("00:00:00",json.path(profile.render("required_time")).textValue()); + assertEquals("23:59:59.123456789",json.path(profile.render("optional_time")).textValue()); + var restored=mapper.treeToValue(json,ScalarTypeProbe.class); + assertEquals(date,E.scalarTypeProbe(restored).getRequiredDate().eval());assertEquals(time,E.scalarTypeProbe(restored).getOptionalTime().eval()); + assertEquals(nativeLocalDateTime,E.scalarTypeProbe(restored).getRequiredDatetime().eval()); + assertFalse(restored.__internalHasMutationLedger());assertEquals(before,f.data.calls); + int invalid=0; + for(String[] test:List.of(new String[]{"required_date","\"2023-02-29\""},new String[]{"required_date","[2024,2,29]"}, + new String[]{"required_time","\"23:59:00+08:00\""},new String[]{"required_time","\"23:59:59.1234567891\""}, + new String[]{"required_time","0"},new String[]{"required_date","\"PRIVATE_TEMPORAL_CANARY\""})){ + var error=assertThrows(JsonMappingException.class,()->mapper.readValue("{\""+profile.render(test[0])+"\":"+test[1]+"}",ScalarTypeProbe.class)); + assertEquals(profile.render(test[0]),error.getPath().get(0).getFieldName());assertFalse(error.getMessage().contains("PRIVATE_TEMPORAL_CANARY"));invalid++; + } + assertEquals(before,f.data.calls); + restored.updateRequiredString("temporal "+round+" updated");restored.updateRequiredTime(time); + restored.updateOptionalDate(null);restored.updateOptionalTime(null); + restored.auditAs("Save a trusted edit after temporal JSON reconstruction").save(f.context); + var finalRow=f.load(row.getId());assertEquals(Long.valueOf(2),finalRow.getVersion()); + assertEquals(date,E.scalarTypeProbe(finalRow).getRequiredDate().eval());assertEquals(time,E.scalarTypeProbe(finalRow).getRequiredTime().eval()); + assertNull(E.scalarTypeProbe(finalRow).getOptionalDate().eval());assertNull(E.scalarTypeProbe(finalRow).getOptionalTime().eval()); + assertEquals(nativeLocalDateTime,E.scalarTypeProbe(finalRow).getRequiredDatetime().eval()); + var result=new LinkedHashMap();result.put("passed",true);result.put("profile",profile.modelValue());result.put("round",round); + result.put("id",row.getId());result.put("rootId",root.getId());result.put("finalVersion",2);result.put("invalidInputCases",invalid); + for(String key:List.of("calendarDate","wallTimeNanoseconds","loadedNull","passiveCodec","typedQAndE","decodedSave","localDateTimeUnchanged"))result.put(key,true); + result.put("generatedInstantAccepted",false);result.put("localDateTimeWireAccepted",false);result.put("businessClockChanged",false); + System.out.println("JAVA_JSON_TEMPORAL="+new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/scalar-type-probe/GeneratedLoadedRevertTest.java b/examples/scalar-type-probe/GeneratedLoadedRevertTest.java new file mode 100644 index 000000000..82ba608ea --- /dev/null +++ b/examples/scalar-type-probe/GeneratedLoadedRevertTest.java @@ -0,0 +1,58 @@ +package com.example.scalartypeconformanceservice; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Set; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Native Q/E must agree with the value actually committed from the ledger. */ +public class GeneratedLoadedRevertTest { + @Test public void restoringKnownValuesCannotSaveIntermediateValues() throws Exception { + int round=Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var f=new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:"+Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(),round); + var root=f.root("Loaded revert root "+round);var created=f.probe(root,"loaded revert "+round).updateOptionalInteger(37); + created.auditAs("Persist the loaded-revert fixture").save(f.context);long id=created.getId(); + var full=f.load(id);var state=full.__internalLoadState();long before=f.data.calls;int policies=f.policies.size(),audits=f.audits.size(); + full.updateOptionalInteger(99);full.updateOptionalInteger(37); + assertEquals(Integer.valueOf(37),E.scalarTypeProbe(full).getOptionalInteger().eval()); + full.auditAs("Save after restoring the original integer").save(f.context); + // Check actual storage before the no-op counters. The native baseline + // retains the intermediate intent; the real save rewrites the restored + // value but incorrectly bumps version from 1 to 2. + try(var connection=DriverManager.getConnection(f.data.url);var statement=connection.prepareStatement("SELECT optional_integer,version FROM scalar_type_probe_data WHERE id=?")){ + statement.setLong(1,id);try(var rows=statement.executeQuery()){assertTrue(rows.next());assertEquals("restored value must match persisted value",37,rows.getInt(1));assertEquals(1L,rows.getLong(2));assertFalse(rows.next());} + } + assertEquals(before,f.data.calls);assertEquals(policies,f.policies.size());assertEquals(audits,f.audits.size()); + assertSame(state,full.__internalLoadState());assertEquals(EntityStatus.PERSISTED,full.get$status());assertEquals(Long.valueOf(1),full.getVersion()); + + var nullOwner=f.load(id);before=f.data.calls;nullOwner.updateOptionalString("discard this intermediate value");nullOwner.updateOptionalString(null); + assertNull(E.scalarTypeProbe(nullOwner).getOptionalString().eval()); + nullOwner.auditAs("Save after restoring the original null").save(f.context); + assertEquals(before,f.data.calls);assertEquals(policies,f.policies.size());assertEquals(audits,f.audits.size());assertEquals(Long.valueOf(1),nullOwner.getVersion()); + + var changed=f.load(id);changed.updateRequiredString("loaded revert "+round+" saved");changed.updateOptionalInteger(99);changed.updateOptionalInteger(37); + assertEquals(Set.of("required_string"),Set.copyOf(changed.getUpdatedProperties())); + changed.auditAs("Save only the genuinely changed field").save(f.context); + assertEquals(policies+1,f.policies.size());assertEquals(audits+1,f.audits.size());assertEquals(Long.valueOf(2),changed.getVersion()); + var plan=f.policies.get(policies);assertEquals(1,plan.operations().size()); + // This evaluated model declares update_time=updateTime(): a genuine + // business edit must retain that normal Checker/Fix contribution. + assertEquals(Set.of("required_string","update_time"),plan.operations().get(0).changedValues().keySet()); + assertNotNull(plan.operations().get(0).changedValues().get("update_time")); + var loaded=f.load(id);assertEquals(Integer.valueOf(37),E.scalarTypeProbe(loaded).getOptionalInteger().eval());assertNull(E.scalarTypeProbe(loaded).getOptionalString().eval()); + assertEquals("loaded revert "+round+" saved",E.scalarTypeProbe(loaded).getRequiredString().eval()); + assertNotNull(E.scalarTypeProbe(loaded).getUpdateTime().eval()); + try(var connection=DriverManager.getConnection(f.data.url);var statement=connection.prepareStatement("SELECT version,name FROM type_platform_data WHERE id=?")){ + statement.setLong(1,root.getId());try(var rows=statement.executeQuery()){assertTrue(rows.next());assertEquals(1L,rows.getLong(1));assertEquals("Loaded revert root "+round,rows.getString(2));assertFalse(rows.next());} + } + var result=new LinkedHashMap();result.put("passed",true);result.put("profile","camelCase");result.put("round",round);result.put("id",id);result.put("rootId",root.getId());result.put("finalVersion",2); + for(String flag:List.of("knownValueRestored","knownNullRestored","emptyPlanNoWrite","otherFieldPreserved","typedQAndE","versionUnchangedUntilRealEdit","unrelatedParentUnchanged","managedUpdateTimeRetained"))result.put(flag,true); + result.put("fullExampleInventoryAccepted",false);result.put("internalArtifactAccepted",false); + System.out.println("JAVA_LOADED_REVERT="+new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/scalar-type-probe/GeneratedOuterReplayTest.java b/examples/scalar-type-probe/GeneratedOuterReplayTest.java new file mode 100644 index 000000000..473d1276b --- /dev/null +++ b/examples/scalar-type-probe/GeneratedOuterReplayTest.java @@ -0,0 +1,180 @@ +package com.example.scalartypeconformanceservice; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import io.teaql.core.checker.CheckResult; +import io.teaql.data.dynamic.*; +import io.teaql.data.dynamic.jdbc.JdbcDynamicFieldsProvider; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.List; +import java.util.Map; +import org.junit.Test; +import static org.junit.Assert.*; + +/** A physical rollback must retain the latest intent, not the first save's intent alone. */ +public class GeneratedOuterReplayTest { + private GeneratedCanonicalNameTest.Fixture fixture(String kind) throws Exception { + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(BaseEntity.class, io.teaql.runtime.TeaQLRuntime.class, + io.teaql.provider.jdbc.JdbcSqlExecutor.class, io.teaql.core.sqlite.SqliteDataServiceExecutor.class)) { + var origin = Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath(); + assertTrue("local reactor origin: " + type.getName(), origin.startsWith(expected)); + } + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var file = Path.of(System.getenv("TEAQL_NAME_DB") + ".outer-replay-" + kind + ".sqlite").toAbsolutePath(); + return new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:" + file, round); + } + + private void verify(String kind) throws Exception { + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var f = fixture(kind); + var root = f.root("Outer replay root"); var prepared = f.probe(root, "Outer replay original"); + boolean create = kind.equals("new-then-update"); + if (!create) prepared.auditAs("Seed the outer replay owner").save(f.context); + var row = create ? prepared : f.load(prepared.getId()); + Long idBeforeFirstSave = row.getId(); + int audits = f.audits.size(); var assigned = new long[]{-1}; + var error = assertThrows(IllegalStateException.class, () -> f.sql.executeInTransaction(() -> { + row.updateRequiredString("Outer replay first"); + row.auditAs("Stage the first version inside the caller transaction").save(f.context); + assigned[0] = row.getId(); + assertEquals(Long.valueOf(create ? 1 : 2), row.getVersion()); + if (kind.equals("same-native-field")) row.updateRequiredString("Outer replay latest"); + else row.updateOptionalString("Outer replay latest note"); + if (!kind.equals("unsaved-native-field")) { + row.auditAs("Stage another edit before the caller decides to roll back").save(f.context); + assertEquals(Long.valueOf(create ? 2 : 3), row.getVersion()); + } + assertEquals(audits, f.audits.size()); + throw new IllegalStateException("INTENTIONAL_OUTER_REPLAY_ROLLBACK"); + })); + assertEquals("INTENTIONAL_OUTER_REPLAY_ROLLBACK", error.getMessage()); + assertFalse(f.sql.hasActiveTransaction()); assertEquals(audits, f.audits.size()); + long id = assigned[0]; assertTrue(id > 0); var key = new EntityKey("ScalarTypeProbe", id); + assertEquals(Long.valueOf(id), row.getId()); + assertEquals(create ? null : Long.valueOf(1), row.getVersion()); + if (create) { + assertEquals(EntityStatus.NEW, row.get$status()); assertTrue(row.getEntityMutationLedger().isNew(key)); + try (var connection = DriverManager.getConnection(f.data.url); + var query = connection.prepareStatement("SELECT count(*) FROM scalar_type_probe_data WHERE id=?")) { + query.setLong(1, id); try (var result = query.executeQuery()) { assertTrue(result.next()); assertEquals(0, result.getInt(1)); } + } + } else { + f.oracle(id, "Outer replay original", 1, root.getId()); + assertEquals(Long.valueOf(1), row.getEntityMutationLedger().getOriginalVersion(key)); + } + String expectedName = kind.equals("same-native-field") ? "Outer replay latest" : "Outer replay first"; + assertEquals("later saved intent must survive rollback", expectedName, E.scalarTypeProbe(row).getRequiredString().eval()); + if (!kind.equals("same-native-field")) { + assertEquals("later saved or unsaved note must survive rollback", "Outer replay latest note", E.scalarTypeProbe(row).getOptionalString().eval()); + assertTrue(row.getUpdatedProperties().contains("optional_string")); + } + assertTrue(row.getUpdatedProperties().contains("required_string")); + row.auditAs("Retry all final intent against the original database version").save(f.context); + long version = create ? 1 : 2; + assertEquals(Long.valueOf(version), row.getVersion()); assertEquals(audits + 1, f.audits.size()); + f.oracle(id, expectedName, version, root.getId()); + try (var connection = DriverManager.getConnection(f.data.url); + var query = connection.prepareStatement("SELECT optional_string FROM scalar_type_probe_data WHERE id=?")) { + query.setLong(1, id); try (var result = query.executeQuery()) { + assertTrue(result.next()); assertEquals(kind.equals("same-native-field") ? null : "Outer replay latest note", result.getString(1)); assertFalse(result.next()); + } + } + System.out.println("JAVA_OUTER_REPLAY=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "case", kind, "round", round, "id", id, "version", version, "auditDelta", f.audits.size()-audits, + "idAssignedBeforeFirstSave", idBeforeFirstSave != null))); + } + + @Test public void differentNativeFields() throws Exception { verify("different-native-fields"); } + @Test public void sameNativeField() throws Exception { verify("same-native-field"); } + @Test public void unsavedNativeField() throws Exception { verify("unsaved-native-field"); } + @Test public void newThenUpdate() throws Exception { verify("new-then-update"); } + + private void verifyDynamic(boolean unsaved) throws Exception { + String kind = unsaved ? "dynamic-saved-unsaved" : "dynamic-then-native"; + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var f = fixture(kind); var root = f.root("Outer replay root"); + var seed = f.probe(root, "Outer dynamic original"); seed.auditAs("Seed the outer dynamic owner").save(f.context); + var provider = new JdbcDynamicFieldsProvider(f.sql); provider.ensureSchema(); + var ids = new java.util.concurrent.atomic.AtomicLong(10000L * round); + DynamicFieldContext definitions = new DynamicFieldContext() { + public String scopeType() { return "GLOBAL"; } + public String scopeId() { return "default"; } + public String userId() { return "outer-replay"; } + public String purpose() { return "Verify dynamic retry across physical rollback"; } + public String comment() { return "Register the controlled replay extensions"; } + public boolean strictIntent() { return true; } + public long nextId(String type) { return ids.incrementAndGet(); } + }; + String edited = "edited_" + round, hidden = "hidden_" + round; + for (String code : List.of(edited, hidden)) { + var def = new DynamicFieldDef(); def.setScope(DynamicFieldScope.global()); def.setOwnerType("ScalarTypeProbe"); + def.setCode(code); def.setName(code); def.setDataType(DynamicDataType.STRING); provider.registerFieldDef(definitions, def); + } + f.context.putAttribute(DynamicFieldsFacade.class.getName(), new DefaultDynamicFieldsFacade(provider).withIdGenerator(type -> ids.incrementAndGet())); + var all = new DynamicFieldSelection().selectString(edited).selectString(hidden); + var load = Q.scalarTypeProbes().withIdIs(seed.getId()).limit(1); load.selectDynamicFieldsWith(all); + var initial = load.comment("Load both extension definitions").purpose("Seed all extensions through audited save").executeForOne(f.context); + initial.updateDynamicField(edited, "original extension"); initial.updateDynamicField(hidden, "retain hidden extension"); + initial.auditAs("Seed the selected and unselected extension controls").save(f.context); + var selected = Q.scalarTypeProbes().withIdIs(seed.getId()).limit(1); + selected.selectDynamicFieldsWith(new DynamicFieldSelection().selectString(edited)); + var row = selected.comment("Load only the extension that will be modified") + .purpose("Preserve the unselected stored value across retry").executeForOne(f.context); + int audits = f.audits.size(); + var error = assertThrows(IllegalStateException.class, () -> f.sql.executeInTransaction(() -> { + row.updateDynamicField(edited, "saved extension"); row.auditAs("Stage a dynamic edit").save(f.context); + row.updateRequiredString("Outer dynamic latest"); row.auditAs("Stage a later native edit").save(f.context); + if (unsaved) row.updateDynamicField(edited, "unsaved extension"); + assertEquals(audits, f.audits.size()); throw new IllegalStateException("INTENTIONAL_DYNAMIC_REPLAY_ROLLBACK"); + })); + assertEquals("INTENTIONAL_DYNAMIC_REPLAY_ROLLBACK", error.getMessage()); + f.oracle(row.getId(), "Outer dynamic original", 2, root.getId()); + assertEquals(Long.valueOf(2), row.getVersion()); assertEquals(audits, f.audits.size()); + assertEquals("Outer dynamic latest", E.scalarTypeProbe(row).getRequiredString().eval()); + String expected = unsaved ? "unsaved extension" : "saved extension"; + assertEquals(expected, row.dynamicFields().field(edited).value()); + assertEquals(DynamicFieldValue.State.NOT_LOADED, row.dynamicFields().field(hidden).state()); + assertTrue(row.dynamicFields().metadata().matchesStorage(f.sql.storageIdentity(), "GLOBAL", "default", "ScalarTypeProbe")); + assertEquals("original extension", row.__internalDynamicOriginalValues().get(edited).value()); + row.auditAs("Retry native and dynamic final intent together").save(f.context); + f.oracle(row.getId(), "Outer dynamic latest", 3, root.getId()); assertEquals(audits + 1, f.audits.size()); + var reload = Q.scalarTypeProbes().withIdIs(row.getId()).limit(1); reload.selectDynamicFieldsWith(all); + var stored = reload.comment("Reload both stored extensions after retry") + .purpose("Verify persistence without exposing the hidden field to mutation").executeForOne(f.context); + assertEquals(expected, stored.dynamicFields().field(edited).value()); + assertEquals("retain hidden extension", stored.dynamicFields().field(hidden).value()); + System.out.println("JAVA_OUTER_REPLAY=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "case", kind, "round", round, "id", row.getId(), "version", row.getVersion(), "auditDelta", f.audits.size()-audits))); + } + + @Test public void dynamicThenNative() throws Exception { verifyDynamic(false); } + @Test public void dynamicSavedAndUnsaved() throws Exception { verifyDynamic(true); } + + @Test public void rawAdmissionIsNotBypassedByRollback() throws Exception { + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); var f = fixture("raw-admission"); + var root = f.root("Outer replay root"); var seed = f.probe(root, "Outer raw original"); + seed.auditAs("Seed the raw admission control").save(f.context); var row = f.load(seed.getId()); + var key = new EntityKey("ScalarTypeProbe", row.getId()); int audits = f.audits.size(); + var error = assertThrows(IllegalStateException.class, () -> f.sql.executeInTransaction(() -> { + row.updateRequiredString("Outer raw latest"); row.auditAs("Stage a valid native edit").save(f.context); + row.getEntityMutationLedger().set(key, "unknown_field", "PRIVATE_ROLLBACK_CANARY"); + row.getEntityMutationLedger().set(key, "optional_string", null); + throw new IllegalStateException("INTENTIONAL_RAW_REPLAY_ROLLBACK"); + })); + assertEquals("INTENTIONAL_RAW_REPLAY_ROLLBACK", error.getMessage()); + assertTrue(row.getEntityMutationLedger().containsField(key, "unknown_field")); + assertTrue(row.getEntityMutationLedger().containsField(key, "optional_string")); + assertNull(row.getEntityMutationLedger().get(key, "optional_string")); + long calls = f.data.calls; int policies = f.policies.size(); + var rejection = assertThrows(CheckException.class, () -> row.auditAs("Retain invalid raw input for the normal model admission").save(f.context)); + assertTrue(rejection.getViolates().stream().anyMatch(value -> value.getRuleId() == CheckResult.RuleId.UNKNOWN_FIELD)); + assertFalse(rejection.getMessage().contains("PRIVATE_ROLLBACK_CANARY")); + assertEquals(calls, f.data.calls); assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + assertEquals(Long.valueOf(1), row.getVersion()); f.oracle(row.getId(), "Outer raw original", 1, root.getId()); + System.out.println("JAVA_OUTER_REPLAY=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "case", "raw-admission", "round", round, "id", row.getId(), "version", row.getVersion(), "auditDelta", 0))); + } +} diff --git a/examples/scalar-type-probe/GeneratedRejectedMutationTest.java b/examples/scalar-type-probe/GeneratedRejectedMutationTest.java new file mode 100644 index 000000000..28e0e3750 --- /dev/null +++ b/examples/scalar-type-probe/GeneratedRejectedMutationTest.java @@ -0,0 +1,77 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.runtime.TeaQLRuntime; +import io.teaql.jackson.TeaQLModule; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.LinkedHashMap; +import java.util.List; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Real generated references must remain NotLoaded after rejected changes. */ +public class GeneratedRejectedMutationTest { + static void unchanged(TypePlatform reference,LoadState state){ + assertSame(state,reference.__internalLoadState());assertEquals(EntityStatus.REFER,reference.get$status()); + assertNull(reference.getVersion());assertNull(reference.getOriginalVersion());assertNull(reference.__internalGet("name")); + assertFalse(reference.isPropertyLoaded("name"));assertFalse(reference.isPropertyLoaded("version")); + assertFalse(reference.__internalHasMutationLedger());assertTrue(reference.getUpdatedProperties().isEmpty()); + } + @Test public void rejectedChangesDoNotCorruptTheGeneratedGraph()throws Exception{ + int round=Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var expected=Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for(var type:List.of(TeaQLRuntime.class,TeaQLModule.class))assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + var f=new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:"+Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(),round); + var root=f.root("Rejected mutation root "+round);var created=f.probe(root,"rejected "+round); + created.auditAs("Persist the rejected-mutation graph").save(f.context); + var owner=f.load(created.getId()); + var reference=E.scalarTypeProbe(owner).getTypePlatform().eval(); + assertEquals(root.getId(),E.scalarTypeProbe(owner).getTypePlatform().getId().eval()); + var state=reference.__internalLoadState();unchanged(reference,state); + long before=f.data.calls;int auditCount=f.audits.size(),policyCount=f.policies.size();int rejected=0; + assertThrows(TeaQLRuntimeException.class,()->reference.updateName("must not appear"));unchanged(reference,state);rejected++; + assertThrows(TeaQLRuntimeException.class,()->reference.updateProperty("name","must not appear either"));unchanged(reference,state);rejected++; + assertThrows(TeaQLRuntimeException.class,()->reference.updateVersion(9L));unchanged(reference,state);rejected++; + // Explicit negative fault injection through the legacy runtime cache + // seam; this is not an application API discovery/recommendation. + assertThrows(TeaQLRuntimeException.class,()->reference.cacheRelation("negative_cache",owner));unchanged(reference,state);rejected++; + assertFalse(reference.isPropertyLoaded("negative_cache")); + var missing=assertThrows(TeaQLNotLoadedException.class,()->E.scalarTypeProbe(owner).getTypePlatform().getName().eval()); + assertEquals("/typePlatform/name",missing.toWire().instancePath()); + assertEquals(before,f.data.calls);assertEquals(auditCount,f.audits.size());assertEquals(policyCount,f.policies.size()); + + var partial=Q.scalarTypeProbesWithMinimalFields().withIdIs(created.getId()).selectRequiredString().limit(1) + .comment("Load a partial mutation rejection probe").purpose("Keep missing fields distinct from rejected assignments").executeForOne(f.context); + var partialState=partial.__internalLoadState();assertFalse(partial.__internalHasMutationLedger());before=f.data.calls; + assertThrows(ClassCastException.class,()->partial.updateProperty("required_integer","wrong type"));rejected++; + assertSame(partialState,partial.__internalLoadState());assertFalse(partial.isPropertyLoaded("required_integer")); + assertFalse(partial.__internalHasMutationLedger()); + assertThrows(TeaQLNotLoadedException.class,()->E.scalarTypeProbe(partial).getRequiredInteger().eval()); + assertEquals(before,f.data.calls); + partial.updateRequiredString("keep pending partial intent"); + assertThrows(CheckException.class,()->partial.auditAs("Reject an incomplete modified object").save(f.context));rejected++; + assertEquals(before,f.data.calls);assertTrue(partial.needPersist());assertEquals(Long.valueOf(1),partial.getVersion()); + assertEquals(auditCount,f.audits.size());assertEquals(policyCount,f.policies.size()); + + owner.updateRequiredString("rejected "+round+" saved"); + owner.auditAs("Save the complete owner after independent rejected changes").save(f.context); + assertEquals(Long.valueOf(2),owner.getVersion());assertEquals(policyCount+1,f.policies.size());assertEquals(auditCount+1,f.audits.size()); + var plan=f.policies.get(policyCount);assertEquals(1,plan.operations().size());assertEquals(MutationOperationKind.UPDATE,plan.operations().get(0).kind()); + assertEquals("ScalarTypeProbe",plan.operations().get(0).entity().entity()); + f.oracle(owner.getId(),"rejected "+round+" saved",2,root.getId()); + assertEquals("rejected "+round+" saved",E.scalarTypeProbe(f.load(owner.getId())).getRequiredString().eval()); + try(var connection=DriverManager.getConnection(f.data.url);var statement=connection.prepareStatement("SELECT name,version FROM type_platform_data WHERE id=?")){ + statement.setLong(1,root.getId());try(var rows=statement.executeQuery()){assertTrue(rows.next());assertEquals("Rejected mutation root "+round,rows.getString(1));assertEquals(1L,rows.getLong(2));assertFalse(rows.next());} + } + var result=new LinkedHashMap();result.put("passed",true);result.put("profile","camelCase");result.put("round",round);result.put("id",owner.getId());result.put("rootId",root.getId()); + result.put("rejectedCalls",rejected);result.put("finalVersion",2);result.put("path",missing.toWire().instancePath()); + for(String key:List.of("payloadRetained","loadStateRetained","ledgerRetained","referenceNotLoaded","failedCastNotLoaded","zeroProviderOnRejection","completeOwnerSave","unrelatedParentUnchanged"))result.put(key,true); + result.put("generatedEqualNullAccepted",false); + System.out.println("JAVA_REJECTED_MUTATION="+new ObjectMapper().writeValueAsString(result)); + } +} diff --git a/examples/scalar-type-probe/GeneratedRestorationViewTest.java b/examples/scalar-type-probe/GeneratedRestorationViewTest.java new file mode 100644 index 000000000..6fd1160ad --- /dev/null +++ b/examples/scalar-type-probe/GeneratedRestorationViewTest.java @@ -0,0 +1,196 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.data.dynamic.*; +import io.teaql.data.dynamic.jdbc.JdbcDynamicFieldsProvider; +import java.nio.file.Path; +import java.util.*; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Real generated Q/E/audited saves, including a transaction owned by the caller. */ +public class GeneratedRestorationViewTest { + private static GeneratedCanonicalNameTest.Fixture fixture(String name) throws Exception { + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(BaseEntity.class, io.teaql.runtime.TeaQLRuntime.class, + io.teaql.provider.jdbc.JdbcSqlExecutor.class, io.teaql.core.sqlite.SqliteDataServiceExecutor.class)) { + var origin = Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath(); + assertTrue("local reactor origin: " + type.getName(), origin.startsWith(expected)); + } + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + return new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:" + + Path.of(System.getenv("TEAQL_NAME_DB") + ".views-" + name + ".sqlite").toAbsolutePath(), round); + } + + private static ScalarTypeProbe sparse(GeneratedCanonicalNameTest.Fixture f, long id) { + var query = Q.scalarTypeProbesWithMinimalFields().withIdIs(id).selectRequiredString() + .selectOptionalString().limit(1) + .selectTypePlatformWith(Q.typePlatformsWithMinimalFields().selectName()); + query.setDynamicPropertyMetadata(new DynamicPropertyMetadata(Map.of( + "_zero", Number.class, "_null", String.class, "_missing", Long.class))); + query.addSimpleDynamicProperty("_zero", new PropertyReference("optional_integer")); + query.addSimpleDynamicProperty("_null", new PropertyReference("optional_string")); + return query.comment("Load a sparse view with typed readonly results") + .purpose("Retain projection and null presence through an unchanged save").executeForOne(f.context); + } + + private static void assertView(ScalarTypeProbe view, String name) { + assertEquals(name, E.scalarTypeProbe(view).getRequiredString().eval()); + assertNull(E.scalarTypeProbe(view).getOptionalString().eval()); + assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(view).getRequiredLong().eval()); + assertEquals("View root", E.scalarTypeProbe(view).getTypePlatform().getName().eval()); + assertSame(Long.class, view.getDynamicPropertyType("_missing")); + assertNull(view.getDynamicProperty("_missing")); assertFalse(view.hasDynamicProperty("_missing")); + assertTrue(view.hasDynamicProperty("_null")); assertNull(view.getDynamicProperty("_null")); + assertEquals(0, ((Number) view.getDynamicProperty("_zero")).intValue()); + assertTrue(view.getUpdatedProperties().isEmpty()); + } + + @Test public void unchangedSparseViewRetainsReadonlyPresenceAndRelations() throws Exception { + var f = fixture("readonly"); var root = f.root("View root"); + var created = f.probe(root, "View row").updateOptionalInteger(0); + created.auditAs("Seed the sparse unchanged view").save(f.context); + var view = sparse(f, created.getId()); var state = view.__internalLoadState(); + var relation = view.getTypePlatform(); + long calls = f.data.calls; int policies = f.policies.size(), audits = f.audits.size(); + view.updateRequiredString("temporary"); view.updateRequiredString("View row"); + view.auditAs("Save a restored sparse view without refreshing it").save(f.context); + assertEquals(calls, f.data.calls); assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + assertSame(state, view.__internalLoadState()); assertSame(relation, view.getTypePlatform()); + assertView(view, "View row"); assertEquals(Long.valueOf(1), view.getVersion()); + var foreign = root.__internalLoadState(); + assertThrows(IllegalArgumentException.class, () -> view.__internalUseLoadState(foreign)); + assertSame(state, view.__internalLoadState()); assertView(view, "View row"); + f.oracle(created.getId(), "View row", 1, root.getId()); + System.out.println("JAVA_RESTORATION_VIEW=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "case", "readonly-sparse-noop", "round", Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")), + "id", created.getId(), "version", view.getVersion(), "providerDelta", f.data.calls - calls))); + } + + @Test public void callerOwnsTransactionAuditAndRetryAfterRollback() throws Exception { + var f = fixture("transaction"); var root = f.root("View root"); + var clean = f.probe(root, "Outer unchanged").updateOptionalInteger(0); + clean.auditAs("Seed an unchanged outer transaction participant").save(f.context); + var dirty = f.probe(root, "Outer original"); + dirty.auditAs("Seed an independently edited transaction participant").save(f.context); + var view = sparse(f, clean.getId()); var state = view.__internalLoadState(); + dirty = f.load(dirty.getId()); dirty.updateRequiredString("Outer retry"); + final var edited = dirty; int audits = f.audits.size(), policies = f.policies.size(); + var error = assertThrows(IllegalStateException.class, () -> f.sql.executeInTransaction(() -> { + long calls = f.data.calls; + view.auditAs("A no-op must not finish the caller transaction").save(f.context); + assertEquals(calls, f.data.calls); assertTrue(f.sql.hasActiveTransaction()); + assertSame(state, view.__internalLoadState()); assertView(view, "Outer unchanged"); + edited.auditAs("Roll back an independent real edit").save(f.context); + assertEquals("audit must wait for outer commit", audits, f.audits.size()); + throw new IllegalStateException("INTENTIONAL_OUTER_ROLLBACK"); + })); + assertEquals("INTENTIONAL_OUTER_ROLLBACK", error.getMessage()); + assertFalse(f.sql.hasActiveTransaction()); assertEquals(audits, f.audits.size()); + f.oracle(edited.getId(), "Outer original", 1, root.getId()); + assertEquals(Long.valueOf(1), edited.getVersion()); + assertTrue(edited.getUpdatedProperties().contains("required_string")); + assertEquals(Long.valueOf(1), edited.getEntityMutationLedger().getOriginalVersion( + new EntityKey("ScalarTypeProbe", edited.getId()))); + edited.auditAs("Retry original optimistic intent after outer rollback").save(f.context); + assertEquals(audits + 1, f.audits.size()); assertEquals(Long.valueOf(2), edited.getVersion()); + f.oracle(edited.getId(), "Outer retry", 2, root.getId()); + edited.updateOptionalString("Outer committed"); + f.sql.executeInTransaction(() -> { + long calls = f.data.calls; + view.auditAs("Keep the unchanged sparse view inside the commit scope").save(f.context); + assertEquals(calls, f.data.calls); + edited.auditAs("Commit only the genuinely changed object").save(f.context); + assertEquals(audits + 1, f.audits.size()); assertTrue(f.sql.hasActiveTransaction()); + }); + assertEquals(audits + 2, f.audits.size()); assertEquals(policies + 3, f.policies.size()); + assertSame(state, view.__internalLoadState()); assertView(view, "Outer unchanged"); + assertEquals(Long.valueOf(1), view.getVersion()); assertEquals(Long.valueOf(3), edited.getVersion()); + assertTrue(edited.getUpdatedProperties().isEmpty()); + f.oracle(clean.getId(), "Outer unchanged", 1, root.getId()); + f.oracle(edited.getId(), "Outer retry", 3, root.getId()); + System.out.println("JAVA_RESTORATION_VIEW=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "case", "caller-transaction-rollback-retry-commit", "round", Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")), + "unchangedId", clean.getId(), "editedId", edited.getId(), "auditDelta", f.audits.size() - audits, + "policyDelta", f.policies.size() - policies, "finalVersion", edited.getVersion()))); + } + + @Test public void persistentFieldsKeepNullMissingProvenanceAndIndependentIntent() throws Exception { + var f = fixture("dynamic"); var root = f.root("View root"); + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var ids = new java.util.concurrent.atomic.AtomicLong(round * 10000L); + var provider = new JdbcDynamicFieldsProvider(f.sql); provider.ensureSchema(); + DynamicFieldContext definitionContext = new DynamicFieldContext() { + public String scopeType() { return "GLOBAL"; } + public String scopeId() { return "default"; } + public String userId() { return "restoration-example"; } + public String purpose() { return "Verify persistent extension view geometry"; } + public String comment() { return "Register controlled extension definitions"; } + public boolean strictIntent() { return true; } + public long nextId(String type) { return ids.incrementAndGet(); } + }; + String selected = "selected_" + round, hidden = "hidden_" + round; + for (String code : List.of(selected, hidden)) { + var def = new DynamicFieldDef(); def.setScope(DynamicFieldScope.global()); + def.setOwnerType("ScalarTypeProbe"); def.setCode(code); def.setName(code); def.setDataType(DynamicDataType.STRING); + provider.registerFieldDef(definitionContext, def); + } + f.context.putAttribute(DynamicFieldsFacade.class.getName(), + new DefaultDynamicFieldsFacade(provider).withIdGenerator(type -> ids.incrementAndGet())); + var first = f.probe(root, "Dynamic value"); var second = f.probe(root, "Dynamic null"); + first.auditAs("Seed the extension value owner").save(f.context); + second.auditAs("Seed the extension null owner").save(f.context); + var all = new DynamicFieldSelection().selectString(selected).selectString(hidden); + for (var owner : List.of(first, second)) { + var request = Q.scalarTypeProbes().withIdIs(owner.getId()).limit(1); + request.selectDynamicFieldsWith(all); + var loaded = request.comment("Load extension definitions before setting values") + .purpose("Seed extensions through normal audited mutation").executeForOne(f.context); + loaded.updateDynamicField(selected, owner == first ? "baseline" : null); + loaded.updateDynamicField(hidden, "retain hidden"); + loaded.auditAs("Persist controlled extension values").save(f.context); + } + var children = Q.scalarTypeProbes().orderByIdAscending().limit(10); + children.selectDynamicFieldsWith(new DynamicFieldSelection().selectString(selected)); + var graph = Q.typePlatforms().withIdIs(root.getId()).limit(1).selectScalarTypeProbeListWith(children) + .comment("Load both extension presence states in one graph") + .purpose("Share immutable geometry while retaining private row values").executeForOne(f.context); + var rows = graph.getScalarTypeProbeList(); assertEquals(2, rows.size()); + var value = rows.get(0); var nullRow = rows.get(1); var state = value.__internalLoadState(); + assertSame(state, nullRow.__internalLoadState()); + assertEquals("baseline", value.dynamicFields().field(selected).value()); + assertEquals(DynamicFieldValue.State.NULL, nullRow.dynamicFields().field(selected).state()); + for (var row : rows.getData()) { + assertEquals(DynamicFieldValue.State.NOT_LOADED, row.dynamicFields().field(hidden).state()); + assertTrue(row.dynamicFields().metadata().matchesStorage(f.sql.storageIdentity(), "GLOBAL", "default", "ScalarTypeProbe")); + } + var metadata = value.dynamicFields().metadata(); var selection = value.dynamicFields().selectedCodes(); + long calls = f.data.calls; int policies = f.policies.size(), audits = f.audits.size(); + value.updateRequiredString("temporary"); value.updateRequiredString("Dynamic value"); + value.auditAs("Retain persistent metadata through a no-op").save(f.context); + assertEquals(calls, f.data.calls); assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + assertSame(state, value.__internalLoadState()); assertSame(metadata, value.dynamicFields().metadata()); + assertEquals(selection, value.dynamicFields().selectedCodes()); + value.updateDynamicField(selected, "real extension edit"); + value.updateRequiredString("temporary again"); value.updateRequiredString("Dynamic value"); + value.auditAs("Keep a real extension edit after native restoration").save(f.context); + assertEquals(policies + 1, f.policies.size()); assertEquals(audits + 1, f.audits.size()); + assertEquals(Long.valueOf(3), value.getVersion()); + assertEquals("real extension edit", value.dynamicFields().field(selected).value()); + assertEquals(DynamicFieldValue.State.NOT_LOADED, value.dynamicFields().field(hidden).state()); + assertEquals(DynamicFieldValue.State.NULL, nullRow.dynamicFields().field(selected).state()); + assertSame(state, nullRow.__internalLoadState()); assertEquals(Long.valueOf(2), nullRow.getVersion()); + var check = Q.scalarTypeProbes().withIdIs(first.getId()).limit(1); check.selectDynamicFieldsWith(all); + var stored = check.comment("Reload stored extensions independently") + .purpose("Prove hidden values and explicit null survive a separate native restoration").executeForOne(f.context); + assertEquals("retain hidden", stored.dynamicFields().field(hidden).value()); + assertEquals("real extension edit", stored.dynamicFields().field(selected).value()); + f.oracle(first.getId(), "Dynamic value", 3, root.getId()); + System.out.println("JAVA_RESTORATION_VIEW=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", true, "case", "persistent-dynamic-noop-and-real-edit", "round", round, + "id", value.getId(), "nullId", nullRow.getId(), "finalVersion", value.getVersion()))); + } +} diff --git a/examples/scalar-type-probe/GeneratedSqlMillisecondTest.java b/examples/scalar-type-probe/GeneratedSqlMillisecondTest.java new file mode 100644 index 000000000..3f84cc21f --- /dev/null +++ b/examples/scalar-type-probe/GeneratedSqlMillisecondTest.java @@ -0,0 +1,179 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.core.sql.portable.SqlTemporalPrecisionException; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; +import org.junit.Test; +import static org.junit.Assert.*; + +/** New canonical SQL round trips and explicit rejection of incompatible legacy rows. */ +public class GeneratedSqlMillisecondTest { + static final List ZONES = List.of("UTC", "America/New_York", "Asia/Shanghai"); + static final List INPUTS = List.of( + LocalDateTime.of(2024, 3, 10, 2, 30, 0, 123000000), + LocalDateTime.of(2024, 3, 10, 2, 30, 0, 123456789), + LocalDateTime.of(2024, 3, 10, 2, 30, 59, 999999999), + LocalDateTime.of(1960, 2, 29, 23, 59, 59, 987654321), + LocalDateTime.of(1969, 12, 31, 23, 59, 59, 999999999), + LocalDateTime.of(2032, 2, 29, 12, 30)); + + static int round() { return Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); } + static GeneratedCanonicalNameTest.Fixture fixture(String name) throws Exception { + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(TeaQLRuntime.class, TeaQLModule.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + return new GeneratedCanonicalNameTest.Fixture( + "jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB") + ".sql-millis-" + name).toAbsolutePath(), round()); + } + static ScalarTypeProbe equal(GeneratedCanonicalNameTest.Fixture f, long id, LocalDateTime value) { + return Q.scalarTypeProbes().withIdIs(id).withRequiredDatetimeIs(value).limit(1) + .comment("Find a probe by its canonical SQL datetime") + .purpose("Verify generated datetime predicate precision").executeForOne(f.context); + } + static void physical(GeneratedCanonicalNameTest.Fixture f, long id, LocalDateTime value, long version) throws Exception { + try (var connection = DriverManager.getConnection(f.data.url); + var statement = connection.prepareStatement("SELECT required_datetime,version FROM scalar_type_probe_data WHERE id=?")) { + statement.setLong(1, id); + try (var rows = statement.executeQuery()) { + assertTrue(rows.next()); + var stored = LocalDateTime.parse(rows.getString(1).replace(' ', 'T')); + assertEquals(value, stored); assertEquals(0, stored.getNano() % 1000000); + assertEquals(version, rows.getLong(2)); assertFalse(rows.next()); + } + } + } + static void emit(String name, int cases) throws Exception { + System.out.println("JAVA_SQL_MILLISECOND=" + new ObjectMapper().writeValueAsString(Map.of( + "case", name, "cases", cases, "round", round(), "passed", true, + "legacyMigrationRejectionAccepted", name.equals("legacy-rejection"), + "legacySqlPrecisionAccepted", false, "businessClockChanged", false))); + } + + @Test public void generatedSaveEqualityAndEUseTheSameMillisecondBoundary() throws Exception { + var previous = TimeZone.getDefault(); + try { + var f = fixture("matrix"); var root = f.root("SQL precision matrix round " + round()); int checked = 0; + for (var zone : ZONES) { + TimeZone.setDefault(TimeZone.getTimeZone(zone)); + for (var input : INPUTS) { + var expected = input.truncatedTo(ChronoUnit.MILLIS); + var row = f.probe(root, "SQL millis " + zone + " " + checked); + row.updateRequiredDatetime(input); + assertEquals(input, E.scalarTypeProbe(row).getRequiredDatetime().eval()); + row.auditAs("Persist a generated sub-millisecond datetime").save(f.context); + assertEquals(expected, E.scalarTypeProbe(row).getRequiredDatetime().eval()); + assertEquals(Long.valueOf(1), row.getVersion()); + var loaded = f.load(row.getId()); + assertEquals(expected, E.scalarTypeProbe(loaded).getRequiredDatetime().eval()); + assertEquals(row.getId(), equal(f, row.getId(), expected).getId()); + assertEquals(row.getId(), equal(f, row.getId(), input).getId()); + assertNull(equal(f, row.getId(), expected.plus(1, ChronoUnit.MILLIS))); + physical(f, row.getId(), expected, 1); checked++; + } + } + assertEquals(18, checked); emit("matrix-save-query-e", checked); + } finally { TimeZone.setDefault(previous); } + } + + @Test public void generatedAuditedUpdateReadsBackCanonicalValueAndRemainsQueryable() throws Exception { + var previous = TimeZone.getDefault(); + try { + var f = fixture("update"); var root = f.root("SQL precision update round " + round()); + for (var zone : ZONES) { + TimeZone.setDefault(TimeZone.getTimeZone(zone)); + var row = f.probe(root, "SQL millis update " + zone); + row.updateRequiredDatetime(INPUTS.get(0)); row.auditAs("Seed canonical datetime").save(f.context); + var update = f.load(row.getId()); var input = INPUTS.get(3); var expected = input.truncatedTo(ChronoUnit.MILLIS); + update.updateRequiredDatetime(input); int audits = f.audits.size(); + update.auditAs("Update a generated datetime with authoritative SQL readback").save(f.context); + assertEquals(audits + 1, f.audits.size()); assertEquals(Long.valueOf(2), update.getVersion()); + assertEquals(expected, E.scalarTypeProbe(update).getRequiredDatetime().eval()); + var loaded = equal(f, row.getId(), input); assertNotNull(loaded); + assertEquals(expected, E.scalarTypeProbe(loaded).getRequiredDatetime().eval()); + assertEquals(Long.valueOf(2), loaded.getVersion()); physical(f, row.getId(), expected, 2); + } + emit("update-equality", 3); + } finally { TimeZone.setDefault(previous); } + } + + @Test public void nativeGeneratedJsonRetainsNanosecondsWithoutProviderOrAudit() throws Exception { + var f = fixture("json"); var mapper = new ObjectMapper().registerModule(new TeaQLModule(f.context)); + long calls = f.data.calls; int audits = f.audits.size(), policies = f.policies.size(); int checked = 0; + for (var zone : ZONES) { + var zoned = mapper.copy().setTimeZone(TimeZone.getTimeZone(zone)); + for (var input : INPUTS) { + var json = mapper.createObjectNode().put("requiredDatetime", input.toString()); + var decoded = zoned.treeToValue(json, ScalarTypeProbe.class); + assertEquals(input, E.scalarTypeProbe(decoded).getRequiredDatetime().eval()); + var encoded = zoned.readTree(zoned.writeValueAsString(decoded)); + assertEquals(input, LocalDateTime.parse(encoded.path("requiredDatetime").textValue())); + assertFalse(decoded.__internalHasMutationLedger()); checked++; + } + } + assertEquals(calls, f.data.calls); assertEquals(audits, f.audits.size()); assertEquals(policies, f.policies.size()); + emit("native-json", checked); + } + + @Test public void omittedDatetimeRemainsNotLoadedRatherThanBecomingNull() throws Exception { + var f = fixture("projection"); var root = f.root("SQL precision projection round " + round()); + var row = f.probe(root, "SQL millis minimal"); row.updateRequiredDatetime(INPUTS.get(0)); + row.auditAs("Seed a bounded datetime projection").save(f.context); + long audits = f.audits.size(), policies = f.policies.size(); + var minimal = Q.scalarTypeProbesWithMinimalFields().withIdIs(row.getId()).selectRequiredString().limit(1) + .comment("Load a probe without its datetime field") + .purpose("Preserve unselected datetime load state").executeForOne(f.context); + assertEquals(row.getId(), minimal.getId()); + assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(minimal).getRequiredDatetime().eval()); + assertEquals(audits, f.audits.size()); assertEquals(policies, f.policies.size()); + emit("minimal-projection", 1); + } + + @Test public void legacySqlValuesRejectWithFieldDiagnosticsAndRemainPhysicallyUnchanged() throws Exception { + var f = fixture("legacy"); var root = f.root("SQL legacy precision round " + round()); + var row = f.probe(root, "Legacy precision negative fixture"); + row.updateRequiredDatetime(INPUTS.get(0)); + row.auditAs("Seed a valid object before legacy corruption injection").save(f.context); + String legacy = "2026-11-10 12:34:56.123456789"; + try (var connection = DriverManager.getConnection(f.data.url); + var statement = connection.prepareStatement("UPDATE scalar_type_probe_data SET required_datetime=? WHERE id=?")) { + // Explicit fault injection of a pre-existing incompatible representation. + // Normal setup and all business operations use generated mutations. + statement.setString(1, legacy); statement.setLong(2, row.getId()); + assertEquals(1, statement.executeUpdate()); + } + long audits = f.audits.size(), policies = f.policies.size(); + for (int attempt = 0; attempt < 2; attempt++) { + var error = assertThrows(SqlTemporalPrecisionException.class, () -> f.load(row.getId())); + assertEquals("SQL_DATETIME_PRECISION_MISMATCH", error.getCode()); + assertEquals("ScalarTypeProbe", error.getEntityType()); assertEquals("required_datetime", error.getField()); + assertEquals("/requiredDatetime", error.getPath()); assertEquals("milliseconds", error.getExpectedPrecision()); + assertTrue(error.isMigrationRequired()); assertTrue(error.getSuggestedFix().contains("Migrate")); + assertFalse(error.toString().contains(legacy)); assertNull(error.getCause()); + } + var minimal = Q.scalarTypeProbesWithMinimalFields().withIdIs(row.getId()).selectRequiredString().limit(1) + .comment("Read a projection that intentionally excludes the incompatible legacy field") + .purpose("Keep SQL precision rejection local to selected fields").executeForOne(f.context); + assertEquals(row.getId(), minimal.getId()); + assertThrows(TeaQLNotLoadedException.class, () -> E.scalarTypeProbe(minimal).getRequiredDatetime().eval()); + assertEquals(audits, f.audits.size()); assertEquals(policies, f.policies.size()); + try (var connection = DriverManager.getConnection(f.data.url); + var statement = connection.prepareStatement("SELECT required_datetime,version FROM scalar_type_probe_data WHERE id=?")) { + statement.setLong(1, row.getId()); + try (var stored = statement.executeQuery()) { + assertTrue(stored.next()); assertEquals(legacy, stored.getString(1)); + assertEquals(1, stored.getLong(2)); assertFalse(stored.next()); + } + } + emit("legacy-rejection", 4); + } +} diff --git a/examples/scalar-type-probe/GeneratedVersionLifecycleTest.java b/examples/scalar-type-probe/GeneratedVersionLifecycleTest.java new file mode 100644 index 000000000..d34679eff --- /dev/null +++ b/examples/scalar-type-probe/GeneratedVersionLifecycleTest.java @@ -0,0 +1,110 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import io.teaql.jackson.TeaQLModule; +import io.teaql.runtime.TeaQLRuntime; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.*; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Generated Q/E/audited Save with exact real SQLite version endpoints. */ +public class GeneratedVersionLifecycleTest { + static void injectStoredVersion(GeneratedCanonicalNameTest.Fixture f, long id, long version) throws Exception { + // Deliberate boundary fault injection after the normal generated create. + try (var connection = DriverManager.getConnection(f.data.url); + var statement = connection.prepareStatement("UPDATE scalar_type_probe_data SET version=? WHERE id=? AND version=1")) { + statement.setLong(1, version); statement.setLong(2, id); assertEquals(1, statement.executeUpdate()); + } + } + static void reject(GeneratedCanonicalNameTest.Fixture f, ScalarTypeProbe entity, String pending) { + long calls = f.data.calls; int checks = f.checked.size(), policies = f.policies.size(), audits = f.audits.size(); + long version = entity.getVersion(); var status = entity.get$status(); Long baseline = entity.getOriginalVersion(); + var error = assertThrows(CheckException.class, () -> entity.auditAs("Reject exhausted optimistic version before customer code").save(f.context)); + assertEquals(calls, f.data.calls); assertEquals(checks, f.checked.size()); + assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + assertEquals("VERSION_EXHAUSTED", error.getViolates().get(0).getRuleId().name()); + assertEquals("/version", error.getViolates().get(0).getLocation().instancePath()); + assertTrue(error.getCause() instanceof MutationVersionException); + assertEquals(Long.valueOf(version), entity.getVersion()); assertEquals(status, entity.get$status()); + // A completed save clears ledger originals; in that case the current + // authoritative version is the baseline. Rejection must preserve both. + assertEquals(baseline, entity.getOriginalVersion()); + if (pending != null) { + assertEquals(Long.valueOf(version), baseline); // fresh Q hydration + assertEquals(pending, E.scalarTypeProbe(entity).getRequiredString().eval()); + assertEquals(pending, entity.getEntityMutationLedger().get(new EntityKey("ScalarTypeProbe", entity.getId()), "required_string")); + } + } + @Test public void exactVersionsThroughGeneratedQueryExpressionJsonAndAuditedSave() throws Exception { + int round = Integer.parseInt(System.getenv("TEAQL_NAME_ROUND")); + var expected = Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for (var type : List.of(MutationVersions.class, TeaQLRuntime.class, TeaQLModule.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + var f = new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:" + Path.of(System.getenv("TEAQL_NAME_DB")).toAbsolutePath(), round); + var root = f.root("Version boundary root " + round); + var mapper = new ObjectMapper().findAndRegisterModules().registerModule(new TeaQLModule(f.context)); + var liveIds = new ArrayList(); var deletedIds = new ArrayList(); var recoveredIds = new ArrayList(); + for (String variant : List.of("null", "value")) { + String name = "Version boundary " + round + " " + variant; + var seed = f.probe(root, name).updateOptionalString(variant.equals("null") ? null : "retained note"); + seed.auditAs("Create a complete version-boundary fixture").save(f.context); + injectStoredVersion(f, seed.getId(), Long.MAX_VALUE - 1); + var live = f.load(seed.getId()); live.updateRequiredString(name + " final"); + live.auditAs("Commit the last representable live update").save(f.context); + assertEquals(Long.valueOf(Long.MAX_VALUE), live.getVersion()); + f.oracle(live.getId(), name + " final", Long.MAX_VALUE, root.getId()); + var loaded = f.load(live.getId()); + assertEquals(name + " final", E.scalarTypeProbe(loaded).getRequiredString().eval()); + assertEquals(variant.equals("null") ? null : "retained note", E.scalarTypeProbe(loaded).getOptionalString().eval()); + var json = mapper.valueToTree(loaded); + assertTrue(json.get("version").isTextual()); assertEquals(Long.toString(Long.MAX_VALUE), json.get("version").asText()); + long calls = f.data.calls; int checks = f.checked.size(), policies = f.policies.size(), audits = f.audits.size(); + loaded.auditAs("Leave an unchanged exhausted object alone").save(f.context); + assertEquals(calls, f.data.calls); assertEquals(checks, f.checked.size()); + assertEquals(policies, f.policies.size()); assertEquals(audits, f.audits.size()); + loaded.updateRequiredString(name + " pending"); reject(f, loaded, name + " pending"); + f.oracle(live.getId(), name + " final", Long.MAX_VALUE, root.getId()); liveIds.add(live.getId()); + + var deleteSeed = f.probe(root, name + " delete"); + deleteSeed.auditAs("Create independent deletion fixture after a rejected save").save(f.context); + injectStoredVersion(f, deleteSeed.getId(), Long.MAX_VALUE); + var deleted = f.load(deleteSeed.getId()); deleted.markForDeletion(); + deleted.auditAs("Delete the largest live version without intermediate overflow").save(f.context); + assertEquals(Long.valueOf(Long.MIN_VALUE), deleted.getVersion()); + assertEquals(EntityStatus.PERSISTED_DELETED, deleted.get$status()); + f.oracle(deleted.getId(), name + " delete", Long.MIN_VALUE, root.getId()); + deleted.markAsRecover(); reject(f, deleted, null); deletedIds.add(deleted.getId()); + + var recoverSeed = f.probe(root, name + " recover"); + recoverSeed.auditAs("Create an independent recoverable boundary fixture").save(f.context); + var tree = mapper.valueToTree(recoverSeed); + ((com.fasterxml.jackson.databind.node.ObjectNode) tree).put("version", Long.toString(Long.MIN_VALUE + 2)); + injectStoredVersion(f, recoverSeed.getId(), Long.MIN_VALUE + 2); + var recovered = mapper.treeToValue(tree, ScalarTypeProbe.class); + assertEquals(EntityStatus.PERSISTED_DELETED, recovered.get$status()); + recovered.markAsRecover(); recovered.auditAs("Recover the last representable tombstone").save(f.context); + assertEquals(Long.valueOf(Long.MAX_VALUE), recovered.getVersion()); + assertEquals(name + " recover", E.scalarTypeProbe(f.load(recovered.getId())).getRequiredString().eval()); + f.oracle(recovered.getId(), name + " recover", Long.MAX_VALUE, root.getId()); recoveredIds.add(recovered.getId()); + assertEquals(name + " pending", E.scalarTypeProbe(loaded).getRequiredString().eval()); assertTrue(loaded.needPersist()); + } + try (var connection = DriverManager.getConnection(f.data.url); + var statement = connection.prepareStatement("SELECT name,version FROM type_platform_data WHERE id=?")) { + statement.setLong(1, root.getId()); try (var rows = statement.executeQuery()) { + assertTrue(rows.next()); assertEquals("Version boundary root " + round, rows.getString(1)); assertEquals(1L, rows.getLong(2)); + } + } + var report = new LinkedHashMap(); + report.put("passed", true); report.put("profile", "camelCase"); report.put("round", round); report.put("rootId", root.getId()); + report.put("liveIds", liveIds); report.put("deletedIds", deletedIds); report.put("recoveredIds", recoveredIds); + for (String flag : List.of("lastUpdateExact", "maxUpdateRejectedBeforeChecker", "zeroProviderPolicyAudit", "pendingIntentRetained", + "typedQAndE", "exactJsonVersion", "unchangedMaxNoop", "untouchedParent", "legalDeleteAtMax", "exhaustedRecoveryRejected", "lastRecoveryExact")) report.put(flag, true); + report.put("fullExampleInventoryAccepted", false); report.put("internalArtifactAccepted", false); + System.out.println("JAVA_VERSION_LIFECYCLE=" + mapper.writeValueAsString(report)); + } +} diff --git a/examples/scalar-type-probe/JavaEmptyAggregateTest.java b/examples/scalar-type-probe/JavaEmptyAggregateTest.java new file mode 100644 index 000000000..03b714e50 --- /dev/null +++ b/examples/scalar-type-probe/JavaEmptyAggregateTest.java @@ -0,0 +1,224 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.nio.file.*; +import java.sql.*; +import java.time.*; +import java.util.*; +import java.util.concurrent.atomic.AtomicLong; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +/** Application-owned generated Q/E acceptance; DDL below is isolated fault injection only. */ +public class JavaEmptyAggregateTest { + static final ObjectMapper JSON = new ObjectMapper(); + static final String PURPOSE = "verify generated empty aggregate contract"; + static final class Context extends DefaultUserContext implements ScalarTypeConformanceServiceUserContext { + final List facts = new ArrayList<>(); + Context(TeaQLRuntime runtime) { super(runtime); } + @Override public void recordExecutionMetadata(ExecutionMetadata fact) { + facts.add(fact); super.recordExecutionMetadata(fact); + } + } + static final class Fixture { + final List driverSQL = new ArrayList<>(); + final List logs = new ArrayList<>(); + final List audit = new ArrayList<>(); + final Context context; + Fixture(String url, int round, boolean logging) { + var source = new SQLiteDataSource(); source.setUrl(url); + var driver = new JdbcSqlExecutor(source) { + @Override public List> queryForList(String sql, Object[] args) { + driverSQL.add(sql); return super.queryForList(sql,args); + } + @Override public List query(String sql, Object[] args, CompiledRowMapper mapper) { + driverSQL.add(sql); return super.query(sql,args,mapper); + } + }; + var service = new SqliteDataServiceExecutor("sqlite",driver,source); + var ids = new AtomicLong(round*100000L); + var sequence = new AtomicLong(); + var telemetry = new RuntimeTelemetry() { + public boolean recordsSqlDiagnostics() { return true; } + public Scope start(Operation operation) { + var correlation = new SqlExecutionCorrelation("00000000000000000000000000000236", + String.format("%016x", sequence.incrementAndGet())); + return new Scope() { + public SqlExecutionCorrelation correlation() { return correlation; } + public void success(Map attributes) {} + public void failure(Throwable error) {} + }; + } + }; + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default",service).dataService("sqlite",service) + .idGenerationService(new InternalIdGenerationService() { + public Long generateId(UserContext caller,Entity entity) { return ids.incrementAndGet(); } + public void ensureFloor(String type,long floor) { ids.accumulateAndGet(floor,Math::max); } + }).queryExecutionLogging(logging).mutationExecutionLogging(false).telemetry(telemetry) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller,ExecutionMetadata fact) { logs.add(fact); } + public void writeAuditEvent(UserContext caller,RawAuditEvent fact) { audit.add(fact); } + }).build().install(GeneratedRuntimeModule.module()); + context = new Context(runtime); context.ensureSchema(); context.ensureSchema(); + } + TypePlatform root(String name) { + var root = Q.typePlatforms().comment("prepare an aggregate bucket").purpose(PURPOSE).newEntity(context); + root.updateName(name); root.auditAs("Seed an aggregate boundary bucket").save(context); return root; + } + void contribution(TypePlatform root,Integer value,int number) { + var row = Q.scalarTypeProbes().comment("prepare an aggregate contribution").purpose(PURPOSE).newEntity(context); + row.updateTypePlatform(root); row.updateRequiredString("EA236 contribution " + number); + row.updateRequiredBoolean(true); row.updateRequiredInteger(1); row.updateOptionalInteger(value); + row.updateRequiredLong(9007199254740993L); row.updateRequiredDecimal(new BigDecimal("7.50")); + row.updateRequiredFloat(1.25f); row.updateRequiredDouble(2.5d); + row.updateRequiredDate(LocalDate.of(2026,10,20)); row.updateRequiredTime(LocalTime.of(9,30,15)); + row.updateRequiredDatetime(LocalDateTime.of(2026,10,20,9,30)); + row.auditAs("Seed a generated aggregate contribution").save(context); + } + void reset() { driverSQL.clear(); logs.clear(); context.facts.clear(); audit.clear(); } + List> facts(boolean logging,String outcome) { + assertEquals(driverSQL.size(),context.facts.size()); assertEquals(logging?driverSQL.size():0,logs.size()); + var rows = new ArrayList>(); + for (int i=0;i=4); + assertEquals(TraceKind.PROVIDER,trace.get(trace.size()-2).getKind()); + assertEquals("sqlite",trace.get(trace.size()-2).getName()); + assertEquals(TraceKind.SQL,trace.get(trace.size()-1).getKind()); + assertEquals("select",trace.get(trace.size()-1).getName()); + assertFalse(fact.getRequestTraceChain().isEmpty()); + rows.add(Map.of("sql",driverSQL.get(i),"parameterizedSQL",fact.getParameterizedQuery(),"outcome",outcome,"comment",fact.getComment(), + "purpose",fact.getPurpose(),"tracePath",trace,"traceChain",fact.getRequestTraceChain())); + } + assertTrue(context.getTraceChain().isEmpty()); assertTrue(audit.isEmpty()); return rows; + } + } + static Object projection(TypePlatform row,String alias) { + assertTrue("selected alias must remain present: "+alias,row.hasDynamicProperty(alias)); + return row.getDynamicProperty(alias); + } + static void number(Object expected,Object actual) { + if(expected==null) assertNull(actual); else { + assertTrue(actual instanceof Number); assertEquals(new BigDecimal(expected.toString()),new BigDecimal(actual.toString())); + } + } + @Test public void generatedEmptyAggregatesAndRealSQLiteFailure() throws Exception { + var expected=Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for(var type:List.of(UserContext.class,TeaQLRuntime.class,SqliteDataServiceExecutor.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + int round=Integer.parseInt(System.getenv("TEAQL_EMPTY_ROUND")); + var vectors=JSON.readTree(Files.readAllBytes(Path.of(System.getenv("TEAQL_EMPTY_VECTORS")))); + String url="jdbc:sqlite:"+Path.of(System.getenv("TEAQL_EMPTY_DB")).toAbsolutePath(); + var seed=new Fixture(url,round,false); var scalar=new ArrayList(); var bucket=new ArrayList(); + int contribution=0; + for(var vector:vectors.get("scalarCases")) { + var root=seed.root("EA236 round "+round+" scalar "+vector.get("id").asText()); scalar.add(root); + for(var value:vector.get("values")) seed.contribution(root,value.isNull()?null:value.intValue(),++contribution); + } + var mixed=vectors.get("bucketCases").get(1); + for(var parent:mixed.get("parents")) bucket.add(seed.root("EA236 round "+round+" bucket "+parent.asInt())); + for(var item:mixed.get("children")) seed.contribution(bucket.get(item.get("parent").asInt()-1), + item.get("value").isNull()?null:item.get("value").intValue(),++contribution); + assertEquals(12,contribution); var observations=new ArrayList>(); + for(boolean logging:List.of(true,false)) { + var f=new Fixture(url,round,logging); + for(int index=0;index(result.get(0)); values.put("countValue",known.get(0).get("values")); + observations.add(Map.of("case",id,"logging",logging,"values",values,"sql",f.facts(logging,"success"))); + } + f.reset(); var empty=Q.typePlatformsWithMinimalFields().withIdIs(bucket.get(3).getId()).selectName().limit(1) + .countScalarTypeProbesWith("rows",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("count aggregate contributions")) + .sumOptionalIntegerOfScalarTypeProbesAs("total",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("sum aggregate contributions")) + .comment("inspect EA-05 empty related SUM").purpose(PURPOSE).executeForOne(f.context); + assertEquals(bucket.get(3).getId(),E.typePlatform(empty).getId().eval()); + number(0,projection(empty,"rows")); assertNull(projection(empty,"total")); + var emptyValues=new LinkedHashMap(); emptyValues.put("count",projection(empty,"rows")); + emptyValues.put("sum",projection(empty,"total")); + var mapper=new ObjectMapper().findAndRegisterModules().registerModule(new io.teaql.jackson.TeaQLModule(f.context)); + var entityJSON=mapper.valueToTree(empty); + assertTrue(entityJSON.has("_total")); assertTrue(entityJSON.get("_total").isNull()); + assertEquals(0,entityJSON.get("_rows").asInt()); + + observations.add(Map.of("case","EA-05","logging",logging,"values",emptyValues,"entityJSON",entityJSON,"sql",f.facts(logging,"success"))); + Long[] ids=bucket.stream().map(TypePlatform::getId).toArray(Long[]::new); + for(boolean includeAll:List.of(true,false)) { + f.reset(); var targets=Q.typePlatformsWithMinimalFields().withIdIn(ids).selectName().orderByIdAscending().limit(100) + .countScalarTypeProbesWith("rows",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("count facet contributions")) + .sumOptionalIntegerOfScalarTypeProbesAs("total",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("sum facet contributions")); + var list=Q.scalarTypeProbesWithMinimalFields().withTypePlatformMatching(Q.typePlatformsWithMinimalFields().withIdIn(ids)) + .orderByIdAscending().offset(1,1).facetByTypePlatformAs("buckets",targets,includeAll) + .comment("inspect EA-06 complete membership behind one visible row").purpose(PURPOSE).executeForList(f.context); + assertEquals(1,list.size()); var facets=list.getFacet("buckets"); assertNotNull(facets); + assertEquals(includeAll?4:3,facets.size()); var values=new ArrayList>(); + for(var raw:facets) { + var row=(TypePlatform)raw; int parent=Arrays.asList(ids).indexOf(E.typePlatform(row).getId().eval())+1; + var wanted=mixed.get("expected").get(parent-1); number(wanted.get("count").intValue(),projection(row,"rows")); + number(wanted.get("sum").isNull()?null:wanted.get("sum").intValue(),projection(row,"total")); + var value=new LinkedHashMap(); value.put("parent",parent); value.put("count",projection(row,"rows")); + value.put("sum",projection(row,"total")); values.add(value); + var facetJSON=mapper.valueToTree(row); assertTrue(facetJSON.has("_total")); + if(projection(row,"total")==null)assertTrue(facetJSON.get("_total").isNull()); + else assertEquals(0,facetJSON.get("_total").decimalValue().compareTo(new BigDecimal(projection(row,"total").toString()))); + + } + observations.add(Map.of("case","EA-06","logging",logging,"includeAll",includeAll,"visibleRows",list.size(), + "values",values,"sql",f.facts(logging,"success"))); + } + f.reset(); var fallback=Q.scalarTypeProbesWithMinimalFields().withIdIs(0L).sumOptionalIntegerAs("total").limit(1) + .comment("inspect EA-07 explicit fallback").purpose(PURPOSE).aggregation(f.context); + assertNull(fallback.toList().get(0).get("total")); number(0,fallback.toNumber(0)); + assertNull(fallback.toList().get(0).get("total")); + var fallbackValues=new LinkedHashMap(); fallbackValues.put("raw",fallback.toList().get(0).get("total")); + fallbackValues.put("fallback",fallback.toNumber(0)); fallbackValues.put("rawRemains",fallback.toList().get(0).get("total")); + observations.add(Map.of("case","EA-07","logging",logging,"values",fallbackValues,"sql",f.facts(logging,"success"))); + f.reset(); var grouped=Q.scalarTypeProbesWithMinimalFields().withIdIs(0L).sumOptionalIntegerAs("total") + .groupByTypePlatform().limit(100).comment("inspect EA-08 no synthetic group").purpose(PURPOSE).aggregation(f.context).toList(); + assertTrue(grouped.isEmpty()); observations.add(Map.of("case","EA-08","logging",logging,"groups",grouped,"sql",f.facts(logging,"success"))); + f.reset(); + try(var connection=DriverManager.getConnection(url);var statement=connection.createStatement()) { + statement.execute("ALTER TABLE scalar_type_probe_data RENAME TO ea236_fault_scalar_data"); + try { + var error=assertThrows(RuntimeException.class,()->Q.scalarTypeProbesWithMinimalFields().withIdIs(0L) + .sumOptionalIntegerAs("total").limit(1).comment("inspect actual SQLite aggregate failure") + .purpose(PURPOSE).aggregation(f.context)); + Throwable cause=error; while(cause.getCause()!=null) cause=cause.getCause(); + assertTrue(cause instanceof SQLException); assertEquals(1,((SQLException)cause).getErrorCode()); + assertTrue(cause.getMessage().contains("no such table: scalar_type_probe_data")); + } finally { statement.execute("ALTER TABLE ea236_fault_scalar_data RENAME TO scalar_type_probe_data"); } + } + observations.add(Map.of("case","REAL-SQLITE-FAILURE","logging",logging,"sql",f.facts(logging,"failure"))); + f.reset(); var recovered=Q.typePlatformsWithMinimalFields().withIdIs(bucket.get(3).getId()).selectName().limit(1) + .comment("load independent detail after SQLite failure").purpose(PURPOSE).executeForOne(f.context); + assertEquals(bucket.get(3).getId(),E.typePlatform(recovered).getId().eval()); + assertEquals(bucket.get(3).getName(),E.typePlatform(recovered).getName().eval()); + observations.add(Map.of("case","QUERY-RECOVERY","logging",logging,"sql",f.facts(logging,"success"))); + } + var report=new LinkedHashMap(); report.put("schema","teaql.java-generated-empty-aggregate/v1"); + report.put("passed",true); report.put("round",round); report.put("rows",observations); + report.put("scalarIds",scalar.stream().map(TypePlatform::getId).toList()); + report.put("bucketIds",bucket.stream().map(TypePlatform::getId).toList()); + assertEquals(22,observations.size()); System.out.println("JAVA_GENERATED_EMPTY_AGGREGATE="+JSON.writeValueAsString(report)); + } +} diff --git a/examples/scalar-type-probe/JavaFiniteScalarProbe.java b/examples/scalar-type-probe/JavaFiniteScalarProbe.java new file mode 100644 index 000000000..14ee06a79 --- /dev/null +++ b/examples/scalar-type-probe/JavaFiniteScalarProbe.java @@ -0,0 +1,101 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.checker.CheckException; +import io.teaql.core.checker.CheckResult; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.runtime.TeaQLRuntime; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import java.nio.file.Path; +import java.sql.DriverManager; +import java.util.*; + +/** Observe the unchanged generated APIs on both the negative and repaired runtime. */ +public final class JavaFiniteScalarProbe { + static final List FIELDS = List.of("required_float", "optional_float", "required_double", "optional_double"); + static final ObjectMapper JSON = new ObjectMapper(); + static void assign(ScalarTypeProbe row, String field, double number) { + switch (field) { + case "required_float" -> row.updateRequiredFloat((float) number); + case "optional_float" -> row.updateOptionalFloat((float) number); + case "required_double" -> row.updateRequiredDouble(number); + case "optional_double" -> row.updateOptionalDouble(number); + default -> throw new AssertionError(field); + } + } + static Map outcome(Runnable save, String field, GeneratedCanonicalNameTest.Fixture f) { + long provider = f.data.calls; int policies = f.policies.size(), audits = f.audits.size(); + RuntimeException error = null; + try { save.run(); } catch (RuntimeException e) { error = e; } + long calls = f.data.calls - provider; + var value = new LinkedHashMap(); + value.put("accepted", error == null); value.put("exception", error == null ? null : error.getClass().getName()); + value.put("providerConnections", calls); value.put("policyCalls", f.policies.size() - policies); + value.put("audits", f.audits.size() - audits); + List violations = error instanceof CheckException e ? e.getViolates() : List.of(); + boolean structured = violations.stream().anyMatch(v -> v.getRuleId() == CheckResult.RuleId.INVALID_TYPE + && "ScalarTypeProbe".equals(v.getRootType()) && v.getLocation() != null + && v.getLocation().modelPath().endsWith(field) && v.getInputValue() == null); + value.put("structuredInvalidType", structured); + value.put("canonicalLocations", violations.stream().map(v -> v.getLocation().modelPath()).toList()); + value.put("threeWireProfiles", structured && violations.stream().allMatch(v -> + Arrays.stream(JsonFieldNamingProfile.values()).allMatch(p -> + v.toWire(p).instancePath().endsWith(p.render(field)) && v.toWire(p).inputValue() == null))); + value.put("contractPass", structured && calls == 0 && f.policies.size() == policies && f.audits.size() == audits); + return value; + } + static Map stored(GeneratedCanonicalNameTest.Fixture f, long id, String field) throws Exception { + try (var db = DriverManager.getConnection(f.data.url); + var query = db.prepareStatement("SELECT version," + field + " FROM scalar_type_probe_data WHERE id=?")) { + query.setLong(1, id); try (var rows = query.executeQuery()) { + var value = new LinkedHashMap(); + value.put("exists", rows.next()); if (Boolean.TRUE.equals(value.get("exists"))) { + value.put("version", rows.getLong(1)); Object number = rows.getObject(2); + value.put("number", number == null ? null : number.toString()); + } return value; + } + } + } + static void emit(Map value) throws Exception { System.out.println("JAVA_FINITE_SCALAR_CASE=" + JSON.writeValueAsString(value)); } + public static void main(String[] args) throws Exception { + if (args.length != 2) throw new IllegalArgumentException("database round"); + int round = Integer.parseInt(args[1]); + var origins = new LinkedHashMap(); + for (var type : List.of(TeaQLRuntime.class, JdbcSqlExecutor.class, ScalarTypeProbe.class)) + origins.put(type.getName(), Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().toString()); + System.out.println("JAVA_FINITE_SCALAR_ORIGINS=" + JSON.writeValueAsString(origins)); + var f = new GeneratedCanonicalNameTest.Fixture("jdbc:sqlite:" + Path.of(args[0]).toAbsolutePath(), round); + var root = f.root("Finite scalar root " + round); + int cases = 0, passed = 0, accepted = 0, writes = 0; + var numbers = new LinkedHashMap(); + numbers.put("NaN", Double.NaN); numbers.put("Infinity", Double.POSITIVE_INFINITY); numbers.put("-Infinity", Double.NEGATIVE_INFINITY); + for (String status : List.of("create", "update")) for (String field : FIELDS) for (var number : numbers.entrySet()) { + var row = f.probe(root, "finite " + status + " " + field + " " + number.getKey() + " " + round); + if (status.equals("update")) row.auditAs("Create a finite update control").save(f.context); + assign(row, field, number.getValue()); + var value = outcome(() -> row.auditAs("Reject a non-finite generated scalar").save(f.context), field, f); + value.put("round", round); value.put("case", status); value.put("field", field); value.put("number", number.getKey()); + value.put("id", row.getId()); value.put("stored", stored(f, row.getId(), field)); + cases++; if (Boolean.TRUE.equals(value.get("contractPass"))) passed++; + if (Boolean.TRUE.equals(value.get("accepted"))) accepted++; + if (((Number)value.get("providerConnections")).longValue() > 0) writes++; + emit(value); + } + var graphRoot = f.root("Finite graph root " + round); + var first = f.probe(graphRoot, "finite graph first " + round); first.auditAs("Create first finite graph witness").save(f.context); + var second = f.probe(graphRoot, "finite graph second " + round); second.auditAs("Create second finite graph witness").save(f.context); + var graph = Q.typePlatforms().withIdIs(graphRoot.getId()).limit(1) + .selectScalarTypeProbeListWith(Q.scalarTypeProbes().orderByIdAscending().limit(2)) + .comment("Load exactly two complete scalar graph witnesses").purpose("Reject the invalid graph before the first write").executeForOne(f.context); + var children = graph.getScalarTypeProbeList(); if (children.size() != 2) throw new AssertionError("two graph witnesses required"); + children.get(0).updateRequiredDouble(7.5d); children.get(1).updateOptionalFloat(Float.POSITIVE_INFINITY); + var result = outcome(() -> graph.auditAs("Reject the complete non-finite scalar graph").save(f.context), "optional_float", f); + result.put("round", round); result.put("case", "graph"); result.put("firstId", first.getId()); result.put("secondId", second.getId()); + result.put("firstStored", stored(f, first.getId(), "required_double")); result.put("secondStored", stored(f, second.getId(), "optional_float")); + cases++; if (Boolean.TRUE.equals(result.get("contractPass"))) passed++; emit(result); + System.out.println("JAVA_FINITE_SCALAR_RESULT=" + JSON.writeValueAsString(Map.of("round", round, "cases", cases, + "contractPasses", passed, "contractFailures", cases - passed, "acceptedNonfiniteSaves", accepted, "invalidSavesReachingProvider", writes, + "completed", true, "runtimeChanged", false))); + } +} diff --git a/examples/scalar-type-probe/JavaMemoryEmptyAggregateTest.java b/examples/scalar-type-probe/JavaMemoryEmptyAggregateTest.java new file mode 100644 index 000000000..b1391ced5 --- /dev/null +++ b/examples/scalar-type-probe/JavaMemoryEmptyAggregateTest.java @@ -0,0 +1,182 @@ +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.runtime.memory.MemoryDataService; +import io.teaql.runtime.*; +import java.math.BigDecimal; +import java.nio.file.*; +import java.sql.*; +import java.time.*; +import java.util.*; +import java.util.concurrent.atomic.AtomicLong; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Existing pure-memory provider through the same generated Q/E/audited Mutation APIs. */ +public class JavaMemoryEmptyAggregateTest { + static final ObjectMapper JSON = new ObjectMapper(); + static final String PURPOSE = "verify generated empty aggregate contract"; + static final class Context extends DefaultUserContext implements ScalarTypeConformanceServiceUserContext { + final List facts = new ArrayList<>(); + Context(TeaQLRuntime runtime) { super(runtime); } + @Override public void recordExecutionMetadata(ExecutionMetadata fact) { + facts.add(fact); super.recordExecutionMetadata(fact); + } + } + static final class CountingMemory extends MemoryDataService { + int queries, mutations; + CountingMemory() { super("memory"); } + @Override public QueryResult query(UserContext context, QueryRequest request) { + queries++; return super.query(context, request); + } + @Override public MutationResult mutate(UserContext context, PersistenceMutation request) { + mutations++; return super.mutate(context, request); + } + } + static final class Fixture { + final List logs = new ArrayList<>(); + final List audit = new ArrayList<>(); + final Context context; + final CountingMemory memory; + Fixture(CountingMemory memory, int round, boolean logging) { + this.memory=memory; + var ids=new AtomicLong(round*100000L); + var runtime=TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default",memory).dataService("sqlite",memory) + .idGenerationService((caller,entity)->ids.incrementAndGet()) + .queryExecutionLogging(logging).mutationExecutionLogging(false) + .logSink(new RuntimeLogSink() { + public void writeExecutionLog(UserContext caller,ExecutionMetadata fact) { logs.add(fact); } + public void writeAuditEvent(UserContext caller,RawAuditEvent fact) { audit.add(fact); } + }).build().install(GeneratedRuntimeModule.module()); + context=new Context(runtime); + } + TypePlatform root(String name) { + var root = Q.typePlatforms().comment("prepare an aggregate bucket").purpose(PURPOSE).newEntity(context); + root.updateName(name); root.auditAs("Seed an aggregate boundary bucket").save(context); return root; + } + void contribution(TypePlatform root,Integer value,int number) { + var row = Q.scalarTypeProbes().comment("prepare an aggregate contribution").purpose(PURPOSE).newEntity(context); + row.updateTypePlatform(root); row.updateRequiredString("EA236 contribution " + number); + row.updateRequiredBoolean(true); row.updateRequiredInteger(1); row.updateOptionalInteger(value); + row.updateRequiredLong(9007199254740993L); row.updateRequiredDecimal(new BigDecimal("7.50")); + row.updateRequiredFloat(1.25f); row.updateRequiredDouble(2.5d); + row.updateRequiredDate(LocalDate.of(2026,10,20)); row.updateRequiredTime(LocalTime.of(9,30,15)); + row.updateRequiredDatetime(LocalDateTime.of(2026,10,20,9,30)); + row.auditAs("Seed a generated aggregate contribution").save(context); + } + void reset() { logs.clear(); context.facts.clear(); audit.clear(); memory.queries=0; memory.mutations=0; } + List> facts(boolean logging,String outcome) { + assertEquals("success",outcome); assertTrue(memory.queries>0); + assertEquals(0,memory.mutations); assertTrue(audit.isEmpty()); + assertTrue(context.getTraceChain().isEmpty()); + assertTrue("pure memory must not fabricate SQL metadata",context.facts.isEmpty()); + assertTrue("pure memory must not fabricate SQL logs",logs.isEmpty()); + return List.of(Map.of("queryCalls",memory.queries,"mutationCalls",memory.mutations,"sqlCalls",0)); + } + } + static Object projection(TypePlatform row,String alias) { + assertTrue("selected alias must remain present: "+alias,row.hasDynamicProperty(alias)); + return row.getDynamicProperty(alias); + } + static void number(Object expected,Object actual) { + if(expected==null) assertNull(actual); else { + assertTrue(actual instanceof Number); assertEquals(new BigDecimal(expected.toString()),new BigDecimal(actual.toString())); + } + } + @Test public void generatedMemoryEmptyAggregates() throws Exception { + var expected=Path.of(System.getProperty("teaql.expected.runtime.root")).toRealPath(); + for(var type:List.of(UserContext.class,TeaQLRuntime.class,MemoryDataService.class)) + assertTrue(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toRealPath().startsWith(expected)); + int round=Integer.parseInt(System.getenv("TEAQL_EMPTY_ROUND")); + var vectors=JSON.readTree(Files.readAllBytes(Path.of(System.getenv("TEAQL_EMPTY_VECTORS")))); + var memory=new CountingMemory(); + var seed=new Fixture(memory,round,false); var scalar=new ArrayList(); var bucket=new ArrayList(); + int contribution=0; + for(var vector:vectors.get("scalarCases")) { + var root=seed.root("EA236 round "+round+" scalar "+vector.get("id").asText()); scalar.add(root); + for(var value:vector.get("values")) seed.contribution(root,value.isNull()?null:value.intValue(),++contribution); + } + var mixed=vectors.get("bucketCases").get(1); + for(var parent:mixed.get("parents")) bucket.add(seed.root("EA236 round "+round+" bucket "+parent.asInt())); + for(var item:mixed.get("children")) seed.contribution(bucket.get(item.get("parent").asInt()-1), + item.get("value").isNull()?null:item.get("value").intValue(),++contribution); + assertEquals(12,contribution); var observations=new ArrayList>(); + for(boolean logging:List.of(true,false)) { + var f=new Fixture(memory,round,logging); + for(int index=0;index(result.get(0)); values.put("countValue",known.get(0).get("values")); + observations.add(Map.of("case",id,"logging",logging,"values",values,"provider",f.facts(logging,"success"))); + } + f.reset(); var empty=Q.typePlatformsWithMinimalFields().withIdIs(bucket.get(3).getId()).selectName().limit(1) + .countScalarTypeProbesWith("rows",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("count aggregate contributions")) + .sumOptionalIntegerOfScalarTypeProbesAs("total",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("sum aggregate contributions")) + .comment("inspect EA-05 empty related SUM").purpose(PURPOSE).executeForOne(f.context); + assertEquals(bucket.get(3).getId(),E.typePlatform(empty).getId().eval()); + number(0,projection(empty,"rows")); assertNull(projection(empty,"total")); + var emptyValues=new LinkedHashMap(); emptyValues.put("count",projection(empty,"rows")); + emptyValues.put("sum",projection(empty,"total")); + var mapper=new ObjectMapper().findAndRegisterModules().registerModule(new io.teaql.jackson.TeaQLModule(f.context)); + var entityJSON=mapper.valueToTree(empty); + assertTrue(entityJSON.has("_total")); assertTrue(entityJSON.get("_total").isNull()); + assertEquals(0,entityJSON.get("_rows").asInt()); + + observations.add(Map.of("case","EA-05","logging",logging,"values",emptyValues,"entityJSON",entityJSON,"provider",f.facts(logging,"success"))); + Long[] ids=bucket.stream().map(TypePlatform::getId).toArray(Long[]::new); + for(boolean includeAll:List.of(true,false)) { + f.reset(); var targets=Q.typePlatformsWithMinimalFields().withIdIn(ids).selectName().orderByIdAscending().limit(100) + .countScalarTypeProbesWith("rows",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("count facet contributions")) + .sumOptionalIntegerOfScalarTypeProbesAs("total",Q.scalarTypeProbesWithMinimalFields().limit(100).comment("sum facet contributions")); + var list=Q.scalarTypeProbesWithMinimalFields().withTypePlatformMatching(Q.typePlatformsWithMinimalFields().withIdIn(ids)) + .orderByIdAscending().offset(1,1).facetByTypePlatformAs("buckets",targets,includeAll) + .comment("inspect EA-06 complete membership behind one visible row").purpose(PURPOSE).executeForList(f.context); + assertEquals(1,list.size()); var facets=list.getFacet("buckets"); assertNotNull(facets); + assertEquals(includeAll?4:3,facets.size()); var values=new ArrayList>(); + for(var raw:facets) { + var row=(TypePlatform)raw; int parent=Arrays.asList(ids).indexOf(E.typePlatform(row).getId().eval())+1; + var wanted=mixed.get("expected").get(parent-1); number(wanted.get("count").intValue(),projection(row,"rows")); + number(wanted.get("sum").isNull()?null:wanted.get("sum").intValue(),projection(row,"total")); + var value=new LinkedHashMap(); value.put("parent",parent); value.put("count",projection(row,"rows")); + value.put("sum",projection(row,"total")); values.add(value); + var facetJSON=mapper.valueToTree(row); assertTrue(facetJSON.has("_total")); + if(projection(row,"total")==null)assertTrue(facetJSON.get("_total").isNull()); + else assertEquals(0,facetJSON.get("_total").decimalValue().compareTo(new BigDecimal(projection(row,"total").toString()))); + + } + observations.add(Map.of("case","EA-06","logging",logging,"includeAll",includeAll,"visibleRows",list.size(), + "values",values,"provider",f.facts(logging,"success"))); + } + f.reset(); var fallback=Q.scalarTypeProbesWithMinimalFields().withIdIs(0L).sumOptionalIntegerAs("total").limit(1) + .comment("inspect EA-07 explicit fallback").purpose(PURPOSE).aggregation(f.context); + assertNull(fallback.toList().get(0).get("total")); number(0,fallback.toNumber(0)); + assertNull(fallback.toList().get(0).get("total")); + var fallbackValues=new LinkedHashMap(); fallbackValues.put("raw",fallback.toList().get(0).get("total")); + fallbackValues.put("fallback",fallback.toNumber(0)); fallbackValues.put("rawRemains",fallback.toList().get(0).get("total")); + observations.add(Map.of("case","EA-07","logging",logging,"values",fallbackValues,"provider",f.facts(logging,"success"))); + f.reset(); var grouped=Q.scalarTypeProbesWithMinimalFields().withIdIs(0L).sumOptionalIntegerAs("total") + .groupByTypePlatform().limit(100).comment("inspect EA-08 no synthetic group").purpose(PURPOSE).aggregation(f.context).toList(); + assertTrue(grouped.isEmpty()); observations.add(Map.of("case","EA-08","logging",logging,"groups",grouped,"provider",f.facts(logging,"success"))); + + } + var report=new LinkedHashMap(); report.put("schema","teaql.java-generated-memory-empty-aggregate/v1"); + report.put("passed",true); report.put("round",round); report.put("rows",observations); + report.put("scalarIds",scalar.stream().map(TypePlatform::getId).toList()); + report.put("bucketIds",bucket.stream().map(TypePlatform::getId).toList()); + assertEquals(18,observations.size()); System.out.println("JAVA_GENERATED_MEMORY_EMPTY_AGGREGATE="+JSON.writeValueAsString(report)); + } +} diff --git a/examples/scalar-type-probe/README.md b/examples/scalar-type-probe/README.md new file mode 100644 index 000000000..65a0cdfbd --- /dev/null +++ b/examples/scalar-type-probe/README.md @@ -0,0 +1,217 @@ +# Generated canonical naming / SQLite probe + +Run `node examples/scalar-type-probe/verify-local.cjs` from this runtime checkout. +The example always compiles repository-local runtime modules. It never installs +TeaQL into a shared Maven repository or edits the frozen generated library. +Set `TEAQL_JAVA_SCALAR_EVIDENCE_DIR` to a new absolute evidence directory to keep +the two logs and SQLite database at a chosen location. Repeated rounds use the +same database without cleanup; disposable builds are removed on exit. + +The evaluated two-object model tests native Q/E/updaters, canonical Ledger, +Checker/policy/audit keys, physical columns, Value/Null/NotLoaded, twelve malformed +namespace rejections, two required-field rejections, default typed JSON, and a +real second-UPDATE failure after the first UPDATE executes. The same object graph +is retried after rollback, preserving versions and producing two committed audits. +Raw generic mutations are used only for the explicitly labelled negative tests. + +`node examples/scalar-type-probe/verify-json-profiles.cjs` additionally compiles +three evaluated model variants and runs each twice. Only the documented root +`json_field_naming` option differs. Native Q/E and database names stay canonical; +JSON names and diagnostic pointers follow camelCase, snake_case or PascalCase. +The standard example entry point runs both verifiers. Set +`TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR` to a new directory to retain these logs and +three databases. The type-local mapping accepts canonical keys and explicitly +declared aliases, not incidental physical columns or other profiles' spellings. + +The same verifier with `--lifecycle` runs a separate database-backed scenario for +each profile twice. Persisted JSON identities remain clean until changed; an +update writes only the modified object, preserves an untouched partial reference, +and cannot absorb another decoded object's pending changes. Stale versions fail +with optimistic conflict; modified partial objects fail before provider access. +Decoded deletion and recovery retain the version baseline (1 -> 2 -> -3 -> 4). +The standard example entry point also runs this scenario. It retains compact +logs and three test databases, not disposable reactors or dependency copies. + +`--numeric` tests generated typed mutation -> Q/E -> JSON -> decoded audited +update for the three profiles, twice each. Long/ID/version/Decimal are exact +strings; Integer remains a number; native Float/Double remain approximate finite +numbers. Decimal scale, 64-bit extremes, signed Integer endpoints, nonfinite +output, wrong-type/unsafe-number input and precise field paths are checked. +This is a numeric boundary gate, not full temporal, dynamic-property or wire +envelope acceptance. These modes are part of the standard example script. + +`--temporal` verifies generated calendar Date and wall Time through typed save, +Q/E, JSON and decoded update for all profiles twice. It preserves leap dates, +nine-digit native Time fractions, loaded Null and exact field diagnostics. Native +codec tests separately qualify Instant as offset-input/UTC-output milliseconds, +including rejection of excess precision. The generated model does not contain +Instant; its LocalDateTime and Business Clock behavior are deliberately unchanged +pending the separate local-date-time precision decision. This does not qualify +LocalDateTime wire semantics, generated Instant persistence or all providers. + +`--rejected` uses one evaluated model twice to test Core lifecycle rejection, +not JSON profile equivalence. A generated FK-only reference rejects typed/generic +updates, version edits and an explicit legacy-cache fault injection without +changing payload, availability or ledger state. A failed generic cast stays +NotLoaded, an incomplete modified object is rejected before provider access, and +the complete owner still saves without writing the reference. + +`--explicit-null` runs the same small model twice: an explicit null edit on a +NotLoaded field becomes loaded Null and retains pending intent. Changing it again +does not turn the unknown original value into a known null. Incomplete modified +objects still fail Checker before provider access. Equal values on already loaded +fields are true no-ops (no lifecycle change, ledger allocation, SQL, audit or +version bump). ID-only references cannot use a null-version edit to claim that +the version was loaded. A complete object's value-to-null update persists and +reads back through Q/E and an independent SQL oracle. These checks run from the +standard example entry point; they are not full graph or artifact acceptance. + +`--loaded-revert` verifies one model twice for known-value and known-null +restoration. An intermediate edit followed by the original loaded value removes +that field's pending ledger entry and does not write, audit or bump the version. +Restoring one field retains a different field's actual change; the policy and +SQL readback retain that real edit plus the model's normal managed `update_time` +Fix. A no-op save does not trigger that Fix. Core tests additionally preserve dynamic +intent, deletion, type-qualified sibling keys, loaded snapshots, original versions +and lineage. A missing original value remains unknown and cannot be cancelled +merely because its backing storage was null. Cancelling a field against its +persistent baseline is distinct from popping a change-set scope; it cannot expose +an older intermediate value of that field or erase unrelated staged values. + +`--version-lifecycle` runs generated Q/E/JSON and audited Save twice on one small +SQLite database. Ordinary generated creates precede deliberate SQL boundary +injection. The last update reaches `Long.MAX_VALUE` exactly; further updates fail +at `/version` before the generated Checker, policy, provider or audit. Unchanged +exhausted rows remain no-ops. Deleting `MAX` produces exactly `MIN`, recovery of +that exhausted tombstone rejects, and recovery of `MIN+2` reaches `MAX` exactly. +Both loaded-null and non-null notes, independent pending objects and the untouched +parent remain intact. The complete example inventory includes this mode; passing +this probe alone is not private-artifact or full-runtime qualification. + +`node examples/scalar-type-probe/verify-local.cjs --restoration-views` tests three +scenarios twice, without resetting their separate SQLite stores: sparse fixed +fields and loaded relations plus readonly result types/presence; a caller-owned +JDBC transaction with no-op, rollback, retry and commit; and persistent extension +Value/Null/NotLoaded, shared geometry, storage provenance and a real `#` edit +surviving native-field restoration. The no-op enters no provider or policy and +emits no mutation audit. A genuine saved object gets authoritative readback; +audit waits for the physical transaction owner to commit. Rollback retains the +optimistic baseline and pending intent for retry. Standard JDBC nested failures +are rollback-only even if application code catches the inner exception. A sink +failure after commit is a delivery failure, not proof the database rolled back. + +`--outer-replay` adds seven scenarios, twice on seven separate unreset stores: +two saves changing different fields, repeated changes to the same field, an +unsaved later field, create followed by update, dynamic followed by native, +later unsaved dynamic input, and retained invalid raw input. A physical rollback +must preserve the final requested values against the initial optimistic version. +Replaying a tracked updater retains its first-change provenance; raw keys remain +raw for normal admission, including explicit NULL and invalid keys. No rolled-back +attempt delivers mutation audit. Retrying final intent writes once. This mode +also records whether the original generated factory assigned an ID before the +first save; it does not treat deferred allocation as early-ID conformance. + +These paths are part of the complete example script. They retain logs, hashes and +three databases, not build outputs. The current probe qualifies the standard +JDBC adapter, not arbitrary custom transaction implementations, all lifecycle +combinations (such as create/delete/recover chains) or installed packages. + +This does not qualify all scalar wire boundaries, cross-runtime DDL parity or a +published artifact. Provenance is in `fixture-manifest.json` and +`json-profiles/provenance.json`; generated sources are never edited by the probes. + +## Finite floating point values + +Run `node examples/scalar-type-probe/verify-local.cjs --finite` to exercise the +generated Float and Double APIs against the repository-local source reactor. +Both rounds reuse four SQLite stores without resetting them. Each round checks +62 scenarios: 24 invalid creates or updates, a late invalid graph child, 24 +invalid values produced by customer Fix, four customer repairs, eight corrupt +legacy values and a two-child rollback repair and retry. + +NaN and either infinity must produce structured `invalid_type` diagnostics after +Fix and before policy review, provider access or committed mutation audit. A +customer Fix may repair an initially invalid value; its final value is checked +once. All JSON naming profiles preserve the canonical field pointer, without +trying to serialize a nonfinite number as diagnostic input. Standalone Checker +tests also protect capability-free checks using the entity's existing field +layout and loaded values, including cyclic graphs. + +Legacy infinity is injected through explicitly labelled SQL fault setup, not +ordinary application writes. Full generated Q loading rejects it, while a safe +minimal projection remains usable and E reports omitted fields as NotLoaded. +SQLite can turn a directly injected NaN into SQL NULL; that lost information +cannot be recovered by a later read. The runtime therefore rejects new nonfinite +values before they reach the driver. Low-level JDBC tests additionally cover +finite Double values that overflow when converted to Float. + +This mode retains logs, source origins, fixture hashes and the four databases; +its disposable source copy and build outputs are removed on exit. It is part of +`scripts/verify-examples.sh`, separate from installed-artifact acceptance. +## Exact JDBC numeric reads + +`node examples/scalar-type-probe/verify-local.cjs --jdbc-exact` runs sixteen +legacy-corruption cases twice on one unreset SQLite store, using generated Q +single-result and stream queries. It rejects fractional or overflowing integers, +overflowing Float, infinite Double and invalid Decimal text without disclosing +private values. A projection that excludes the corrupt column still returns its +selected fields; E reports the unselected numeric field as NotLoaded. Direct SQL +is confined to explicit fault injection, its repair and independent readback. +Audited generated creates and a real update, exact native integer endpoints, +connection recovery and unchanged query-time audit/policy counts are also checked. +The complete example entry point includes this mode. + +## Generated SQL millisecond boundary + +`node examples/scalar-type-probe/verify-local.cjs --sql-millis` exercises the +approved millisecond SQL precision through the unchanged generated library. +Five tests run twice against five retained SQLite stores, without resetting them. +They cover eighteen create/save/Q-equality/E/physical-readback combinations across +UTC, New York and Shanghai; three audited updates; eighteen passive native JSON +round trips; and an omitted-field NotLoaded projection. Inputs include aligned +milliseconds, sub-millisecond fractions, a DST-gap wall time, fractions just +before the next second, pre-epoch values and zero fractional seconds. + +SQL truncates fractions rather than rounding. Save's authoritative readback, +typed Q predicates and loaded E must agree with physical storage. Native input +and JSON retain nanosecond precision until the SQL boundary. Direct SQL is a +read-only oracle, not the application write path. Runtime code comes only from +the repository-local source reactor, and generated source hashes must not change. +This mode is part of the complete example entry point. A fifth test injects an +explicit legacy sub-millisecond value after an ordinary generated audited Save. +Repeated bounded Q reads must reject it with `SQL_DATETIME_PRECISION_MISMATCH`, +the modeled entity/field, an RFC 6901 field pointer and a migration remedy, never +the stored private value. A projection excluding that field still works and E +correctly reports it NotLoaded. Reads do not write, review a mutation policy or +emit mutation audit; an independent SQL oracle preserves the exact old text and +version. This is not an automatic migration and does not qualify a published +runtime package. Explicit-transaction and installed-artifact acceptance remain +separate from this local example. + +## Empty aggregates and real query failure + +`node examples/scalar-type-probe/verify-local.cjs --empty` runs EA01–08 twice +against the same retained SQLite database through generated audited Mutation, +Q and E APIs. COUNT returns zero; SUM remains null for no contributions or +all-null contributions, while a real zero remains zero. Independent relation +buckets and facet options cannot borrow another bucket's values. A selected +null aggregate remains present in entity JSON. An explicit local zero fallback +does not mutate the raw aggregate result. + +Both SQL logging modes execute real provider calls, including a deliberate +SQLite error followed by an independent successful query. The test checks +request comments, purpose and physical TraceChain lineage, not just totals. +The app and eight vectors are hash-bound to the unchanged fixture and original +acceptance test. This mode is included in `scripts/verify-examples.sh`; local +source verification remains separate from installed SDK acceptance. Build +outputs are disposed after retaining logs, JUnit XML, hashes and the database. + +`--memory-empty` runs the same eight value vectors through the existing pure +memory provider with generated Q/E and audited Mutation APIs. Both logging +modes cover relation SUM/COUNT, include-all versus matched-only facet buckets, +one visible row with complete aggregate membership, selected-null JSON and +local fallback without contaminating raw results. No database/schema or SQL +fault injection is used; a counting provider proves queries make zero writes +and produce no fabricated SQL metadata. Each of two JVM rounds uses its own +in-process store. This mode is part of the default example inventory; source +and private SDK acceptance are still separate stages. diff --git a/examples/scalar-type-probe/empty-observations.cjs b/examples/scalar-type-probe/empty-observations.cjs new file mode 100644 index 000000000..5ed9d7667 --- /dev/null +++ b/examples/scalar-type-probe/empty-observations.cjs @@ -0,0 +1,46 @@ +'use strict'; +const assert=require('node:assert/strict'),vectors=require('./empty-vectors.json'); +const purpose='verify generated empty aggregate contract'; +function observation(r,round){ + assert.equal(r.schema,'teaql.java-generated-empty-aggregate/v1');assert.equal(r.passed,true);assert.equal(r.round,round); + assert.equal(r.rows.length,22);assert.equal(r.scalarIds.length,4);assert.equal(r.bucketIds.length,4); + const ids=[...r.scalarIds,...r.bucketIds];assert.equal(new Set(ids).size,8);for(const id of ids)assert(Number.isSafeInteger(id)&&id>0); + let position=0,total=0; + function next(id,logging,count,outcome='success'){ + const row=r.rows[position++];assert.equal(row.case,id);assert.equal(row.logging,logging);assert.equal(row.sql.length,count);total+=count; + for(const sql of row.sql){assert.equal(sql.sql,sql.parameterizedSQL);assert.equal(sql.outcome,outcome);assert.equal(sql.purpose,purpose); + assert(sql.comment?.trim());assert(sql.sql.startsWith('SELECT ')); + assert.equal(sql.traceChain[0].kind,'PURPOSE');assert.equal(sql.traceChain[0].comment,purpose); + assert.equal(sql.traceChain[1].kind,'COMMENT');assert(sql.traceChain[1].comment); + assert.equal(sql.tracePath[0].kind,'OPERATION');assert.equal(sql.tracePath[0].comment,'query'); + assert.equal(sql.tracePath[1].kind,'REQUEST'); + assert.deepEqual(sql.tracePath.slice(-2).map(n=>[n.kind,n.name]),[['PROVIDER','sqlite'],['SQL','select']]); + } + return row; + } + for(const logging of [true,false]){ + for(const vector of vectors.scalarCases){const row=next(vector.id,logging,2); + assert.deepEqual(row.values,{total:vector.sum,rows:vector.countStar,countValue:vector.countValue}); + assert.match(row.sql[0].sql,/sum\(optional_integer\).*count\(id\)/i);assert.match(row.sql[1].sql,/optional_integer IS NOT NULL/i); + } + const empty=next('EA-05',logging,3);assert.deepEqual(empty.values,{count:0,sum:null}); + for(const [index,operation,comment]of [[1,'countScalarTypeProbesWith("rows")','count aggregate contributions'], + [2,'sumOptionalIntegerOfScalarTypeProbesAs("total")','sum aggregate contributions']]){ + assert.deepEqual(empty.sql[index].traceChain.slice(2).map(n=>n.comment),[operation,comment]); + } + for(const includeAll of [true,false]){ + const facet=next('EA-06',logging,9);assert.equal(facet.includeAll,includeAll);assert.equal(facet.visibleRows,1); + const expected=vectors.bucketCases[1].expected;assert.deepEqual(facet.values,includeAll?expected:expected.filter(v=>v.count>0)); + for(const sql of facet.sql.slice(2))assert.equal(sql.traceChain[2].comment,'facetByTypePlatformAs("buckets")'); + assert(facet.sql.some(s=>s.traceChain.some(n=>n.comment==='sum facet contributions'))); + assert(facet.sql.some(s=>s.traceChain.some(n=>n.comment==='count facet contributions'))); + } + const fallback=next('EA-07',logging,1);assert.deepEqual(fallback.values,{raw:null,fallback:0,rawRemains:null}); + const grouped=next('EA-08',logging,1);assert.deepEqual(grouped.groups,[]);assert.match(grouped.sql[0].sql,/GROUP BY/i); + const failure=next('REAL-SQLITE-FAILURE',logging,1,'failure');assert.equal(failure.sql[0].comment,'inspect actual SQLite aggregate failure'); + const recovery=next('QUERY-RECOVERY',logging,1);assert.equal(recovery.sql[0].comment,'load independent detail after SQLite failure'); + assert.equal(recovery.sql[0].traceChain[1].comment,'load independent detail after SQLite failure'); + } + assert.equal(total,66);return {round,cases:22,sqlDriverAttempts:total,loggingModes:2,emptyVectors:8,realSQLiteErrors:2,independentRecoveries:2}; +} +module.exports={observation}; diff --git a/examples/scalar-type-probe/empty-provenance.json b/examples/scalar-type-probe/empty-provenance.json new file mode 100644 index 000000000..0d40c7db0 --- /dev/null +++ b/examples/scalar-type-probe/empty-provenance.json @@ -0,0 +1,10 @@ +{ + "schema": "teaql.java-empty-example-provenance/v1", + "applicationSha256": "631599a3734e174ad1abb2e42f07c459b94a6b1c59b02107ab36b6388c9052af", + "vectorsSha256": "cfaa8dec196bbfa85e830fd0d67f321b17875b6f7d7c5f7cd28e0f2f6770ced0", + "applicationOrigin": "teaql-conformance/evidence/2026-10-25-core-p0-p1/java-selected-empty-installed-v1/application-inputs/JavaEmptyAggregateTest.java", + "installedReportSha256": "e451c593cdcf5a6369c4c345dacf9981bb53de5b913fa79f65ed900c1d64bbfa", + "runtimeCommit": "0afe545b5aa97cfc8b46808e814b7e45018f620e", + "runtimeVersion": "1.555-core236.0afe545b", + "generatedImplementationChanged": false +} diff --git a/examples/scalar-type-probe/empty-vectors.json b/examples/scalar-type-probe/empty-vectors.json new file mode 100644 index 000000000..a699f6d96 --- /dev/null +++ b/examples/scalar-type-probe/empty-vectors.json @@ -0,0 +1,15 @@ +{ + "schema": "teaql.empty-aggregates/v1", + "scalarCases": [ + {"id": "EA-01", "values": [], "countStar": 0, "countValue": 0, "sum": null}, + {"id": "EA-02", "values": [null, null], "countStar": 2, "countValue": 0, "sum": null}, + {"id": "EA-03", "values": [null, 2, -1, null], "countStar": 4, "countValue": 2, "sum": 1}, + {"id": "EA-04", "values": [4, -4], "countStar": 2, "countValue": 2, "sum": 0} + ], + "bucketCases": [ + {"id": "EA-05", "parents": [1], "children": [], "expected": [{"parent": 1, "count": 0, "sum": null}]}, + {"id": "EA-06", "parents": [1, 2, 3, 4], "children": [{"parent": 1, "value": 2}, {"parent": 1, "value": -2}, {"parent": 2, "value": null}, {"parent": 3, "value": 7}], "expected": [{"parent": 1, "count": 2, "sum": 0}, {"parent": 2, "count": 1, "sum": null}, {"parent": 3, "count": 1, "sum": 7}, {"parent": 4, "count": 0, "sum": null}]} + ], + "explicitFallback": {"id": "EA-07", "raw": null, "default": 0, "result": 0, "rawRemains": null}, + "emptyGrouped": {"id": "EA-08", "values": [], "rows": []} +} diff --git a/examples/scalar-type-probe/fixture-manifest.json b/examples/scalar-type-probe/fixture-manifest.json new file mode 100644 index 000000000..eb8329a97 --- /dev/null +++ b/examples/scalar-type-probe/fixture-manifest.json @@ -0,0 +1,37 @@ +{ + "language": "java", + "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "evaluationErrors": 0, + "producerReceiptSha256": "fbff9d53812a89f88ef3edb6a299e197f41912f95fdb025b481a3b0250c8810d", + "producerSource": { + "commit": "096d0e1345661ba2fdfadc311af38b578bab4016", + "diff": "0596dfec78d9d19bb9fea5206fcf54e689757362e9d2a8684de112fc180b78ab", + "status": "442cb38583d0f2e4edecb11ca28c27e8d2093d106dfb440a92a99703e393083b", + "sourceContentsSha256": "53a2d5280ca7f4774ef9ed8bdf427b5b87fb3aa7ce6a906894bc93c66f31fc96", + "assistExporterSha256": "2583414a9d656e89b43b85f1d4e993dcc774b74e2bed0f9b7120d7cb7ea47efd" + }, + "files": { + "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "6d77bea0bef4cebd11bfa2446d8da3e25bd1e94d2276ff20c92b2466d939be1c", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "8ddd890d1ce47f268820aeae3e3f92617ecedb6833ab2932c0d84ad11f0f5e09", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "5c3acc14ce9185a24460c9b85afba2dd57f39c240b04fbd8ccea443e436a001e", + "lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "5b30ec087b361856c32a7cfaa7adaf494a1351692256004bfdefe834d7011d99", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "31da8b9467fb4b1153f80347916bbd09a5d1b03c5afa060fd8cdc1b7d0a79221", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "a30881e5f49a63e363c5be84a76fd464b531fdc90754b0b4c013e040e730713a", + "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b" + } +} diff --git a/examples/scalar-type-probe/generated/lib/pom.xml b/examples/scalar-type-probe/generated/lib/pom.xml new file mode 100644 index 000000000..6f3d904d8 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + scalar-type-conformance-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 1.555-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.555-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/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java new file mode 100644 index 000000000..5ba171d6c --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; + +public interface Constants { + public static final long TYPE_PLATFORM_ID = 1l; + public static final TypePlatform TYPE_PLATFORM = TypePlatform.refer(TYPE_PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/E.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/E.java new file mode 100644 index 000000000..124278a85 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/E.java @@ -0,0 +1,18 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeExpression; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static TypePlatformExpression typePlatform(TypePlatform typePlatform){ + return new TypePlatformExpression(new ValueExpression(typePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.typePlatform()")); + } + public static ScalarTypeProbeExpression scalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new ScalarTypeProbeExpression(new ValueExpression(scalarTypeProbe, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.scalarTypeProbe()")); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java new file mode 100644 index 000000000..59b3f02e9 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -0,0 +1,617 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerTypePlatform(); + registerScalarTypeProbe(); + } + private void registerTypePlatform() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); + entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } + private void registerScalarTypeProbe() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); + entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY, Long.class) + ; + PropertyDescriptor typePlatform = + entityDescriptor.addObjectProperty($factory, com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class) + ; + PropertyDescriptor requiredString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY, String.class) + ; + PropertyDescriptor optionalString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, String.class) + ; + PropertyDescriptor largeText = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY, String.class) + ; + PropertyDescriptor requiredBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor optionalBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor requiredInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor optionalInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor requiredLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor optionalLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor requiredDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor optionalDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor requiredFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor optionalFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor requiredDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor optionalDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor requiredDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor optionalDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor requiredTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor optionalTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor requiredDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor optionalDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") + .with("isTime", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..27b2be578 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -0,0 +1,36 @@ +package com.example.scalartypeconformanceservice; + +/** 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.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .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("TypePlatform", 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("ScalarTypeProbe", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("type_platform", "typePlatform"), java.util.Map.entry("required_string", "requiredString"), java.util.Map.entry("optional_string", "optionalString"), java.util.Map.entry("large_text", "largeText"), java.util.Map.entry("required_boolean", "requiredBoolean"), java.util.Map.entry("optional_boolean", "optionalBoolean"), java.util.Map.entry("required_integer", "requiredInteger"), java.util.Map.entry("optional_integer", "optionalInteger"), java.util.Map.entry("required_long", "requiredLong"), java.util.Map.entry("optional_long", "optionalLong"), java.util.Map.entry("required_decimal", "requiredDecimal"), java.util.Map.entry("optional_decimal", "optionalDecimal"), java.util.Map.entry("required_float", "requiredFloat"), java.util.Map.entry("optional_float", "optionalFloat"), java.util.Map.entry("required_double", "requiredDouble"), java.util.Map.entry("optional_double", "optionalDouble"), java.util.Map.entry("required_date", "requiredDate"), java.util.Map.entry("optional_date", "optionalDate"), java.util.Map.entry("required_time", "requiredTime"), java.util.Map.entry("optional_time", "optionalTime"), java.util.Map.entry("required_datetime", "requiredDatetime"), java.util.Map.entry("optional_datetime", "optionalDatetime"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.typePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.scalartypeconformanceservice.typeplatform.TypePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.scalartypeconformanceservice.typeplatform.TypePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Scalar Type Conformance"); + domainRoot.auditAs("create generated Domain Root TypePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("TypePlatform", domainRoot.getId())); + } +} diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java new file mode 100644 index 000000000..9b6fc69cd --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatforms(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatformsWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbes(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbesWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java new file mode 100644 index 000000000..45450dfc0 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.UserContext; +public interface ScalarTypeConformanceServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java new file mode 100644 index 000000000..cdf764e46 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -0,0 +1,542 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +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 java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class ScalarTypeProbe extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "ScalarTypeProbe"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8d1d53171c01628f604255bcfa7e7d52b6260332cee701781027b0233eae926b"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("type_platform", 1), java.util.Map.entry("required_string", 2), java.util.Map.entry("optional_string", 3), java.util.Map.entry("large_text", 4), java.util.Map.entry("required_boolean", 5), java.util.Map.entry("optional_boolean", 6), java.util.Map.entry("required_integer", 7), java.util.Map.entry("optional_integer", 8), java.util.Map.entry("required_long", 9), java.util.Map.entry("optional_long", 10), java.util.Map.entry("required_decimal", 11), java.util.Map.entry("optional_decimal", 12), java.util.Map.entry("required_float", 13), java.util.Map.entry("optional_float", 14), java.util.Map.entry("required_double", 15), java.util.Map.entry("optional_double", 16), java.util.Map.entry("required_date", 17), java.util.Map.entry("optional_date", 18), java.util.Map.entry("required_time", 19), java.util.Map.entry("optional_time", 20), java.util.Map.entry("required_datetime", 21), java.util.Map.entry("optional_datetime", 22), java.util.Map.entry("create_time", 23), java.util.Map.entry("update_time", 24), java.util.Map.entry("version", 25)); + 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("type_platform", java.util.List.of("typePlatform", "type_platform")), java.util.Map.entry("required_string", java.util.List.of("requiredString", "required_string")), java.util.Map.entry("optional_string", java.util.List.of("optionalString", "optional_string")), java.util.Map.entry("large_text", java.util.List.of("largeText", "large_text")), java.util.Map.entry("required_boolean", java.util.List.of("requiredBoolean", "required_boolean")), java.util.Map.entry("optional_boolean", java.util.List.of("optionalBoolean", "optional_boolean")), java.util.Map.entry("required_integer", java.util.List.of("requiredInteger", "required_integer")), java.util.Map.entry("optional_integer", java.util.List.of("optionalInteger", "optional_integer")), java.util.Map.entry("required_long", java.util.List.of("requiredLong", "required_long")), java.util.Map.entry("optional_long", java.util.List.of("optionalLong", "optional_long")), java.util.Map.entry("required_decimal", java.util.List.of("requiredDecimal", "required_decimal")), java.util.Map.entry("optional_decimal", java.util.List.of("optionalDecimal", "optional_decimal")), java.util.Map.entry("required_float", java.util.List.of("requiredFloat", "required_float")), java.util.Map.entry("optional_float", java.util.List.of("optionalFloat", "optional_float")), java.util.Map.entry("required_double", java.util.List.of("requiredDouble", "required_double")), java.util.Map.entry("optional_double", java.util.List.of("optionalDouble", "optional_double")), java.util.Map.entry("required_date", java.util.List.of("requiredDate", "required_date")), java.util.Map.entry("optional_date", java.util.List.of("optionalDate", "optional_date")), java.util.Map.entry("required_time", java.util.List.of("requiredTime", "required_time")), java.util.Map.entry("optional_time", java.util.List.of("optionalTime", "optional_time")), java.util.Map.entry("required_datetime", java.util.List.of("requiredDatetime", "required_datetime")), java.util.Map.entry("optional_datetime", java.util.List.of("optionalDatetime", "optional_datetime")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + ScalarTypeProbe.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + + + public static final String TYPE_PLATFORM_PROPERTY = "type_platform"; + public static final String REQUIRED_STRING_PROPERTY = "required_string"; + public static final String OPTIONAL_STRING_PROPERTY = "optional_string"; + public static final String LARGE_TEXT_PROPERTY = "large_text"; + public static final String REQUIRED_BOOLEAN_PROPERTY = "required_boolean"; + public static final String OPTIONAL_BOOLEAN_PROPERTY = "optional_boolean"; + public static final String REQUIRED_INTEGER_PROPERTY = "required_integer"; + public static final String OPTIONAL_INTEGER_PROPERTY = "optional_integer"; + public static final String REQUIRED_LONG_PROPERTY = "required_long"; + public static final String OPTIONAL_LONG_PROPERTY = "optional_long"; + public static final String REQUIRED_DECIMAL_PROPERTY = "required_decimal"; + public static final String OPTIONAL_DECIMAL_PROPERTY = "optional_decimal"; + public static final String REQUIRED_FLOAT_PROPERTY = "required_float"; + public static final String OPTIONAL_FLOAT_PROPERTY = "optional_float"; + public static final String REQUIRED_DOUBLE_PROPERTY = "required_double"; + public static final String OPTIONAL_DOUBLE_PROPERTY = "optional_double"; + public static final String REQUIRED_DATE_PROPERTY = "required_date"; + public static final String OPTIONAL_DATE_PROPERTY = "optional_date"; + public static final String REQUIRED_TIME_PROPERTY = "required_time"; + public static final String OPTIONAL_TIME_PROPERTY = "optional_time"; + public static final String REQUIRED_DATETIME_PROPERTY = "required_datetime"; + public static final String OPTIONAL_DATETIME_PROPERTY = "optional_datetime"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private TypePlatform typePlatform; + + private String requiredString; + + private String optionalString; + + private String largeText; + + private Boolean requiredBoolean; + + private Boolean optionalBoolean; + + private Integer requiredInteger; + + private Integer optionalInteger; + + private Long requiredLong; + + private Long optionalLong; + + private BigDecimal requiredDecimal; + + private BigDecimal optionalDecimal; + + private Float requiredFloat; + + private Float optionalFloat; + + private Double requiredDouble; + + private Double optionalDouble; + + private LocalDate requiredDate; + + private LocalDate optionalDate; + + private LocalTime requiredTime; + + private LocalTime optionalTime; + + private LocalDateTime requiredDatetime; + + private LocalDateTime optionalDatetime; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public TypePlatform getTypePlatform(){ + return this.typePlatform; + } + + public String getRequiredString(){ + return this.requiredString; + } + + public String getOptionalString(){ + return this.optionalString; + } + + public String getLargeText(){ + return this.largeText; + } + + public Boolean isRequiredBoolean(){ + return this.requiredBoolean; + } + + public Boolean isOptionalBoolean(){ + return this.optionalBoolean; + } + + public Integer getRequiredInteger(){ + return this.requiredInteger; + } + + public Integer getOptionalInteger(){ + return this.optionalInteger; + } + + public Long getRequiredLong(){ + return this.requiredLong; + } + + public Long getOptionalLong(){ + return this.optionalLong; + } + + public BigDecimal getRequiredDecimal(){ + return this.requiredDecimal; + } + + public BigDecimal getOptionalDecimal(){ + return this.optionalDecimal; + } + + public Float getRequiredFloat(){ + return this.requiredFloat; + } + + public Float getOptionalFloat(){ + return this.optionalFloat; + } + + public Double getRequiredDouble(){ + return this.requiredDouble; + } + + public Double getOptionalDouble(){ + return this.optionalDouble; + } + + public LocalDate getRequiredDate(){ + return this.requiredDate; + } + + public LocalDate getOptionalDate(){ + return this.optionalDate; + } + + public LocalTime getRequiredTime(){ + return this.requiredTime; + } + + public LocalTime getOptionalTime(){ + return this.optionalTime; + } + + public LocalDateTime getRequiredDatetime(){ + return this.requiredDatetime; + } + + public LocalDateTime getOptionalDatetime(){ + return this.optionalDatetime; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public ScalarTypeProbe updateTypePlatform(TypePlatform typePlatform){ + if(Objects.equals(this.typePlatform, typePlatform)){ + return this; + } + handleUpdate(TYPE_PLATFORM_PROPERTY, getTypePlatform(), typePlatform); + this.typePlatform = typePlatform; + return this; + } + + public ScalarTypeProbe updateRequiredString(String requiredString){ + requiredString = (requiredString == null ? null : requiredString.trim()); + if(Objects.equals(this.requiredString, requiredString)){ + return this; + } + handleUpdate(REQUIRED_STRING_PROPERTY, getRequiredString(), requiredString); + this.requiredString = requiredString; + return this; + } + + public ScalarTypeProbe updateOptionalString(String optionalString){ + optionalString = (optionalString == null ? null : optionalString.trim()); + if(Objects.equals(this.optionalString, optionalString)){ + return this; + } + handleUpdate(OPTIONAL_STRING_PROPERTY, getOptionalString(), optionalString); + this.optionalString = optionalString; + return this; + } + + public ScalarTypeProbe updateLargeText(String largeText){ + if(Objects.equals(this.largeText, largeText)){ + return this; + } + handleUpdate(LARGE_TEXT_PROPERTY, getLargeText(), largeText); + this.largeText = largeText; + return this; + } + + public ScalarTypeProbe updateRequiredBoolean(Boolean requiredBoolean){ + if(Objects.equals(this.requiredBoolean, requiredBoolean)){ + return this; + } + handleUpdate(REQUIRED_BOOLEAN_PROPERTY, isRequiredBoolean(), requiredBoolean); + this.requiredBoolean = requiredBoolean; + return this; + } + + public ScalarTypeProbe updateOptionalBoolean(Boolean optionalBoolean){ + if(Objects.equals(this.optionalBoolean, optionalBoolean)){ + return this; + } + handleUpdate(OPTIONAL_BOOLEAN_PROPERTY, isOptionalBoolean(), optionalBoolean); + this.optionalBoolean = optionalBoolean; + return this; + } + + public ScalarTypeProbe updateRequiredInteger(Integer requiredInteger){ + if(Objects.equals(this.requiredInteger, requiredInteger)){ + return this; + } + handleUpdate(REQUIRED_INTEGER_PROPERTY, getRequiredInteger(), requiredInteger); + this.requiredInteger = requiredInteger; + return this; + } + + public ScalarTypeProbe updateOptionalInteger(Integer optionalInteger){ + if(Objects.equals(this.optionalInteger, optionalInteger)){ + return this; + } + handleUpdate(OPTIONAL_INTEGER_PROPERTY, getOptionalInteger(), optionalInteger); + this.optionalInteger = optionalInteger; + return this; + } + + public ScalarTypeProbe updateRequiredLong(Long requiredLong){ + if(Objects.equals(this.requiredLong, requiredLong)){ + return this; + } + handleUpdate(REQUIRED_LONG_PROPERTY, getRequiredLong(), requiredLong); + this.requiredLong = requiredLong; + return this; + } + + public ScalarTypeProbe updateOptionalLong(Long optionalLong){ + if(Objects.equals(this.optionalLong, optionalLong)){ + return this; + } + handleUpdate(OPTIONAL_LONG_PROPERTY, getOptionalLong(), optionalLong); + this.optionalLong = optionalLong; + return this; + } + + public ScalarTypeProbe updateRequiredDecimal(BigDecimal requiredDecimal){ + if(Objects.equals(this.requiredDecimal, requiredDecimal)){ + return this; + } + handleUpdate(REQUIRED_DECIMAL_PROPERTY, getRequiredDecimal(), requiredDecimal); + this.requiredDecimal = requiredDecimal; + return this; + } + + public ScalarTypeProbe updateOptionalDecimal(BigDecimal optionalDecimal){ + if(Objects.equals(this.optionalDecimal, optionalDecimal)){ + return this; + } + handleUpdate(OPTIONAL_DECIMAL_PROPERTY, getOptionalDecimal(), optionalDecimal); + this.optionalDecimal = optionalDecimal; + return this; + } + + public ScalarTypeProbe updateRequiredFloat(Float requiredFloat){ + if(Objects.equals(this.requiredFloat, requiredFloat)){ + return this; + } + handleUpdate(REQUIRED_FLOAT_PROPERTY, getRequiredFloat(), requiredFloat); + this.requiredFloat = requiredFloat; + return this; + } + + public ScalarTypeProbe updateOptionalFloat(Float optionalFloat){ + if(Objects.equals(this.optionalFloat, optionalFloat)){ + return this; + } + handleUpdate(OPTIONAL_FLOAT_PROPERTY, getOptionalFloat(), optionalFloat); + this.optionalFloat = optionalFloat; + return this; + } + + public ScalarTypeProbe updateRequiredDouble(Double requiredDouble){ + if(Objects.equals(this.requiredDouble, requiredDouble)){ + return this; + } + handleUpdate(REQUIRED_DOUBLE_PROPERTY, getRequiredDouble(), requiredDouble); + this.requiredDouble = requiredDouble; + return this; + } + + public ScalarTypeProbe updateOptionalDouble(Double optionalDouble){ + if(Objects.equals(this.optionalDouble, optionalDouble)){ + return this; + } + handleUpdate(OPTIONAL_DOUBLE_PROPERTY, getOptionalDouble(), optionalDouble); + this.optionalDouble = optionalDouble; + return this; + } + + public ScalarTypeProbe updateRequiredDate(LocalDate requiredDate){ + if(Objects.equals(this.requiredDate, requiredDate)){ + return this; + } + handleUpdate(REQUIRED_DATE_PROPERTY, getRequiredDate(), requiredDate); + this.requiredDate = requiredDate; + return this; + } + + public ScalarTypeProbe updateOptionalDate(LocalDate optionalDate){ + if(Objects.equals(this.optionalDate, optionalDate)){ + return this; + } + handleUpdate(OPTIONAL_DATE_PROPERTY, getOptionalDate(), optionalDate); + this.optionalDate = optionalDate; + return this; + } + + public ScalarTypeProbe updateRequiredTime(LocalTime requiredTime){ + if(Objects.equals(this.requiredTime, requiredTime)){ + return this; + } + handleUpdate(REQUIRED_TIME_PROPERTY, getRequiredTime(), requiredTime); + this.requiredTime = requiredTime; + return this; + } + + public ScalarTypeProbe updateOptionalTime(LocalTime optionalTime){ + if(Objects.equals(this.optionalTime, optionalTime)){ + return this; + } + handleUpdate(OPTIONAL_TIME_PROPERTY, getOptionalTime(), optionalTime); + this.optionalTime = optionalTime; + return this; + } + + public ScalarTypeProbe updateRequiredDatetime(LocalDateTime requiredDatetime){ + if(Objects.equals(this.requiredDatetime, requiredDatetime)){ + return this; + } + handleUpdate(REQUIRED_DATETIME_PROPERTY, getRequiredDatetime(), requiredDatetime); + this.requiredDatetime = requiredDatetime; + return this; + } + + public ScalarTypeProbe updateOptionalDatetime(LocalDateTime optionalDatetime){ + if(Objects.equals(this.optionalDatetime, optionalDatetime)){ + return this; + } + handleUpdate(OPTIONAL_DATETIME_PROPERTY, getOptionalDatetime(), optionalDatetime); + this.optionalDatetime = optionalDatetime; + return this; + } + + public ScalarTypeProbe updateCreateTime(LocalDateTime createTime){ + if(Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public ScalarTypeProbe updateUpdateTime(LocalDateTime updateTime){ + if(Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static ScalarTypeProbe refer(Long id){ + ScalarTypeProbe refer = new ScalarTypeProbe(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public ScalarTypeProbe 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 "type_platform": this.typePlatform = (TypePlatform) value; break; + + case "required_string": this.requiredString = (value == null ? null : ((String)value).trim()); break; + + case "optional_string": this.optionalString = (value == null ? null : ((String)value).trim()); break; + + case "large_text": this.largeText = (String) value; break; + + case "required_boolean": this.requiredBoolean = (Boolean) value; break; + + case "optional_boolean": this.optionalBoolean = (Boolean) value; break; + + case "required_integer": this.requiredInteger = (Integer) value; break; + + case "optional_integer": this.optionalInteger = (Integer) value; break; + + case "required_long": this.requiredLong = (Long) value; break; + + case "optional_long": this.optionalLong = (Long) value; break; + + case "required_decimal": this.requiredDecimal = (BigDecimal) value; break; + + case "optional_decimal": this.optionalDecimal = (BigDecimal) value; break; + + case "required_float": this.requiredFloat = (Float) value; break; + + case "optional_float": this.optionalFloat = (Float) value; break; + + case "required_double": this.requiredDouble = (Double) value; break; + + case "optional_double": this.optionalDouble = (Double) value; break; + + case "required_date": this.requiredDate = (LocalDate) value; break; + + case "optional_date": this.optionalDate = (LocalDate) value; break; + + case "required_time": this.requiredTime = (LocalTime) value; break; + + case "optional_time": this.optionalTime = (LocalTime) value; break; + + case "required_datetime": this.requiredDatetime = (LocalDateTime) value; break; + + case "optional_datetime": this.optionalDatetime = (LocalDateTime) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "type_platform": return this.typePlatform; + case "required_string": return this.requiredString; + case "optional_string": return this.optionalString; + case "large_text": return this.largeText; + case "required_boolean": return this.requiredBoolean; + case "optional_boolean": return this.optionalBoolean; + case "required_integer": return this.requiredInteger; + case "optional_integer": return this.optionalInteger; + case "required_long": return this.requiredLong; + case "optional_long": return this.optionalLong; + case "required_decimal": return this.requiredDecimal; + case "optional_decimal": return this.optionalDecimal; + case "required_float": return this.requiredFloat; + case "optional_float": return this.optionalFloat; + case "required_double": return this.requiredDouble; + case "optional_double": return this.optionalDouble; + case "required_date": return this.requiredDate; + case "optional_date": return this.optionalDate; + case "required_time": return this.requiredTime; + case "optional_time": return this.optionalTime; + case "required_datetime": return this.requiredDatetime; + case "optional_datetime": return this.optionalDatetime; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java new file mode 100644 index 000000000..d55fe2420 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -0,0 +1,280 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class ScalarTypeProbeChecker implements Checker{ + + public String type(){ + return ScalarTypeProbe.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if(needCheck(_context, scalarTypeProbe)){ + markAsChecked(_context, scalarTypeProbe); + doCheck(_context, scalarTypeProbe, _parentLocation); + } + } + + public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if((scalarTypeProbe == null)){ + return; + } + if(scalarTypeProbe.newItem()){ + if(scalarTypeProbe.getCreateTime() == null){ + scalarTypeProbe.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + }if(scalarTypeProbe.getUpdateTime() == null){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + } + }else if(scalarTypeProbe.updateItem()){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("large_text")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "large_text"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkTypePlatform(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY), newLocation(_parentLocation, "type_platform")); + checkRequiredString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY), newLocation(_parentLocation, "required_string")); + checkOptionalString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY), newLocation(_parentLocation, "optional_string")); + checkLargeText(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY), newLocation(_parentLocation, "large_text")); + checkRequiredBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY), newLocation(_parentLocation, "required_boolean")); + checkOptionalBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY), newLocation(_parentLocation, "optional_boolean")); + checkRequiredInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY), newLocation(_parentLocation, "required_integer")); + checkOptionalInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY), newLocation(_parentLocation, "optional_integer")); + checkRequiredLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY), newLocation(_parentLocation, "required_long")); + checkOptionalLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY), newLocation(_parentLocation, "optional_long")); + checkRequiredDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY), newLocation(_parentLocation, "required_decimal")); + checkOptionalDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY), newLocation(_parentLocation, "optional_decimal")); + checkRequiredFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY), newLocation(_parentLocation, "required_float")); + checkOptionalFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY), newLocation(_parentLocation, "optional_float")); + checkRequiredDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY), newLocation(_parentLocation, "required_double")); + checkOptionalDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY), newLocation(_parentLocation, "optional_double")); + checkRequiredDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY), newLocation(_parentLocation, "required_date")); + checkOptionalDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY), newLocation(_parentLocation, "optional_date")); + checkRequiredTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY), newLocation(_parentLocation, "required_time")); + checkOptionalTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY), newLocation(_parentLocation, "optional_time")); + checkRequiredDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY), newLocation(_parentLocation, "required_datetime")); + checkOptionalDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY), newLocation(_parentLocation, "optional_datetime")); + checkCreateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkTypePlatform(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, typePlatform); + if((typePlatform == null)){ + return; + } + new TypePlatformChecker().checkAndFix(_context, typePlatform, _parentLocation); + } + public void checkRequiredString(UserContext _context, String requiredString, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredString); + if((requiredString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, requiredString); + + } + public void checkOptionalString(UserContext _context, String optionalString, ObjectLocation _parentLocation){ + if((optionalString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, optionalString); + + } + public void checkLargeText(UserContext _context, String largeText, ObjectLocation _parentLocation){ + if((largeText == null)){ + return; + } + } + public void checkRequiredBoolean(UserContext _context, Boolean requiredBoolean, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredBoolean); + if((requiredBoolean == null)){ + return; + } + } + public void checkOptionalBoolean(UserContext _context, Boolean optionalBoolean, ObjectLocation _parentLocation){ + if((optionalBoolean == null)){ + return; + } + } + public void checkRequiredInteger(UserContext _context, Integer requiredInteger, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredInteger); + if((requiredInteger == null)){ + return; + } + } + public void checkOptionalInteger(UserContext _context, Integer optionalInteger, ObjectLocation _parentLocation){ + if((optionalInteger == null)){ + return; + } + } + public void checkRequiredLong(UserContext _context, Long requiredLong, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredLong); + if((requiredLong == null)){ + return; + } + } + public void checkOptionalLong(UserContext _context, Long optionalLong, ObjectLocation _parentLocation){ + if((optionalLong == null)){ + return; + } + } + public void checkRequiredDecimal(UserContext _context, BigDecimal requiredDecimal, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDecimal); + if((requiredDecimal == null)){ + return; + } + } + public void checkOptionalDecimal(UserContext _context, BigDecimal optionalDecimal, ObjectLocation _parentLocation){ + if((optionalDecimal == null)){ + return; + } + } + public void checkRequiredFloat(UserContext _context, Float requiredFloat, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredFloat); + if((requiredFloat == null)){ + return; + } + } + public void checkOptionalFloat(UserContext _context, Float optionalFloat, ObjectLocation _parentLocation){ + if((optionalFloat == null)){ + return; + } + } + public void checkRequiredDouble(UserContext _context, Double requiredDouble, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDouble); + if((requiredDouble == null)){ + return; + } + } + public void checkOptionalDouble(UserContext _context, Double optionalDouble, ObjectLocation _parentLocation){ + if((optionalDouble == null)){ + return; + } + } + public void checkRequiredDate(UserContext _context, LocalDate requiredDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDate); + if((requiredDate == null)){ + return; + } + } + public void checkOptionalDate(UserContext _context, LocalDate optionalDate, ObjectLocation _parentLocation){ + if((optionalDate == null)){ + return; + } + } + public void checkRequiredTime(UserContext _context, LocalTime requiredTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredTime); + if((requiredTime == null)){ + return; + } + } + public void checkOptionalTime(UserContext _context, LocalTime optionalTime, ObjectLocation _parentLocation){ + if((optionalTime == null)){ + return; + } + } + public void checkRequiredDatetime(UserContext _context, LocalDateTime requiredDatetime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDatetime); + if((requiredDatetime == null)){ + return; + } + } + public void checkOptionalDatetime(UserContext _context, LocalDateTime optionalDatetime, ObjectLocation _parentLocation){ + if((optionalDatetime == null)){ + return; + } + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java new file mode 100644 index 000000000..4ff37872d --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java @@ -0,0 +1,211 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.function.Function; + +public class ScalarTypeProbeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public ScalarTypeProbeExpression(Expression expression){ + super(expression); + } + + public ScalarTypeProbeExpression(Expression expression, Function function){ + super(expression, function); + } + + public ScalarTypeProbeExpression updateId(Long id){ + return new ScalarTypeProbeExpression(this, $it -> {((ScalarTypeProbe)$it).__internalSet("id", id); return this;}); + } + + public ScalarTypeProbeExpression save(UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs("Saved by Expression").save(userContext)); + } + + public ScalarTypeProbeExpression save(String intent, UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public TypePlatformExpression getTypePlatform(){ + return new TypePlatformExpression(loaded("type_platform", "getTypePlatform", ScalarTypeProbe::getTypePlatform)); + } + + public ScalarTypeProbeExpression updateTypePlatform(TypePlatform typePlatform){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateTypePlatform(typePlatform)); + } + + public Expression getRequiredString(){ + return loaded("required_string", "getRequiredString", ScalarTypeProbe::getRequiredString); + } + public ScalarTypeProbeExpression updateRequiredString(String requiredString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredString(requiredString)); + } + + public Expression getOptionalString(){ + return loaded("optional_string", "getOptionalString", ScalarTypeProbe::getOptionalString); + } + public ScalarTypeProbeExpression updateOptionalString(String optionalString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalString(optionalString)); + } + + public Expression getLargeText(){ + return loaded("large_text", "getLargeText", ScalarTypeProbe::getLargeText); + } + public ScalarTypeProbeExpression updateLargeText(String largeText){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateLargeText(largeText)); + } + + public Expression isRequiredBoolean(){ + return loaded("required_boolean", "isRequiredBoolean", ScalarTypeProbe::isRequiredBoolean); + } + public ScalarTypeProbeExpression updateRequiredBoolean(Boolean requiredBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredBoolean(requiredBoolean)); + } + + public Expression isOptionalBoolean(){ + return loaded("optional_boolean", "isOptionalBoolean", ScalarTypeProbe::isOptionalBoolean); + } + public ScalarTypeProbeExpression updateOptionalBoolean(Boolean optionalBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalBoolean(optionalBoolean)); + } + + public Expression getRequiredInteger(){ + return loaded("required_integer", "getRequiredInteger", ScalarTypeProbe::getRequiredInteger); + } + public ScalarTypeProbeExpression updateRequiredInteger(Integer requiredInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredInteger(requiredInteger)); + } + + public Expression getOptionalInteger(){ + return loaded("optional_integer", "getOptionalInteger", ScalarTypeProbe::getOptionalInteger); + } + public ScalarTypeProbeExpression updateOptionalInteger(Integer optionalInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalInteger(optionalInteger)); + } + + public Expression getRequiredLong(){ + return loaded("required_long", "getRequiredLong", ScalarTypeProbe::getRequiredLong); + } + public ScalarTypeProbeExpression updateRequiredLong(Long requiredLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredLong(requiredLong)); + } + + public Expression getOptionalLong(){ + return loaded("optional_long", "getOptionalLong", ScalarTypeProbe::getOptionalLong); + } + public ScalarTypeProbeExpression updateOptionalLong(Long optionalLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalLong(optionalLong)); + } + + public Expression getRequiredDecimal(){ + return loaded("required_decimal", "getRequiredDecimal", ScalarTypeProbe::getRequiredDecimal); + } + public ScalarTypeProbeExpression updateRequiredDecimal(BigDecimal requiredDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDecimal(requiredDecimal)); + } + + public Expression getOptionalDecimal(){ + return loaded("optional_decimal", "getOptionalDecimal", ScalarTypeProbe::getOptionalDecimal); + } + public ScalarTypeProbeExpression updateOptionalDecimal(BigDecimal optionalDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDecimal(optionalDecimal)); + } + + public Expression getRequiredFloat(){ + return loaded("required_float", "getRequiredFloat", ScalarTypeProbe::getRequiredFloat); + } + public ScalarTypeProbeExpression updateRequiredFloat(Float requiredFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredFloat(requiredFloat)); + } + + public Expression getOptionalFloat(){ + return loaded("optional_float", "getOptionalFloat", ScalarTypeProbe::getOptionalFloat); + } + public ScalarTypeProbeExpression updateOptionalFloat(Float optionalFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalFloat(optionalFloat)); + } + + public Expression getRequiredDouble(){ + return loaded("required_double", "getRequiredDouble", ScalarTypeProbe::getRequiredDouble); + } + public ScalarTypeProbeExpression updateRequiredDouble(Double requiredDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDouble(requiredDouble)); + } + + public Expression getOptionalDouble(){ + return loaded("optional_double", "getOptionalDouble", ScalarTypeProbe::getOptionalDouble); + } + public ScalarTypeProbeExpression updateOptionalDouble(Double optionalDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDouble(optionalDouble)); + } + + public Expression getRequiredDate(){ + return loaded("required_date", "getRequiredDate", ScalarTypeProbe::getRequiredDate); + } + public ScalarTypeProbeExpression updateRequiredDate(LocalDate requiredDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDate(requiredDate)); + } + + public Expression getOptionalDate(){ + return loaded("optional_date", "getOptionalDate", ScalarTypeProbe::getOptionalDate); + } + public ScalarTypeProbeExpression updateOptionalDate(LocalDate optionalDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDate(optionalDate)); + } + + public Expression getRequiredTime(){ + return loaded("required_time", "getRequiredTime", ScalarTypeProbe::getRequiredTime); + } + public ScalarTypeProbeExpression updateRequiredTime(LocalTime requiredTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredTime(requiredTime)); + } + + public Expression getOptionalTime(){ + return loaded("optional_time", "getOptionalTime", ScalarTypeProbe::getOptionalTime); + } + public ScalarTypeProbeExpression updateOptionalTime(LocalTime optionalTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalTime(optionalTime)); + } + + public Expression getRequiredDatetime(){ + return loaded("required_datetime", "getRequiredDatetime", ScalarTypeProbe::getRequiredDatetime); + } + public ScalarTypeProbeExpression updateRequiredDatetime(LocalDateTime requiredDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDatetime(requiredDatetime)); + } + + public Expression getOptionalDatetime(){ + return loaded("optional_datetime", "getOptionalDatetime", ScalarTypeProbe::getOptionalDatetime); + } + public ScalarTypeProbeExpression updateOptionalDatetime(LocalDateTime optionalDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDatetime(optionalDatetime)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", ScalarTypeProbe::getCreateTime); + } + public ScalarTypeProbeExpression updateCreateTime(LocalDateTime createTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", ScalarTypeProbe::getUpdateTime); + } + public ScalarTypeProbeExpression updateUpdateTime(LocalDateTime updateTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java new file mode 100644 index 000000000..8f2542a82 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class ScalarTypeProbeListExpression extends SmartListExpression { + public ScalarTypeProbeListExpression(Expression> expression){ + super(expression); + } + + public ScalarTypeProbeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public ScalarTypeProbeExpression first() { + return new ScalarTypeProbeExpression(super.first()); + } + + public ScalarTypeProbeExpression get(int index) { + return new ScalarTypeProbeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java new file mode 100644 index 000000000..6a60aaedd --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -0,0 +1,3766 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; + +public class ScalarTypeProbeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest(Class returnType){ + this(returnType, () -> (T) new ScalarTypeProbe()); + } + + protected ScalarTypeProbeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public ScalarTypeProbeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public ScalarTypeProbeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public ScalarTypeProbeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public ScalarTypeProbeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public ScalarTypeProbeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (ScalarTypeProbeRequest)super.appendSearchCriteria(searchCriteria); + } + + public ScalarTypeProbeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarTypeProbe){ + super.internalMatchAny(scalarTypeProbe); + return this; + } + + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public ScalarTypeProbeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public ScalarTypeProbeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public ScalarTypeProbeRequest selectSelf(){ + super.selectSelf(); + return selectId().selectTypePlatformIdOnly().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectSelfFields(){ + return selectSelf(); + } + + public ScalarTypeProbeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(ScalarTypeProbe.ID_PROPERTY); + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectAll(){ + super.selectAll(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectChildren(){ + super.selectAny(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public ScalarTypeProbeRequest selectId(){ + selectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectId(){ + unselectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectTypePlatformIdOnly(){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectTypePlatform(){ + return selectTypePlatformWith(Q.typePlatforms().unlimited().selectSelf()); + } + + public ScalarTypeProbeRequest selectTypePlatformWith(TypePlatformRequest typePlatform){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + enhanceRelation(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTypePlatformWith", null, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + public ScalarTypeProbeRequest unselectTypePlatform(){ + unselectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredString(){ + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + /** + * fill the requiredString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredString) to fetch requiredString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredString(){ + unselectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalString(){ + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + /** + * fill the optionalString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalString) to fetch optionalString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalString(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectLargeText(){ + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + /** + * fill the largeText with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS largeText) to fetch largeText property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectLargeText(){ + unselectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredBoolean(){ + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the requiredBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredBoolean) to fetch requiredBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredBoolean(){ + unselectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalBoolean(){ + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the optionalBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalBoolean) to fetch optionalBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalBoolean(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredInteger(){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + /** + * fill the requiredInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredInteger) to fetch requiredInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredInteger) AS requiredInteger to fetch requiredInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredInteger(){ + unselectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalInteger(){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + /** + * fill the optionalInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalInteger) to fetch optionalInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalInteger) AS optionalInteger to fetch optionalInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalInteger(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredLong(){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + /** + * fill the requiredLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredLong) to fetch requiredLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredLong with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredLong) AS requiredLong to fetch requiredLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredLong(){ + unselectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalLong(){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + /** + * fill the optionalLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalLong) to fetch optionalLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalLong with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalLong) AS optionalLong to fetch optionalLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalLong(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDecimal(){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the requiredDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDecimal) to fetch requiredDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDecimal) AS requiredDecimal to fetch requiredDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDecimal(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDecimal(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the optionalDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDecimal) to fetch optionalDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDecimal) AS optionalDecimal to fetch optionalDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDecimal(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredFloat(){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + /** + * fill the requiredFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredFloat) to fetch requiredFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredFloat) AS requiredFloat to fetch requiredFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredFloat(){ + unselectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalFloat(){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + /** + * fill the optionalFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalFloat) to fetch optionalFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalFloat) AS optionalFloat to fetch optionalFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalFloat(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDouble(){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the requiredDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDouble) to fetch requiredDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDouble) AS requiredDouble to fetch requiredDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDouble(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDouble(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the optionalDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDouble) to fetch optionalDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDouble) AS optionalDouble to fetch optionalDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDouble(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDate(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + /** + * fill the requiredDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDate) to fetch requiredDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDate(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDate(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + /** + * fill the optionalDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDate) to fetch optionalDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDate(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredTime(){ + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + /** + * fill the requiredTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredTime) to fetch requiredTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredTime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalTime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + /** + * fill the optionalTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalTime) to fetch optionalTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalTime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDatetime(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + /** + * fill the requiredDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDatetime) to fetch requiredDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDatetime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDatetime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + /** + * fill the optionalDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDatetime) to fetch optionalDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDatetime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectCreateTime(){ + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectCreateTime(){ + unselectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectUpdateTime(){ + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectUpdateTime(){ + unselectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectVersion(){ + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectVersion(){ + unselectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.ID_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public ScalarTypeProbeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public ScalarTypeProbeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public ScalarTypeProbeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public ScalarTypeProbeRequest filterByTypePlatform(TypePlatform... typePlatform){ + if (typePlatform == null || typePlatform.length == 0) { + throw new IllegalArgumentException("filterByTypePlatform parameter typePlatform cannot be empty"); + } + return appendSearchCriteria(createTypePlatformCriteria(Operator.EQUAL, (Object[])typePlatform)); + } + + public ScalarTypeProbeRequest withTypePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createTypePlatformCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withTypePlatformIsUnknown(){ + return withTypePlatform(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withTypePlatformIsKnown(){ + return withTypePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTypePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest filterByTypePlatform(Long typePlatform){ + if(typePlatform == null){ + return this; + } + return withTypePlatform(Operator.EQUAL, typePlatform); + } + public ScalarTypeProbeRequest withTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY)); + } + + public ScalarTypeProbeRequest withoutTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY))); + } + + public ScalarTypeProbeRequest filterByRequiredString(String... requiredString){ + if (requiredString == null || requiredString.length == 0) { + throw new IllegalArgumentException("filterByRequiredString parameter requiredString cannot be empty"); + } + return appendSearchCriteria(createRequiredStringCriteria(Operator.EQUAL, (Object[])requiredString)); + } + + public ScalarTypeProbeRequest withRequiredString(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredStringIsUnknown(){ + return withRequiredString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredStringIsKnown(){ + return withRequiredString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredStringIsNot(String requiredString){ + return withRequiredString(Operator.NOT_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIn(String... requiredString){ + return withRequiredString(Operator.IN, (Object[])requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotIn(String... requiredString){ + return withRequiredString(Operator.NOT_IN, (Object[])requiredString); + } + public ScalarTypeProbeRequest withRequiredStringGreaterThan(String requiredString){ + return withRequiredString(Operator.GREATER_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringGreaterThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.GREATER_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThan(String requiredString){ + return withRequiredString(Operator.LESS_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.LESS_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringBetween(String startOfRequiredString, String endOfRequiredString){ + return withRequiredString(Operator.BETWEEN, startOfRequiredString, endOfRequiredString); + } + public ScalarTypeProbeRequest withRequiredStringStartingWith(String requiredString){ + return withRequiredString(Operator.BEGIN_WITH, requiredString); + } + public ScalarTypeProbeRequest withRequiredStringContaining(String requiredString){ + return withRequiredString(Operator.CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotContaining(String requiredString){ + return withRequiredString(Operator.NOT_CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotStartingWith(String requiredString){ + return withRequiredString(Operator.NOT_BEGIN_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringEndingWith(String requiredString){ + return withRequiredString(Operator.END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotEndingWith(String requiredString){ + return withRequiredString(Operator.NOT_END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIs(String requiredString){ + return withRequiredString(Operator.EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringSoundingLike(String requiredString){ + return withRequiredString(Operator.SOUNDS_LIKE, requiredString); + } + + + + public ScalarTypeProbeRequest filterByOptionalString(String... optionalString){ + if (optionalString == null || optionalString.length == 0) { + throw new IllegalArgumentException("filterByOptionalString parameter optionalString cannot be empty"); + } + return appendSearchCriteria(createOptionalStringCriteria(Operator.EQUAL, (Object[])optionalString)); + } + + public ScalarTypeProbeRequest withOptionalString(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalStringIsUnknown(){ + return withOptionalString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalStringIsKnown(){ + return withOptionalString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalStringIsNot(String optionalString){ + return withOptionalString(Operator.NOT_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIn(String... optionalString){ + return withOptionalString(Operator.IN, (Object[])optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotIn(String... optionalString){ + return withOptionalString(Operator.NOT_IN, (Object[])optionalString); + } + public ScalarTypeProbeRequest withOptionalStringGreaterThan(String optionalString){ + return withOptionalString(Operator.GREATER_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringGreaterThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.GREATER_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThan(String optionalString){ + return withOptionalString(Operator.LESS_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.LESS_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringBetween(String startOfOptionalString, String endOfOptionalString){ + return withOptionalString(Operator.BETWEEN, startOfOptionalString, endOfOptionalString); + } + public ScalarTypeProbeRequest withOptionalStringStartingWith(String optionalString){ + return withOptionalString(Operator.BEGIN_WITH, optionalString); + } + public ScalarTypeProbeRequest withOptionalStringContaining(String optionalString){ + return withOptionalString(Operator.CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotContaining(String optionalString){ + return withOptionalString(Operator.NOT_CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotStartingWith(String optionalString){ + return withOptionalString(Operator.NOT_BEGIN_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringEndingWith(String optionalString){ + return withOptionalString(Operator.END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotEndingWith(String optionalString){ + return withOptionalString(Operator.NOT_END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIs(String optionalString){ + return withOptionalString(Operator.EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringSoundingLike(String optionalString){ + return withOptionalString(Operator.SOUNDS_LIKE, optionalString); + } + + + + public ScalarTypeProbeRequest filterByLargeText(String... largeText){ + if (largeText == null || largeText.length == 0) { + throw new IllegalArgumentException("filterByLargeText parameter largeText cannot be empty"); + } + return appendSearchCriteria(createLargeTextCriteria(Operator.EQUAL, (Object[])largeText)); + } + + public ScalarTypeProbeRequest withLargeText(Operator operator, Object... values){ + return appendSearchCriteria(createLargeTextCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withLargeTextIsUnknown(){ + return withLargeText(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withLargeTextIsKnown(){ + return withLargeText(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLargeTextCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.LARGE_TEXT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withLargeTextIsNot(String largeText){ + return withLargeText(Operator.NOT_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextIn(String... largeText){ + return withLargeText(Operator.IN, (Object[])largeText); + } + + public ScalarTypeProbeRequest withLargeTextNotIn(String... largeText){ + return withLargeText(Operator.NOT_IN, (Object[])largeText); + } + public ScalarTypeProbeRequest withLargeTextGreaterThan(String largeText){ + return withLargeText(Operator.GREATER_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextGreaterThanOrEqualTo(String largeText){ + return withLargeText(Operator.GREATER_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThan(String largeText){ + return withLargeText(Operator.LESS_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThanOrEqualTo(String largeText){ + return withLargeText(Operator.LESS_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextBetween(String startOfLargeText, String endOfLargeText){ + return withLargeText(Operator.BETWEEN, startOfLargeText, endOfLargeText); + } + public ScalarTypeProbeRequest withLargeTextIs(String largeText){ + return withLargeText(Operator.EQUAL, largeText); + } + + + + public ScalarTypeProbeRequest filterByRequiredBoolean(Boolean... requiredBoolean){ + if (requiredBoolean == null || requiredBoolean.length == 0) { + throw new IllegalArgumentException("filterByRequiredBoolean parameter requiredBoolean cannot be empty"); + } + return appendSearchCriteria(createRequiredBooleanCriteria(Operator.EQUAL, (Object[])requiredBoolean)); + } + + public ScalarTypeProbeRequest withRequiredBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsUnknown(){ + return withRequiredBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsKnown(){ + return withRequiredBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByOptionalBoolean(Boolean... optionalBoolean){ + if (optionalBoolean == null || optionalBoolean.length == 0) { + throw new IllegalArgumentException("filterByOptionalBoolean parameter optionalBoolean cannot be empty"); + } + return appendSearchCriteria(createOptionalBooleanCriteria(Operator.EQUAL, (Object[])optionalBoolean)); + } + + public ScalarTypeProbeRequest withOptionalBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsUnknown(){ + return withOptionalBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsKnown(){ + return withOptionalBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByRequiredInteger(Integer... requiredInteger){ + if (requiredInteger == null || requiredInteger.length == 0) { + throw new IllegalArgumentException("filterByRequiredInteger parameter requiredInteger cannot be empty"); + } + return appendSearchCriteria(createRequiredIntegerCriteria(Operator.EQUAL, (Object[])requiredInteger)); + } + + public ScalarTypeProbeRequest withRequiredInteger(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsUnknown(){ + return withRequiredInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsKnown(){ + return withRequiredInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredIntegerIs(Integer requiredInteger){ + return withRequiredInteger(Operator.EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsNot(Integer requiredInteger){ + return withRequiredInteger(Operator.NOT_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.IN, (Object[])requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerNotIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.NOT_IN, (Object[])requiredInteger); + } + public ScalarTypeProbeRequest withRequiredIntegerGreaterThan(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerGreaterThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThan(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerBetween(Integer startOfRequiredInteger, Integer endOfRequiredInteger){ + return withRequiredInteger(Operator.BETWEEN, startOfRequiredInteger, endOfRequiredInteger); + } + + + + public ScalarTypeProbeRequest filterByOptionalInteger(Integer... optionalInteger){ + if (optionalInteger == null || optionalInteger.length == 0) { + throw new IllegalArgumentException("filterByOptionalInteger parameter optionalInteger cannot be empty"); + } + return appendSearchCriteria(createOptionalIntegerCriteria(Operator.EQUAL, (Object[])optionalInteger)); + } + + public ScalarTypeProbeRequest withOptionalInteger(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsUnknown(){ + return withOptionalInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsKnown(){ + return withOptionalInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalIntegerIs(Integer optionalInteger){ + return withOptionalInteger(Operator.EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsNot(Integer optionalInteger){ + return withOptionalInteger(Operator.NOT_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.IN, (Object[])optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerNotIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.NOT_IN, (Object[])optionalInteger); + } + public ScalarTypeProbeRequest withOptionalIntegerGreaterThan(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerGreaterThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThan(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerBetween(Integer startOfOptionalInteger, Integer endOfOptionalInteger){ + return withOptionalInteger(Operator.BETWEEN, startOfOptionalInteger, endOfOptionalInteger); + } + + + + public ScalarTypeProbeRequest filterByRequiredLong(Long... requiredLong){ + if (requiredLong == null || requiredLong.length == 0) { + throw new IllegalArgumentException("filterByRequiredLong parameter requiredLong cannot be empty"); + } + return appendSearchCriteria(createRequiredLongCriteria(Operator.EQUAL, (Object[])requiredLong)); + } + + public ScalarTypeProbeRequest withRequiredLong(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredLongIsUnknown(){ + return withRequiredLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredLongIsKnown(){ + return withRequiredLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredLongIs(Long requiredLong){ + return withRequiredLong(Operator.EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIsNot(Long requiredLong){ + return withRequiredLong(Operator.NOT_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIn(Long... requiredLong){ + return withRequiredLong(Operator.IN, (Object[])requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongNotIn(Long... requiredLong){ + return withRequiredLong(Operator.NOT_IN, (Object[])requiredLong); + } + public ScalarTypeProbeRequest withRequiredLongGreaterThan(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongGreaterThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThan(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongBetween(Long startOfRequiredLong, Long endOfRequiredLong){ + return withRequiredLong(Operator.BETWEEN, startOfRequiredLong, endOfRequiredLong); + } + + + + public ScalarTypeProbeRequest filterByOptionalLong(Long... optionalLong){ + if (optionalLong == null || optionalLong.length == 0) { + throw new IllegalArgumentException("filterByOptionalLong parameter optionalLong cannot be empty"); + } + return appendSearchCriteria(createOptionalLongCriteria(Operator.EQUAL, (Object[])optionalLong)); + } + + public ScalarTypeProbeRequest withOptionalLong(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalLongIsUnknown(){ + return withOptionalLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalLongIsKnown(){ + return withOptionalLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalLongIs(Long optionalLong){ + return withOptionalLong(Operator.EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIsNot(Long optionalLong){ + return withOptionalLong(Operator.NOT_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIn(Long... optionalLong){ + return withOptionalLong(Operator.IN, (Object[])optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongNotIn(Long... optionalLong){ + return withOptionalLong(Operator.NOT_IN, (Object[])optionalLong); + } + public ScalarTypeProbeRequest withOptionalLongGreaterThan(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongGreaterThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThan(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongBetween(Long startOfOptionalLong, Long endOfOptionalLong){ + return withOptionalLong(Operator.BETWEEN, startOfOptionalLong, endOfOptionalLong); + } + + + + public ScalarTypeProbeRequest filterByRequiredDecimal(BigDecimal... requiredDecimal){ + if (requiredDecimal == null || requiredDecimal.length == 0) { + throw new IllegalArgumentException("filterByRequiredDecimal parameter requiredDecimal cannot be empty"); + } + return appendSearchCriteria(createRequiredDecimalCriteria(Operator.EQUAL, (Object[])requiredDecimal)); + } + + public ScalarTypeProbeRequest withRequiredDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsUnknown(){ + return withRequiredDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsKnown(){ + return withRequiredDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDecimalIs(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsNot(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.NOT_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.IN, (Object[])requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalNotIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.NOT_IN, (Object[])requiredDecimal); + } + public ScalarTypeProbeRequest withRequiredDecimalGreaterThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalGreaterThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalBetween(BigDecimal startOfRequiredDecimal, BigDecimal endOfRequiredDecimal){ + return withRequiredDecimal(Operator.BETWEEN, startOfRequiredDecimal, endOfRequiredDecimal); + } + + + + public ScalarTypeProbeRequest filterByOptionalDecimal(BigDecimal... optionalDecimal){ + if (optionalDecimal == null || optionalDecimal.length == 0) { + throw new IllegalArgumentException("filterByOptionalDecimal parameter optionalDecimal cannot be empty"); + } + return appendSearchCriteria(createOptionalDecimalCriteria(Operator.EQUAL, (Object[])optionalDecimal)); + } + + public ScalarTypeProbeRequest withOptionalDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsUnknown(){ + return withOptionalDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsKnown(){ + return withOptionalDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDecimalIs(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsNot(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.NOT_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.IN, (Object[])optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalNotIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.NOT_IN, (Object[])optionalDecimal); + } + public ScalarTypeProbeRequest withOptionalDecimalGreaterThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalGreaterThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalBetween(BigDecimal startOfOptionalDecimal, BigDecimal endOfOptionalDecimal){ + return withOptionalDecimal(Operator.BETWEEN, startOfOptionalDecimal, endOfOptionalDecimal); + } + + + + public ScalarTypeProbeRequest filterByRequiredFloat(Float... requiredFloat){ + if (requiredFloat == null || requiredFloat.length == 0) { + throw new IllegalArgumentException("filterByRequiredFloat parameter requiredFloat cannot be empty"); + } + return appendSearchCriteria(createRequiredFloatCriteria(Operator.EQUAL, (Object[])requiredFloat)); + } + + public ScalarTypeProbeRequest withRequiredFloat(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredFloatIsUnknown(){ + return withRequiredFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredFloatIsKnown(){ + return withRequiredFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredFloatIs(Float requiredFloat){ + return withRequiredFloat(Operator.EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIsNot(Float requiredFloat){ + return withRequiredFloat(Operator.NOT_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIn(Float... requiredFloat){ + return withRequiredFloat(Operator.IN, (Object[])requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatNotIn(Float... requiredFloat){ + return withRequiredFloat(Operator.NOT_IN, (Object[])requiredFloat); + } + public ScalarTypeProbeRequest withRequiredFloatGreaterThan(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatGreaterThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThan(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatBetween(Float startOfRequiredFloat, Float endOfRequiredFloat){ + return withRequiredFloat(Operator.BETWEEN, startOfRequiredFloat, endOfRequiredFloat); + } + + + + public ScalarTypeProbeRequest filterByOptionalFloat(Float... optionalFloat){ + if (optionalFloat == null || optionalFloat.length == 0) { + throw new IllegalArgumentException("filterByOptionalFloat parameter optionalFloat cannot be empty"); + } + return appendSearchCriteria(createOptionalFloatCriteria(Operator.EQUAL, (Object[])optionalFloat)); + } + + public ScalarTypeProbeRequest withOptionalFloat(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalFloatIsUnknown(){ + return withOptionalFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalFloatIsKnown(){ + return withOptionalFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalFloatIs(Float optionalFloat){ + return withOptionalFloat(Operator.EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIsNot(Float optionalFloat){ + return withOptionalFloat(Operator.NOT_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIn(Float... optionalFloat){ + return withOptionalFloat(Operator.IN, (Object[])optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatNotIn(Float... optionalFloat){ + return withOptionalFloat(Operator.NOT_IN, (Object[])optionalFloat); + } + public ScalarTypeProbeRequest withOptionalFloatGreaterThan(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatGreaterThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThan(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatBetween(Float startOfOptionalFloat, Float endOfOptionalFloat){ + return withOptionalFloat(Operator.BETWEEN, startOfOptionalFloat, endOfOptionalFloat); + } + + + + public ScalarTypeProbeRequest filterByRequiredDouble(Double... requiredDouble){ + if (requiredDouble == null || requiredDouble.length == 0) { + throw new IllegalArgumentException("filterByRequiredDouble parameter requiredDouble cannot be empty"); + } + return appendSearchCriteria(createRequiredDoubleCriteria(Operator.EQUAL, (Object[])requiredDouble)); + } + + public ScalarTypeProbeRequest withRequiredDouble(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsUnknown(){ + return withRequiredDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsKnown(){ + return withRequiredDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDoubleIs(Double requiredDouble){ + return withRequiredDouble(Operator.EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsNot(Double requiredDouble){ + return withRequiredDouble(Operator.NOT_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIn(Double... requiredDouble){ + return withRequiredDouble(Operator.IN, (Object[])requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleNotIn(Double... requiredDouble){ + return withRequiredDouble(Operator.NOT_IN, (Object[])requiredDouble); + } + public ScalarTypeProbeRequest withRequiredDoubleGreaterThan(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleGreaterThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThan(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleBetween(Double startOfRequiredDouble, Double endOfRequiredDouble){ + return withRequiredDouble(Operator.BETWEEN, startOfRequiredDouble, endOfRequiredDouble); + } + + + + public ScalarTypeProbeRequest filterByOptionalDouble(Double... optionalDouble){ + if (optionalDouble == null || optionalDouble.length == 0) { + throw new IllegalArgumentException("filterByOptionalDouble parameter optionalDouble cannot be empty"); + } + return appendSearchCriteria(createOptionalDoubleCriteria(Operator.EQUAL, (Object[])optionalDouble)); + } + + public ScalarTypeProbeRequest withOptionalDouble(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsUnknown(){ + return withOptionalDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsKnown(){ + return withOptionalDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDoubleIs(Double optionalDouble){ + return withOptionalDouble(Operator.EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsNot(Double optionalDouble){ + return withOptionalDouble(Operator.NOT_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIn(Double... optionalDouble){ + return withOptionalDouble(Operator.IN, (Object[])optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleNotIn(Double... optionalDouble){ + return withOptionalDouble(Operator.NOT_IN, (Object[])optionalDouble); + } + public ScalarTypeProbeRequest withOptionalDoubleGreaterThan(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleGreaterThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThan(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleBetween(Double startOfOptionalDouble, Double endOfOptionalDouble){ + return withOptionalDouble(Operator.BETWEEN, startOfOptionalDouble, endOfOptionalDouble); + } + + + + public ScalarTypeProbeRequest filterByRequiredDate(LocalDate... requiredDate){ + if (requiredDate == null || requiredDate.length == 0) { + throw new IllegalArgumentException("filterByRequiredDate parameter requiredDate cannot be empty"); + } + return appendSearchCriteria(createRequiredDateCriteria(Operator.EQUAL, (Object[])requiredDate)); + } + + public ScalarTypeProbeRequest withRequiredDate(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDateIsUnknown(){ + return withRequiredDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDateIsKnown(){ + return withRequiredDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDateIs(LocalDate requiredDate){ + return withRequiredDate(Operator.EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIsNot(LocalDate requiredDate){ + return withRequiredDate(Operator.NOT_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.IN, (Object[])requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateNotIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.NOT_IN, (Object[])requiredDate); + } + public ScalarTypeProbeRequest withRequiredDateGreaterThan(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateGreaterThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThan(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(LocalDate startOfRequiredDate, LocalDate endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + public ScalarTypeProbeRequest withRequiredDateBefore(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBefore(Date requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(Date requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(Date startOfRequiredDate, Date endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDate(LocalDate... optionalDate){ + if (optionalDate == null || optionalDate.length == 0) { + throw new IllegalArgumentException("filterByOptionalDate parameter optionalDate cannot be empty"); + } + return appendSearchCriteria(createOptionalDateCriteria(Operator.EQUAL, (Object[])optionalDate)); + } + + public ScalarTypeProbeRequest withOptionalDate(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDateIsUnknown(){ + return withOptionalDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDateIsKnown(){ + return withOptionalDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDateIs(LocalDate optionalDate){ + return withOptionalDate(Operator.EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIsNot(LocalDate optionalDate){ + return withOptionalDate(Operator.NOT_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.IN, (Object[])optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateNotIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.NOT_IN, (Object[])optionalDate); + } + public ScalarTypeProbeRequest withOptionalDateGreaterThan(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateGreaterThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThan(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(LocalDate startOfOptionalDate, LocalDate endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + public ScalarTypeProbeRequest withOptionalDateBefore(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBefore(Date optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(Date optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(Date startOfOptionalDate, Date endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + + + + + public ScalarTypeProbeRequest filterByRequiredTime(LocalTime... requiredTime){ + if (requiredTime == null || requiredTime.length == 0) { + throw new IllegalArgumentException("filterByRequiredTime parameter requiredTime cannot be empty"); + } + return appendSearchCriteria(createRequiredTimeCriteria(Operator.EQUAL, (Object[])requiredTime)); + } + + public ScalarTypeProbeRequest withRequiredTime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredTimeIsUnknown(){ + return withRequiredTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredTimeIsKnown(){ + return withRequiredTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredTimeIs(LocalTime requiredTime){ + return withRequiredTime(Operator.EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIsNot(LocalTime requiredTime){ + return withRequiredTime(Operator.NOT_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.IN, (Object[])requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeNotIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.NOT_IN, (Object[])requiredTime); + } + public ScalarTypeProbeRequest withRequiredTimeGreaterThan(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeGreaterThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThan(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeBetween(LocalTime startOfRequiredTime, LocalTime endOfRequiredTime){ + return withRequiredTime(Operator.BETWEEN, startOfRequiredTime, endOfRequiredTime); + } + + + public ScalarTypeProbeRequest filterByOptionalTime(LocalTime... optionalTime){ + if (optionalTime == null || optionalTime.length == 0) { + throw new IllegalArgumentException("filterByOptionalTime parameter optionalTime cannot be empty"); + } + return appendSearchCriteria(createOptionalTimeCriteria(Operator.EQUAL, (Object[])optionalTime)); + } + + public ScalarTypeProbeRequest withOptionalTime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalTimeIsUnknown(){ + return withOptionalTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalTimeIsKnown(){ + return withOptionalTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalTimeIs(LocalTime optionalTime){ + return withOptionalTime(Operator.EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIsNot(LocalTime optionalTime){ + return withOptionalTime(Operator.NOT_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.IN, (Object[])optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeNotIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.NOT_IN, (Object[])optionalTime); + } + public ScalarTypeProbeRequest withOptionalTimeGreaterThan(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeGreaterThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThan(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeBetween(LocalTime startOfOptionalTime, LocalTime endOfOptionalTime){ + return withOptionalTime(Operator.BETWEEN, startOfOptionalTime, endOfOptionalTime); + } + + + public ScalarTypeProbeRequest filterByRequiredDatetime(LocalDateTime... requiredDatetime){ + if (requiredDatetime == null || requiredDatetime.length == 0) { + throw new IllegalArgumentException("filterByRequiredDatetime parameter requiredDatetime cannot be empty"); + } + return appendSearchCriteria(createRequiredDatetimeCriteria(Operator.EQUAL, (Object[])requiredDatetime)); + } + + public ScalarTypeProbeRequest withRequiredDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsUnknown(){ + return withRequiredDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsKnown(){ + return withRequiredDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIs(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsNot(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.NOT_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.IN, (Object[])requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeNotIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.NOT_IN, (Object[])requiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(LocalDateTime startOfRequiredDatetime, LocalDateTime endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeBefore(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBefore(Date requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(Date requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(Date startOfRequiredDatetime, Date endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDatetime(LocalDateTime... optionalDatetime){ + if (optionalDatetime == null || optionalDatetime.length == 0) { + throw new IllegalArgumentException("filterByOptionalDatetime parameter optionalDatetime cannot be empty"); + } + return appendSearchCriteria(createOptionalDatetimeCriteria(Operator.EQUAL, (Object[])optionalDatetime)); + } + + public ScalarTypeProbeRequest withOptionalDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsUnknown(){ + return withOptionalDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsKnown(){ + return withOptionalDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIs(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsNot(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.NOT_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.IN, (Object[])optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeNotIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.NOT_IN, (Object[])optionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(LocalDateTime startOfOptionalDatetime, LocalDateTime endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeBefore(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBefore(Date optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(Date optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(Date startOfOptionalDatetime, Date endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + + + + + public ScalarTypeProbeRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public ScalarTypeProbeRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.CREATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public ScalarTypeProbeRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public ScalarTypeProbeRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public ScalarTypeProbeRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public ScalarTypeProbeRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public ScalarTypeProbeRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.UPDATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public ScalarTypeProbeRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public ScalarTypeProbeRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.VERSION_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public ScalarTypeProbeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public ScalarTypeProbeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public ScalarTypeProbeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public ScalarTypeProbeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public ScalarTypeProbeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest minRequiredInteger(){ + return minRequiredIntegerAs(prefix("minOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredInteger(){ + return maxRequiredIntegerAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredInteger(){ + return sumRequiredIntegerAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredInteger(){ + return avgRequiredIntegerAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredInteger(){ + return standardDeviationRequiredIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredInteger(){ + return squareRootOfPopulationStandardDeviationRequiredIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredInteger(){ + return sampleVarianceRequiredIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredInteger(){ + return samplePopulationVarianceRequiredIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalInteger(){ + return minOptionalIntegerAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalInteger(){ + return maxOptionalIntegerAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalInteger(){ + return sumOptionalIntegerAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalInteger(){ + return avgOptionalIntegerAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalInteger(){ + return standardDeviationOptionalIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalInteger(){ + return squareRootOfPopulationStandardDeviationOptionalIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalInteger(){ + return sampleVarianceOptionalIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalInteger(){ + return samplePopulationVarianceOptionalIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredLong(){ + return minRequiredLongAs(prefix("minOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredLongAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredLong(){ + return maxRequiredLongAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredLongAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredLong(){ + return sumRequiredLongAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredLong(){ + return avgRequiredLongAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredLong(){ + return standardDeviationRequiredLongAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLong(){ + return squareRootOfPopulationStandardDeviationRequiredLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredLong(){ + return sampleVarianceRequiredLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLong(){ + return samplePopulationVarianceRequiredLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalLong(){ + return minOptionalLongAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalLongAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalLong(){ + return maxOptionalLongAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalLongAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalLong(){ + return sumOptionalLongAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalLong(){ + return avgOptionalLongAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalLong(){ + return standardDeviationOptionalLongAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLong(){ + return squareRootOfPopulationStandardDeviationOptionalLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalLong(){ + return sampleVarianceOptionalLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLong(){ + return samplePopulationVarianceOptionalLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDecimal(){ + return minRequiredDecimalAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDecimal(){ + return maxRequiredDecimalAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDecimal(){ + return sumRequiredDecimalAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDecimal(){ + return avgRequiredDecimalAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDecimal(){ + return standardDeviationRequiredDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimal(){ + return squareRootOfPopulationStandardDeviationRequiredDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDecimal(){ + return sampleVarianceRequiredDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimal(){ + return samplePopulationVarianceRequiredDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDecimal(){ + return minOptionalDecimalAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDecimal(){ + return maxOptionalDecimalAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDecimal(){ + return sumOptionalDecimalAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDecimal(){ + return avgOptionalDecimalAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDecimal(){ + return standardDeviationOptionalDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimal(){ + return squareRootOfPopulationStandardDeviationOptionalDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDecimal(){ + return sampleVarianceOptionalDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimal(){ + return samplePopulationVarianceOptionalDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredFloat(){ + return minRequiredFloatAs(prefix("minOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredFloat(){ + return maxRequiredFloatAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredFloat(){ + return sumRequiredFloatAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredFloat(){ + return avgRequiredFloatAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredFloat(){ + return standardDeviationRequiredFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloat(){ + return squareRootOfPopulationStandardDeviationRequiredFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredFloat(){ + return sampleVarianceRequiredFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloat(){ + return samplePopulationVarianceRequiredFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalFloat(){ + return minOptionalFloatAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalFloat(){ + return maxOptionalFloatAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalFloat(){ + return sumOptionalFloatAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalFloat(){ + return avgOptionalFloatAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalFloat(){ + return standardDeviationOptionalFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloat(){ + return squareRootOfPopulationStandardDeviationOptionalFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalFloat(){ + return sampleVarianceOptionalFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloat(){ + return samplePopulationVarianceOptionalFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDouble(){ + return minRequiredDoubleAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDouble(){ + return maxRequiredDoubleAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDouble(){ + return sumRequiredDoubleAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDouble(){ + return avgRequiredDoubleAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDouble(){ + return standardDeviationRequiredDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDouble(){ + return squareRootOfPopulationStandardDeviationRequiredDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDouble(){ + return sampleVarianceRequiredDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDouble(){ + return samplePopulationVarianceRequiredDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDouble(){ + return minOptionalDoubleAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDouble(){ + return maxOptionalDoubleAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDouble(){ + return sumOptionalDoubleAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDouble(){ + return avgOptionalDoubleAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDouble(){ + return standardDeviationOptionalDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDouble(){ + return squareRootOfPopulationStandardDeviationOptionalDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDouble(){ + return sampleVarianceOptionalDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDouble(){ + return samplePopulationVarianceOptionalDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(){ + return groupByTypePlatformWithDetails(Q.typePlatforms().unlimited()); + } + + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequest subRequest){ + aggregate(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest groupById(){ + groupBy(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdAs(String retName){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY, function); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatform(){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformAs(String retName){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredString(){ + groupBy(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalString(){ + groupBy(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByLargeText(){ + groupBy(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextAs(String retName){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBoolean(){ + groupBy(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBoolean(){ + groupBy(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredInteger(){ + groupBy(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalInteger(){ + groupBy(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLong(){ + groupBy(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLong(){ + groupBy(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimal(){ + groupBy(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimal(){ + groupBy(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloat(){ + groupBy(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloat(){ + groupBy(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDouble(){ + groupBy(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDouble(){ + groupBy(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDate(){ + groupBy(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDate(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTime(){ + groupBy(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTime(){ + groupBy(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetime(){ + groupBy(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetime(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTime(){ + groupBy(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTime(){ + groupBy(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByVersion(){ + groupBy(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionAs(String retName){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY, function); + return this; + } + + + + public ScalarTypeProbeRequest orderByIdAscending(){ + addOrderByAscending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByIdDescending(){ + addOrderByDescending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformAscending(){ + addOrderByAscending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformDescending(){ + addOrderByDescending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByRequiredStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByLargeTextAscending(){ + addOrderByAscending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByLargeTextDescending(){ + addOrderByDescending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionAscending(){ + addOrderByAscending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionDescending(){ + addOrderByDescending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest rollUpToTypePlatform(){ + TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); + this.withTypePlatformMatching(typePlatform) + .groupByTypePlatformWith(typePlatform); + return typePlatform; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform){ + return facetByTypePlatformAs(facetName, typePlatform, true); + } + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform, boolean includeAllFacets){ + addFacet(facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTypePlatformAs", facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public ScalarTypeProbeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public ScalarTypeProbeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public ScalarTypeProbeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public ScalarTypeProbeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java new file mode 100644 index 000000000..196c3bb4c --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -0,0 +1,121 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +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 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 TypePlatform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "TypePlatform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5afe0d829346ae9bcaf7f37458837cfbdcdee743f3e9fb8fab9c754126349de5"; + 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( + "scalar_type_probe_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + TypePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + + + public static final String NAME_PROPERTY = "name"; + public static final String SCALAR_TYPE_PROBE_LIST_PROPERTY = "scalar_type_probe_list"; + private String name; + + private SmartList scalarTypeProbeList; + + public String getName(){ + return this.name; + } + + public SmartList getScalarTypeProbeList(){ + return this.scalarTypeProbeList; + } + public TypePlatform updateName(String name){ + name = (name == null ? null : name.trim()); + if(Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + if (scalarTypeProbe == null){ + return this; + } + + if(null == this.scalarTypeProbeList){ + this.scalarTypeProbeList = new SmartList<>(); + } + + this.scalarTypeProbeList.add(scalarTypeProbe); + scalarTypeProbe.updateTypePlatform(this); + return this; + } + + public static TypePlatform refer(Long id){ + TypePlatform refer = new TypePlatform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public TypePlatform 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 "scalar_type_probe_list": this.scalarTypeProbeList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "scalar_type_probe_list": return this.scalarTypeProbeList; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java new file mode 100644 index 000000000..723b2d082 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -0,0 +1,49 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class TypePlatformChecker implements Checker{ + + public String type(){ + return TypePlatform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, typePlatform)){ + markAsChecked(_context, typePlatform); + doCheck(_context, typePlatform, _parentLocation); + } + } + + public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if((typePlatform == null)){ + return; + } + if(typePlatform.newItem()){ + }else if(typePlatform.updateItem()){ + if(!typePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, typePlatform.getProperty(TypePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; typePlatform.getScalarTypeProbeList() != null && i < typePlatform.getScalarTypeProbeList().size(); i++){ + ScalarTypeProbe scalarTypeProbe = typePlatform.getScalarTypeProbeList().get(i); + new ScalarTypeProbeChecker().checkAndFix(_context, scalarTypeProbe, newLocation(_parentLocation, "scalar_type_probe_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java new file mode 100644 index 000000000..01a63a43c --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeListExpression; +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 TypePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public TypePlatformExpression(Expression expression){ + super(expression); + } + + public TypePlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public TypePlatformExpression updateId(Long id){ + return new TypePlatformExpression(this, $it -> {((TypePlatform)$it).__internalSet("id", id); return this;}); + } + + public TypePlatformExpression save(UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public TypePlatformExpression save(String intent, UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", TypePlatform::getName); + } + public TypePlatformExpression updateName(String name){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).updateName(name)); + } + + public ScalarTypeProbeListExpression getScalarTypeProbeList(){ + return new ScalarTypeProbeListExpression(loaded("scalar_type_probe_list", "getScalarTypeProbeList", TypePlatform::getScalarTypeProbeList)); + } + public TypePlatformExpression addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).addScalarTypeProbe(scalarTypeProbe)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java new file mode 100644 index 000000000..3974c0610 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class TypePlatformListExpression extends SmartListExpression { + public TypePlatformListExpression(Expression> expression){ + super(expression); + } + + public TypePlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public TypePlatformExpression first() { + return new TypePlatformExpression(super.first()); + } + + public TypePlatformExpression get(int index) { + return new TypePlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java new file mode 100644 index 000000000..0ac2f1d18 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -0,0 +1,2099 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest; +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 TypePlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public TypePlatformRequest(Class returnType){ + this(returnType, () -> (T) new TypePlatform()); + } + + protected TypePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public TypePlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public TypePlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public TypePlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public TypePlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public TypePlatformRequest 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 TypePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public TypePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public TypePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public TypePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (TypePlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public TypePlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ + super.internalMatchAny(typePlatform); + return this; + } + + public TypePlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public TypePlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public TypePlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public TypePlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public TypePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(TypePlatform.ID_PROPERTY); + selectProperty(TypePlatform.NAME_PROPERTY); + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectChildren(){ + super.selectAny(); + selectScalarTypeProbeList(); + return selectId().selectName().selectVersion(); + } + + + public TypePlatformRequest selectId(){ + selectProperty(TypePlatform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectId(){ + unselectProperty(TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest selectName(){ + selectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectName(){ + unselectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest selectVersion(){ + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectVersion(){ + unselectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + public TypePlatformRequest selectScalarTypeProbeList(){ + return selectScalarTypeProbeListWith(Q.scalarTypeProbes().selectSelf()); + } + + public TypePlatformRequest selectScalarTypeProbeListWith(ScalarTypeProbeRequest scalarTypeProbeList){ + enhanceRelation(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, scalarTypeProbeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectScalarTypeProbeListWith", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.ID_PROPERTY, operator, values); + } + + public TypePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public TypePlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public TypePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public TypePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public TypePlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public TypePlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.NAME_PROPERTY, operator, values); + } + + public TypePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public TypePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public TypePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public TypePlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public TypePlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public TypePlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public TypePlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public TypePlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public TypePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public TypePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public TypePlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public TypePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public TypePlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public TypePlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public TypePlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public TypePlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.VERSION_PROPERTY, operator, values); + } + + public TypePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public TypePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public TypePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public TypePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public TypePlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public TypePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public TypePlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public TypePlatformRequest withScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + } + + public TypePlatformRequest withoutScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY))); + } + + public TypePlatformRequest haveScalarTypeProbes(){ + return withScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest haveNoScalarTypeProbes(){ + return withoutScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public TypePlatformRequest 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 TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ + aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); + return this; + } + + public TypePlatformRequest groupById(){ + groupBy(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdAs(String retName){ + groupBy(retName, TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.ID_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByName(){ + groupBy(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameAs(String retName){ + groupBy(retName, TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.NAME_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByVersion(){ + groupBy(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionAs(String retName){ + groupBy(retName, TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.VERSION_PROPERTY, function); + return this; + } + + + + public TypePlatformRequest orderByIdAscending(){ + addOrderByAscending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByIdDescending(){ + addOrderByDescending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameAscending(){ + addOrderByAscending(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescending(){ + addOrderByDescending(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByVersionAscending(){ + addOrderByAscending(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest orderByVersionDescending(){ + addOrderByDescending(TypePlatform.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(name, subRequest, false); + } + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest statsFromScalarTypeProbes(ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(REFINEMENTS, subRequest); + } + public TypePlatformRequest countScalarTypeProbes(){ + addRelationCount("Count", Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesAs(String name){ + addRelationCount(name, Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesWith(String name, ScalarTypeProbeRequest subRequest){ + addRelationCount(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesWith", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name){ + return minRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name){ + return maxRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name){ + return sumRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name){ + return avgRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name){ + return minOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name){ + return maxOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name){ + return sumOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name){ + return avgOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name){ + return minRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name){ + return maxRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name){ + return sumRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name){ + return avgRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name){ + return minOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name){ + return maxOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name){ + return sumOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name){ + return avgOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name){ + return minRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name){ + return maxRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name){ + return sumRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name){ + return avgRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name){ + return minOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name){ + return maxOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name){ + return sumOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name){ + return avgOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name){ + return minRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name){ + return maxRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name){ + return sumRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name){ + return avgRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name){ + return minOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name){ + return maxOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name){ + return sumOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name){ + return avgOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name){ + return minRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name){ + return maxRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name){ + return sumRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name){ + return avgRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name){ + return minOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name){ + return maxOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name){ + return sumOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name){ + return avgOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public TypePlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public TypePlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public TypePlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public TypePlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public TypePlatformRequest 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 TypePlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/scalar-type-probe/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..d97c5af41 --- /dev/null +++ b/examples/scalar-type-probe/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.scalartypeconformanceservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml b/examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml new file mode 100644 index 000000000..6f3d904d8 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + scalar-type-conformance-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 1.555-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.555-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/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java new file mode 100644 index 000000000..5ba171d6c --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; + +public interface Constants { + public static final long TYPE_PLATFORM_ID = 1l; + public static final TypePlatform TYPE_PLATFORM = TypePlatform.refer(TYPE_PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java new file mode 100644 index 000000000..c2fa3f548 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java @@ -0,0 +1,18 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeExpression; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static TypePlatformExpression typePlatform(TypePlatform typePlatform){ + return new TypePlatformExpression(new ValueExpression(typePlatform, JsonFieldNamingProfile.fromModelValue("PascalCase"), "E.typePlatform()")); + } + public static ScalarTypeProbeExpression scalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new ScalarTypeProbeExpression(new ValueExpression(scalarTypeProbe, JsonFieldNamingProfile.fromModelValue("PascalCase"), "E.scalarTypeProbe()")); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java new file mode 100644 index 000000000..59b3f02e9 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -0,0 +1,617 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerTypePlatform(); + registerScalarTypeProbe(); + } + private void registerTypePlatform() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); + entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } + private void registerScalarTypeProbe() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); + entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY, Long.class) + ; + PropertyDescriptor typePlatform = + entityDescriptor.addObjectProperty($factory, com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class) + ; + PropertyDescriptor requiredString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY, String.class) + ; + PropertyDescriptor optionalString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, String.class) + ; + PropertyDescriptor largeText = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY, String.class) + ; + PropertyDescriptor requiredBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor optionalBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor requiredInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor optionalInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor requiredLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor optionalLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor requiredDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor optionalDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor requiredFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor optionalFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor requiredDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor optionalDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor requiredDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor optionalDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor requiredTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor optionalTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor requiredDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor optionalDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") + .with("isTime", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..ff8c5ba2a --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -0,0 +1,36 @@ +package com.example.scalartypeconformanceservice; + +/** 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.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .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("TypePlatform", 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("ScalarTypeProbe", java.util.Map.ofEntries(java.util.Map.entry("id", "Id"), java.util.Map.entry("type_platform", "TypePlatform"), java.util.Map.entry("required_string", "RequiredString"), java.util.Map.entry("optional_string", "OptionalString"), java.util.Map.entry("large_text", "LargeText"), java.util.Map.entry("required_boolean", "RequiredBoolean"), java.util.Map.entry("optional_boolean", "OptionalBoolean"), java.util.Map.entry("required_integer", "RequiredInteger"), java.util.Map.entry("optional_integer", "OptionalInteger"), java.util.Map.entry("required_long", "RequiredLong"), java.util.Map.entry("optional_long", "OptionalLong"), java.util.Map.entry("required_decimal", "RequiredDecimal"), java.util.Map.entry("optional_decimal", "OptionalDecimal"), java.util.Map.entry("required_float", "RequiredFloat"), java.util.Map.entry("optional_float", "OptionalFloat"), java.util.Map.entry("required_double", "RequiredDouble"), java.util.Map.entry("optional_double", "OptionalDouble"), java.util.Map.entry("required_date", "RequiredDate"), java.util.Map.entry("optional_date", "OptionalDate"), java.util.Map.entry("required_time", "RequiredTime"), java.util.Map.entry("optional_time", "OptionalTime"), java.util.Map.entry("required_datetime", "RequiredDatetime"), java.util.Map.entry("optional_datetime", "OptionalDatetime"), java.util.Map.entry("create_time", "CreateTime"), java.util.Map.entry("update_time", "UpdateTime"), java.util.Map.entry("version", "Version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.typePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.scalartypeconformanceservice.typeplatform.TypePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.scalartypeconformanceservice.typeplatform.TypePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Scalar Type Conformance"); + domainRoot.auditAs("create generated Domain Root TypePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("TypePlatform", domainRoot.getId())); + } +} diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java new file mode 100644 index 000000000..9b6fc69cd --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatforms(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatformsWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbes(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbesWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java new file mode 100644 index 000000000..45450dfc0 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.UserContext; +public interface ScalarTypeConformanceServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java new file mode 100644 index 000000000..5e2c4c336 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -0,0 +1,544 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class ScalarTypeProbe extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "ScalarTypeProbe"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8d1d53171c01628f604255bcfa7e7d52b6260332cee701781027b0233eae926b"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("type_platform", 1), java.util.Map.entry("required_string", 2), java.util.Map.entry("optional_string", 3), java.util.Map.entry("large_text", 4), java.util.Map.entry("required_boolean", 5), java.util.Map.entry("optional_boolean", 6), java.util.Map.entry("required_integer", 7), java.util.Map.entry("optional_integer", 8), java.util.Map.entry("required_long", 9), java.util.Map.entry("optional_long", 10), java.util.Map.entry("required_decimal", 11), java.util.Map.entry("optional_decimal", 12), java.util.Map.entry("required_float", 13), java.util.Map.entry("optional_float", 14), java.util.Map.entry("required_double", 15), java.util.Map.entry("optional_double", 16), java.util.Map.entry("required_date", 17), java.util.Map.entry("optional_date", 18), java.util.Map.entry("required_time", 19), java.util.Map.entry("optional_time", 20), java.util.Map.entry("required_datetime", 21), java.util.Map.entry("optional_datetime", 22), java.util.Map.entry("create_time", 23), java.util.Map.entry("update_time", 24), java.util.Map.entry("version", 25)); + 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("type_platform", java.util.List.of("typePlatform", "type_platform")), java.util.Map.entry("required_string", java.util.List.of("requiredString", "required_string")), java.util.Map.entry("optional_string", java.util.List.of("optionalString", "optional_string")), java.util.Map.entry("large_text", java.util.List.of("largeText", "large_text")), java.util.Map.entry("required_boolean", java.util.List.of("requiredBoolean", "required_boolean")), java.util.Map.entry("optional_boolean", java.util.List.of("optionalBoolean", "optional_boolean")), java.util.Map.entry("required_integer", java.util.List.of("requiredInteger", "required_integer")), java.util.Map.entry("optional_integer", java.util.List.of("optionalInteger", "optional_integer")), java.util.Map.entry("required_long", java.util.List.of("requiredLong", "required_long")), java.util.Map.entry("optional_long", java.util.List.of("optionalLong", "optional_long")), java.util.Map.entry("required_decimal", java.util.List.of("requiredDecimal", "required_decimal")), java.util.Map.entry("optional_decimal", java.util.List.of("optionalDecimal", "optional_decimal")), java.util.Map.entry("required_float", java.util.List.of("requiredFloat", "required_float")), java.util.Map.entry("optional_float", java.util.List.of("optionalFloat", "optional_float")), java.util.Map.entry("required_double", java.util.List.of("requiredDouble", "required_double")), java.util.Map.entry("optional_double", java.util.List.of("optionalDouble", "optional_double")), java.util.Map.entry("required_date", java.util.List.of("requiredDate", "required_date")), java.util.Map.entry("optional_date", java.util.List.of("optionalDate", "optional_date")), java.util.Map.entry("required_time", java.util.List.of("requiredTime", "required_time")), java.util.Map.entry("optional_time", java.util.List.of("optionalTime", "optional_time")), java.util.Map.entry("required_datetime", java.util.List.of("requiredDatetime", "required_datetime")), java.util.Map.entry("optional_datetime", java.util.List.of("optionalDatetime", "optional_datetime")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + ScalarTypeProbe.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("PascalCase"))); + + + public static final String TYPE_PLATFORM_PROPERTY = "type_platform"; + public static final String REQUIRED_STRING_PROPERTY = "required_string"; + public static final String OPTIONAL_STRING_PROPERTY = "optional_string"; + public static final String LARGE_TEXT_PROPERTY = "large_text"; + public static final String REQUIRED_BOOLEAN_PROPERTY = "required_boolean"; + public static final String OPTIONAL_BOOLEAN_PROPERTY = "optional_boolean"; + public static final String REQUIRED_INTEGER_PROPERTY = "required_integer"; + public static final String OPTIONAL_INTEGER_PROPERTY = "optional_integer"; + public static final String REQUIRED_LONG_PROPERTY = "required_long"; + public static final String OPTIONAL_LONG_PROPERTY = "optional_long"; + public static final String REQUIRED_DECIMAL_PROPERTY = "required_decimal"; + public static final String OPTIONAL_DECIMAL_PROPERTY = "optional_decimal"; + public static final String REQUIRED_FLOAT_PROPERTY = "required_float"; + public static final String OPTIONAL_FLOAT_PROPERTY = "optional_float"; + public static final String REQUIRED_DOUBLE_PROPERTY = "required_double"; + public static final String OPTIONAL_DOUBLE_PROPERTY = "optional_double"; + public static final String REQUIRED_DATE_PROPERTY = "required_date"; + public static final String OPTIONAL_DATE_PROPERTY = "optional_date"; + public static final String REQUIRED_TIME_PROPERTY = "required_time"; + public static final String OPTIONAL_TIME_PROPERTY = "optional_time"; + public static final String REQUIRED_DATETIME_PROPERTY = "required_datetime"; + public static final String OPTIONAL_DATETIME_PROPERTY = "optional_datetime"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private TypePlatform typePlatform; + + private String requiredString; + + private String optionalString; + + private String largeText; + + private Boolean requiredBoolean; + + private Boolean optionalBoolean; + + private Integer requiredInteger; + + private Integer optionalInteger; + + private Long requiredLong; + + private Long optionalLong; + + private BigDecimal requiredDecimal; + + private BigDecimal optionalDecimal; + + private Float requiredFloat; + + private Float optionalFloat; + + private Double requiredDouble; + + private Double optionalDouble; + + private LocalDate requiredDate; + + private LocalDate optionalDate; + + private LocalTime requiredTime; + + private LocalTime optionalTime; + + private LocalDateTime requiredDatetime; + + private LocalDateTime optionalDatetime; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public TypePlatform getTypePlatform(){ + return this.typePlatform; + } + + public String getRequiredString(){ + return this.requiredString; + } + + public String getOptionalString(){ + return this.optionalString; + } + + public String getLargeText(){ + return this.largeText; + } + + public Boolean isRequiredBoolean(){ + return this.requiredBoolean; + } + + public Boolean isOptionalBoolean(){ + return this.optionalBoolean; + } + + public Integer getRequiredInteger(){ + return this.requiredInteger; + } + + public Integer getOptionalInteger(){ + return this.optionalInteger; + } + + public Long getRequiredLong(){ + return this.requiredLong; + } + + public Long getOptionalLong(){ + return this.optionalLong; + } + + public BigDecimal getRequiredDecimal(){ + return this.requiredDecimal; + } + + public BigDecimal getOptionalDecimal(){ + return this.optionalDecimal; + } + + public Float getRequiredFloat(){ + return this.requiredFloat; + } + + public Float getOptionalFloat(){ + return this.optionalFloat; + } + + public Double getRequiredDouble(){ + return this.requiredDouble; + } + + public Double getOptionalDouble(){ + return this.optionalDouble; + } + + public LocalDate getRequiredDate(){ + return this.requiredDate; + } + + public LocalDate getOptionalDate(){ + return this.optionalDate; + } + + public LocalTime getRequiredTime(){ + return this.requiredTime; + } + + public LocalTime getOptionalTime(){ + return this.optionalTime; + } + + public LocalDateTime getRequiredDatetime(){ + return this.requiredDatetime; + } + + public LocalDateTime getOptionalDatetime(){ + return this.optionalDatetime; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public ScalarTypeProbe updateTypePlatform(TypePlatform typePlatform){ + if(isPropertyLoaded(TYPE_PLATFORM_PROPERTY) && Objects.equals(this.typePlatform, typePlatform)){ + return this; + } + handleUpdate(TYPE_PLATFORM_PROPERTY, getTypePlatform(), typePlatform); + this.typePlatform = typePlatform; + return this; + } + + public ScalarTypeProbe updateRequiredString(String requiredString){ + requiredString = (requiredString == null ? null : requiredString.trim()); + if(isPropertyLoaded(REQUIRED_STRING_PROPERTY) && Objects.equals(this.requiredString, requiredString)){ + return this; + } + handleUpdate(REQUIRED_STRING_PROPERTY, getRequiredString(), requiredString); + this.requiredString = requiredString; + return this; + } + + public ScalarTypeProbe updateOptionalString(String optionalString){ + optionalString = (optionalString == null ? null : optionalString.trim()); + if(isPropertyLoaded(OPTIONAL_STRING_PROPERTY) && Objects.equals(this.optionalString, optionalString)){ + return this; + } + handleUpdate(OPTIONAL_STRING_PROPERTY, getOptionalString(), optionalString); + this.optionalString = optionalString; + return this; + } + + public ScalarTypeProbe updateLargeText(String largeText){ + if(isPropertyLoaded(LARGE_TEXT_PROPERTY) && Objects.equals(this.largeText, largeText)){ + return this; + } + handleUpdate(LARGE_TEXT_PROPERTY, getLargeText(), largeText); + this.largeText = largeText; + return this; + } + + public ScalarTypeProbe updateRequiredBoolean(Boolean requiredBoolean){ + if(isPropertyLoaded(REQUIRED_BOOLEAN_PROPERTY) && Objects.equals(this.requiredBoolean, requiredBoolean)){ + return this; + } + handleUpdate(REQUIRED_BOOLEAN_PROPERTY, isRequiredBoolean(), requiredBoolean); + this.requiredBoolean = requiredBoolean; + return this; + } + + public ScalarTypeProbe updateOptionalBoolean(Boolean optionalBoolean){ + if(isPropertyLoaded(OPTIONAL_BOOLEAN_PROPERTY) && Objects.equals(this.optionalBoolean, optionalBoolean)){ + return this; + } + handleUpdate(OPTIONAL_BOOLEAN_PROPERTY, isOptionalBoolean(), optionalBoolean); + this.optionalBoolean = optionalBoolean; + return this; + } + + public ScalarTypeProbe updateRequiredInteger(Integer requiredInteger){ + if(isPropertyLoaded(REQUIRED_INTEGER_PROPERTY) && Objects.equals(this.requiredInteger, requiredInteger)){ + return this; + } + handleUpdate(REQUIRED_INTEGER_PROPERTY, getRequiredInteger(), requiredInteger); + this.requiredInteger = requiredInteger; + return this; + } + + public ScalarTypeProbe updateOptionalInteger(Integer optionalInteger){ + if(isPropertyLoaded(OPTIONAL_INTEGER_PROPERTY) && Objects.equals(this.optionalInteger, optionalInteger)){ + return this; + } + handleUpdate(OPTIONAL_INTEGER_PROPERTY, getOptionalInteger(), optionalInteger); + this.optionalInteger = optionalInteger; + return this; + } + + public ScalarTypeProbe updateRequiredLong(Long requiredLong){ + if(isPropertyLoaded(REQUIRED_LONG_PROPERTY) && Objects.equals(this.requiredLong, requiredLong)){ + return this; + } + handleUpdate(REQUIRED_LONG_PROPERTY, getRequiredLong(), requiredLong); + this.requiredLong = requiredLong; + return this; + } + + public ScalarTypeProbe updateOptionalLong(Long optionalLong){ + if(isPropertyLoaded(OPTIONAL_LONG_PROPERTY) && Objects.equals(this.optionalLong, optionalLong)){ + return this; + } + handleUpdate(OPTIONAL_LONG_PROPERTY, getOptionalLong(), optionalLong); + this.optionalLong = optionalLong; + return this; + } + + public ScalarTypeProbe updateRequiredDecimal(BigDecimal requiredDecimal){ + if(isPropertyLoaded(REQUIRED_DECIMAL_PROPERTY) && Objects.equals(this.requiredDecimal, requiredDecimal)){ + return this; + } + handleUpdate(REQUIRED_DECIMAL_PROPERTY, getRequiredDecimal(), requiredDecimal); + this.requiredDecimal = requiredDecimal; + return this; + } + + public ScalarTypeProbe updateOptionalDecimal(BigDecimal optionalDecimal){ + if(isPropertyLoaded(OPTIONAL_DECIMAL_PROPERTY) && Objects.equals(this.optionalDecimal, optionalDecimal)){ + return this; + } + handleUpdate(OPTIONAL_DECIMAL_PROPERTY, getOptionalDecimal(), optionalDecimal); + this.optionalDecimal = optionalDecimal; + return this; + } + + public ScalarTypeProbe updateRequiredFloat(Float requiredFloat){ + if(isPropertyLoaded(REQUIRED_FLOAT_PROPERTY) && Objects.equals(this.requiredFloat, requiredFloat)){ + return this; + } + handleUpdate(REQUIRED_FLOAT_PROPERTY, getRequiredFloat(), requiredFloat); + this.requiredFloat = requiredFloat; + return this; + } + + public ScalarTypeProbe updateOptionalFloat(Float optionalFloat){ + if(isPropertyLoaded(OPTIONAL_FLOAT_PROPERTY) && Objects.equals(this.optionalFloat, optionalFloat)){ + return this; + } + handleUpdate(OPTIONAL_FLOAT_PROPERTY, getOptionalFloat(), optionalFloat); + this.optionalFloat = optionalFloat; + return this; + } + + public ScalarTypeProbe updateRequiredDouble(Double requiredDouble){ + if(isPropertyLoaded(REQUIRED_DOUBLE_PROPERTY) && Objects.equals(this.requiredDouble, requiredDouble)){ + return this; + } + handleUpdate(REQUIRED_DOUBLE_PROPERTY, getRequiredDouble(), requiredDouble); + this.requiredDouble = requiredDouble; + return this; + } + + public ScalarTypeProbe updateOptionalDouble(Double optionalDouble){ + if(isPropertyLoaded(OPTIONAL_DOUBLE_PROPERTY) && Objects.equals(this.optionalDouble, optionalDouble)){ + return this; + } + handleUpdate(OPTIONAL_DOUBLE_PROPERTY, getOptionalDouble(), optionalDouble); + this.optionalDouble = optionalDouble; + return this; + } + + public ScalarTypeProbe updateRequiredDate(LocalDate requiredDate){ + if(isPropertyLoaded(REQUIRED_DATE_PROPERTY) && Objects.equals(this.requiredDate, requiredDate)){ + return this; + } + handleUpdate(REQUIRED_DATE_PROPERTY, getRequiredDate(), requiredDate); + this.requiredDate = requiredDate; + return this; + } + + public ScalarTypeProbe updateOptionalDate(LocalDate optionalDate){ + if(isPropertyLoaded(OPTIONAL_DATE_PROPERTY) && Objects.equals(this.optionalDate, optionalDate)){ + return this; + } + handleUpdate(OPTIONAL_DATE_PROPERTY, getOptionalDate(), optionalDate); + this.optionalDate = optionalDate; + return this; + } + + public ScalarTypeProbe updateRequiredTime(LocalTime requiredTime){ + if(isPropertyLoaded(REQUIRED_TIME_PROPERTY) && Objects.equals(this.requiredTime, requiredTime)){ + return this; + } + handleUpdate(REQUIRED_TIME_PROPERTY, getRequiredTime(), requiredTime); + this.requiredTime = requiredTime; + return this; + } + + public ScalarTypeProbe updateOptionalTime(LocalTime optionalTime){ + if(isPropertyLoaded(OPTIONAL_TIME_PROPERTY) && Objects.equals(this.optionalTime, optionalTime)){ + return this; + } + handleUpdate(OPTIONAL_TIME_PROPERTY, getOptionalTime(), optionalTime); + this.optionalTime = optionalTime; + return this; + } + + public ScalarTypeProbe updateRequiredDatetime(LocalDateTime requiredDatetime){ + if(isPropertyLoaded(REQUIRED_DATETIME_PROPERTY) && Objects.equals(this.requiredDatetime, requiredDatetime)){ + return this; + } + handleUpdate(REQUIRED_DATETIME_PROPERTY, getRequiredDatetime(), requiredDatetime); + this.requiredDatetime = requiredDatetime; + return this; + } + + public ScalarTypeProbe updateOptionalDatetime(LocalDateTime optionalDatetime){ + if(isPropertyLoaded(OPTIONAL_DATETIME_PROPERTY) && Objects.equals(this.optionalDatetime, optionalDatetime)){ + return this; + } + handleUpdate(OPTIONAL_DATETIME_PROPERTY, getOptionalDatetime(), optionalDatetime); + this.optionalDatetime = optionalDatetime; + return this; + } + + public ScalarTypeProbe updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public ScalarTypeProbe updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static ScalarTypeProbe refer(Long id){ + ScalarTypeProbe refer = new ScalarTypeProbe(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public ScalarTypeProbe 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 "type_platform": this.typePlatform = (TypePlatform) value; break; + + case "required_string": this.requiredString = (value == null ? null : ((String)value).trim()); break; + + case "optional_string": this.optionalString = (value == null ? null : ((String)value).trim()); break; + + case "large_text": this.largeText = (String) value; break; + + case "required_boolean": this.requiredBoolean = (Boolean) value; break; + + case "optional_boolean": this.optionalBoolean = (Boolean) value; break; + + case "required_integer": this.requiredInteger = (Integer) value; break; + + case "optional_integer": this.optionalInteger = (Integer) value; break; + + case "required_long": this.requiredLong = (Long) value; break; + + case "optional_long": this.optionalLong = (Long) value; break; + + case "required_decimal": this.requiredDecimal = (BigDecimal) value; break; + + case "optional_decimal": this.optionalDecimal = (BigDecimal) value; break; + + case "required_float": this.requiredFloat = (Float) value; break; + + case "optional_float": this.optionalFloat = (Float) value; break; + + case "required_double": this.requiredDouble = (Double) value; break; + + case "optional_double": this.optionalDouble = (Double) value; break; + + case "required_date": this.requiredDate = (LocalDate) value; break; + + case "optional_date": this.optionalDate = (LocalDate) value; break; + + case "required_time": this.requiredTime = (LocalTime) value; break; + + case "optional_time": this.optionalTime = (LocalTime) value; break; + + case "required_datetime": this.requiredDatetime = (LocalDateTime) value; break; + + case "optional_datetime": this.optionalDatetime = (LocalDateTime) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "type_platform": return this.typePlatform; + case "required_string": return this.requiredString; + case "optional_string": return this.optionalString; + case "large_text": return this.largeText; + case "required_boolean": return this.requiredBoolean; + case "optional_boolean": return this.optionalBoolean; + case "required_integer": return this.requiredInteger; + case "optional_integer": return this.optionalInteger; + case "required_long": return this.requiredLong; + case "optional_long": return this.optionalLong; + case "required_decimal": return this.requiredDecimal; + case "optional_decimal": return this.optionalDecimal; + case "required_float": return this.requiredFloat; + case "optional_float": return this.optionalFloat; + case "required_double": return this.requiredDouble; + case "optional_double": return this.optionalDouble; + case "required_date": return this.requiredDate; + case "optional_date": return this.optionalDate; + case "required_time": return this.requiredTime; + case "optional_time": return this.optionalTime; + case "required_datetime": return this.requiredDatetime; + case "optional_datetime": return this.optionalDatetime; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java new file mode 100644 index 000000000..3ad70ad88 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -0,0 +1,282 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class ScalarTypeProbeChecker implements Checker{ + + public String type(){ + return ScalarTypeProbe.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if(needCheck(_context, scalarTypeProbe)){ + markAsChecked(_context, scalarTypeProbe); + doCheck(_context, scalarTypeProbe, _parentLocation); + } + } + + public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if((scalarTypeProbe == null)){ + return; + } + if(scalarTypeProbe.needPersist()){ + } + if(scalarTypeProbe.newItem()){ + if(scalarTypeProbe.getCreateTime() == null){ + scalarTypeProbe.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + }if(scalarTypeProbe.getUpdateTime() == null){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + } + }else if(scalarTypeProbe.updateItem()){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("large_text")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "large_text"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkTypePlatform(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY), newLocation(_parentLocation, "type_platform")); + checkRequiredString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY), newLocation(_parentLocation, "required_string")); + checkOptionalString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY), newLocation(_parentLocation, "optional_string")); + checkLargeText(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY), newLocation(_parentLocation, "large_text")); + checkRequiredBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY), newLocation(_parentLocation, "required_boolean")); + checkOptionalBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY), newLocation(_parentLocation, "optional_boolean")); + checkRequiredInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY), newLocation(_parentLocation, "required_integer")); + checkOptionalInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY), newLocation(_parentLocation, "optional_integer")); + checkRequiredLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY), newLocation(_parentLocation, "required_long")); + checkOptionalLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY), newLocation(_parentLocation, "optional_long")); + checkRequiredDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY), newLocation(_parentLocation, "required_decimal")); + checkOptionalDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY), newLocation(_parentLocation, "optional_decimal")); + checkRequiredFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY), newLocation(_parentLocation, "required_float")); + checkOptionalFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY), newLocation(_parentLocation, "optional_float")); + checkRequiredDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY), newLocation(_parentLocation, "required_double")); + checkOptionalDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY), newLocation(_parentLocation, "optional_double")); + checkRequiredDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY), newLocation(_parentLocation, "required_date")); + checkOptionalDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY), newLocation(_parentLocation, "optional_date")); + checkRequiredTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY), newLocation(_parentLocation, "required_time")); + checkOptionalTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY), newLocation(_parentLocation, "optional_time")); + checkRequiredDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY), newLocation(_parentLocation, "required_datetime")); + checkOptionalDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY), newLocation(_parentLocation, "optional_datetime")); + checkCreateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkTypePlatform(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, typePlatform); + if((typePlatform == null)){ + return; + } + new TypePlatformChecker().checkAndFix(_context, typePlatform, _parentLocation); + } + public void checkRequiredString(UserContext _context, String requiredString, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredString); + if((requiredString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, requiredString); + + } + public void checkOptionalString(UserContext _context, String optionalString, ObjectLocation _parentLocation){ + if((optionalString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, optionalString); + + } + public void checkLargeText(UserContext _context, String largeText, ObjectLocation _parentLocation){ + if((largeText == null)){ + return; + } + } + public void checkRequiredBoolean(UserContext _context, Boolean requiredBoolean, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredBoolean); + if((requiredBoolean == null)){ + return; + } + } + public void checkOptionalBoolean(UserContext _context, Boolean optionalBoolean, ObjectLocation _parentLocation){ + if((optionalBoolean == null)){ + return; + } + } + public void checkRequiredInteger(UserContext _context, Integer requiredInteger, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredInteger); + if((requiredInteger == null)){ + return; + } + } + public void checkOptionalInteger(UserContext _context, Integer optionalInteger, ObjectLocation _parentLocation){ + if((optionalInteger == null)){ + return; + } + } + public void checkRequiredLong(UserContext _context, Long requiredLong, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredLong); + if((requiredLong == null)){ + return; + } + } + public void checkOptionalLong(UserContext _context, Long optionalLong, ObjectLocation _parentLocation){ + if((optionalLong == null)){ + return; + } + } + public void checkRequiredDecimal(UserContext _context, BigDecimal requiredDecimal, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDecimal); + if((requiredDecimal == null)){ + return; + } + } + public void checkOptionalDecimal(UserContext _context, BigDecimal optionalDecimal, ObjectLocation _parentLocation){ + if((optionalDecimal == null)){ + return; + } + } + public void checkRequiredFloat(UserContext _context, Float requiredFloat, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredFloat); + if((requiredFloat == null)){ + return; + } + } + public void checkOptionalFloat(UserContext _context, Float optionalFloat, ObjectLocation _parentLocation){ + if((optionalFloat == null)){ + return; + } + } + public void checkRequiredDouble(UserContext _context, Double requiredDouble, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDouble); + if((requiredDouble == null)){ + return; + } + } + public void checkOptionalDouble(UserContext _context, Double optionalDouble, ObjectLocation _parentLocation){ + if((optionalDouble == null)){ + return; + } + } + public void checkRequiredDate(UserContext _context, LocalDate requiredDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDate); + if((requiredDate == null)){ + return; + } + } + public void checkOptionalDate(UserContext _context, LocalDate optionalDate, ObjectLocation _parentLocation){ + if((optionalDate == null)){ + return; + } + } + public void checkRequiredTime(UserContext _context, LocalTime requiredTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredTime); + if((requiredTime == null)){ + return; + } + } + public void checkOptionalTime(UserContext _context, LocalTime optionalTime, ObjectLocation _parentLocation){ + if((optionalTime == null)){ + return; + } + } + public void checkRequiredDatetime(UserContext _context, LocalDateTime requiredDatetime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDatetime); + if((requiredDatetime == null)){ + return; + } + } + public void checkOptionalDatetime(UserContext _context, LocalDateTime optionalDatetime, ObjectLocation _parentLocation){ + if((optionalDatetime == null)){ + return; + } + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java new file mode 100644 index 000000000..4ff37872d --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java @@ -0,0 +1,211 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.function.Function; + +public class ScalarTypeProbeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public ScalarTypeProbeExpression(Expression expression){ + super(expression); + } + + public ScalarTypeProbeExpression(Expression expression, Function function){ + super(expression, function); + } + + public ScalarTypeProbeExpression updateId(Long id){ + return new ScalarTypeProbeExpression(this, $it -> {((ScalarTypeProbe)$it).__internalSet("id", id); return this;}); + } + + public ScalarTypeProbeExpression save(UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs("Saved by Expression").save(userContext)); + } + + public ScalarTypeProbeExpression save(String intent, UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public TypePlatformExpression getTypePlatform(){ + return new TypePlatformExpression(loaded("type_platform", "getTypePlatform", ScalarTypeProbe::getTypePlatform)); + } + + public ScalarTypeProbeExpression updateTypePlatform(TypePlatform typePlatform){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateTypePlatform(typePlatform)); + } + + public Expression getRequiredString(){ + return loaded("required_string", "getRequiredString", ScalarTypeProbe::getRequiredString); + } + public ScalarTypeProbeExpression updateRequiredString(String requiredString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredString(requiredString)); + } + + public Expression getOptionalString(){ + return loaded("optional_string", "getOptionalString", ScalarTypeProbe::getOptionalString); + } + public ScalarTypeProbeExpression updateOptionalString(String optionalString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalString(optionalString)); + } + + public Expression getLargeText(){ + return loaded("large_text", "getLargeText", ScalarTypeProbe::getLargeText); + } + public ScalarTypeProbeExpression updateLargeText(String largeText){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateLargeText(largeText)); + } + + public Expression isRequiredBoolean(){ + return loaded("required_boolean", "isRequiredBoolean", ScalarTypeProbe::isRequiredBoolean); + } + public ScalarTypeProbeExpression updateRequiredBoolean(Boolean requiredBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredBoolean(requiredBoolean)); + } + + public Expression isOptionalBoolean(){ + return loaded("optional_boolean", "isOptionalBoolean", ScalarTypeProbe::isOptionalBoolean); + } + public ScalarTypeProbeExpression updateOptionalBoolean(Boolean optionalBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalBoolean(optionalBoolean)); + } + + public Expression getRequiredInteger(){ + return loaded("required_integer", "getRequiredInteger", ScalarTypeProbe::getRequiredInteger); + } + public ScalarTypeProbeExpression updateRequiredInteger(Integer requiredInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredInteger(requiredInteger)); + } + + public Expression getOptionalInteger(){ + return loaded("optional_integer", "getOptionalInteger", ScalarTypeProbe::getOptionalInteger); + } + public ScalarTypeProbeExpression updateOptionalInteger(Integer optionalInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalInteger(optionalInteger)); + } + + public Expression getRequiredLong(){ + return loaded("required_long", "getRequiredLong", ScalarTypeProbe::getRequiredLong); + } + public ScalarTypeProbeExpression updateRequiredLong(Long requiredLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredLong(requiredLong)); + } + + public Expression getOptionalLong(){ + return loaded("optional_long", "getOptionalLong", ScalarTypeProbe::getOptionalLong); + } + public ScalarTypeProbeExpression updateOptionalLong(Long optionalLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalLong(optionalLong)); + } + + public Expression getRequiredDecimal(){ + return loaded("required_decimal", "getRequiredDecimal", ScalarTypeProbe::getRequiredDecimal); + } + public ScalarTypeProbeExpression updateRequiredDecimal(BigDecimal requiredDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDecimal(requiredDecimal)); + } + + public Expression getOptionalDecimal(){ + return loaded("optional_decimal", "getOptionalDecimal", ScalarTypeProbe::getOptionalDecimal); + } + public ScalarTypeProbeExpression updateOptionalDecimal(BigDecimal optionalDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDecimal(optionalDecimal)); + } + + public Expression getRequiredFloat(){ + return loaded("required_float", "getRequiredFloat", ScalarTypeProbe::getRequiredFloat); + } + public ScalarTypeProbeExpression updateRequiredFloat(Float requiredFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredFloat(requiredFloat)); + } + + public Expression getOptionalFloat(){ + return loaded("optional_float", "getOptionalFloat", ScalarTypeProbe::getOptionalFloat); + } + public ScalarTypeProbeExpression updateOptionalFloat(Float optionalFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalFloat(optionalFloat)); + } + + public Expression getRequiredDouble(){ + return loaded("required_double", "getRequiredDouble", ScalarTypeProbe::getRequiredDouble); + } + public ScalarTypeProbeExpression updateRequiredDouble(Double requiredDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDouble(requiredDouble)); + } + + public Expression getOptionalDouble(){ + return loaded("optional_double", "getOptionalDouble", ScalarTypeProbe::getOptionalDouble); + } + public ScalarTypeProbeExpression updateOptionalDouble(Double optionalDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDouble(optionalDouble)); + } + + public Expression getRequiredDate(){ + return loaded("required_date", "getRequiredDate", ScalarTypeProbe::getRequiredDate); + } + public ScalarTypeProbeExpression updateRequiredDate(LocalDate requiredDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDate(requiredDate)); + } + + public Expression getOptionalDate(){ + return loaded("optional_date", "getOptionalDate", ScalarTypeProbe::getOptionalDate); + } + public ScalarTypeProbeExpression updateOptionalDate(LocalDate optionalDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDate(optionalDate)); + } + + public Expression getRequiredTime(){ + return loaded("required_time", "getRequiredTime", ScalarTypeProbe::getRequiredTime); + } + public ScalarTypeProbeExpression updateRequiredTime(LocalTime requiredTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredTime(requiredTime)); + } + + public Expression getOptionalTime(){ + return loaded("optional_time", "getOptionalTime", ScalarTypeProbe::getOptionalTime); + } + public ScalarTypeProbeExpression updateOptionalTime(LocalTime optionalTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalTime(optionalTime)); + } + + public Expression getRequiredDatetime(){ + return loaded("required_datetime", "getRequiredDatetime", ScalarTypeProbe::getRequiredDatetime); + } + public ScalarTypeProbeExpression updateRequiredDatetime(LocalDateTime requiredDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDatetime(requiredDatetime)); + } + + public Expression getOptionalDatetime(){ + return loaded("optional_datetime", "getOptionalDatetime", ScalarTypeProbe::getOptionalDatetime); + } + public ScalarTypeProbeExpression updateOptionalDatetime(LocalDateTime optionalDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDatetime(optionalDatetime)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", ScalarTypeProbe::getCreateTime); + } + public ScalarTypeProbeExpression updateCreateTime(LocalDateTime createTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", ScalarTypeProbe::getUpdateTime); + } + public ScalarTypeProbeExpression updateUpdateTime(LocalDateTime updateTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java new file mode 100644 index 000000000..8f2542a82 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class ScalarTypeProbeListExpression extends SmartListExpression { + public ScalarTypeProbeListExpression(Expression> expression){ + super(expression); + } + + public ScalarTypeProbeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public ScalarTypeProbeExpression first() { + return new ScalarTypeProbeExpression(super.first()); + } + + public ScalarTypeProbeExpression get(int index) { + return new ScalarTypeProbeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java new file mode 100644 index 000000000..6a60aaedd --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -0,0 +1,3766 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; + +public class ScalarTypeProbeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest(Class returnType){ + this(returnType, () -> (T) new ScalarTypeProbe()); + } + + protected ScalarTypeProbeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public ScalarTypeProbeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public ScalarTypeProbeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public ScalarTypeProbeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public ScalarTypeProbeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public ScalarTypeProbeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (ScalarTypeProbeRequest)super.appendSearchCriteria(searchCriteria); + } + + public ScalarTypeProbeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarTypeProbe){ + super.internalMatchAny(scalarTypeProbe); + return this; + } + + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public ScalarTypeProbeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public ScalarTypeProbeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public ScalarTypeProbeRequest selectSelf(){ + super.selectSelf(); + return selectId().selectTypePlatformIdOnly().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectSelfFields(){ + return selectSelf(); + } + + public ScalarTypeProbeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(ScalarTypeProbe.ID_PROPERTY); + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectAll(){ + super.selectAll(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectChildren(){ + super.selectAny(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public ScalarTypeProbeRequest selectId(){ + selectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectId(){ + unselectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectTypePlatformIdOnly(){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectTypePlatform(){ + return selectTypePlatformWith(Q.typePlatforms().unlimited().selectSelf()); + } + + public ScalarTypeProbeRequest selectTypePlatformWith(TypePlatformRequest typePlatform){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + enhanceRelation(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTypePlatformWith", null, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + public ScalarTypeProbeRequest unselectTypePlatform(){ + unselectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredString(){ + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + /** + * fill the requiredString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredString) to fetch requiredString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredString(){ + unselectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalString(){ + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + /** + * fill the optionalString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalString) to fetch optionalString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalString(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectLargeText(){ + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + /** + * fill the largeText with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS largeText) to fetch largeText property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectLargeText(){ + unselectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredBoolean(){ + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the requiredBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredBoolean) to fetch requiredBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredBoolean(){ + unselectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalBoolean(){ + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the optionalBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalBoolean) to fetch optionalBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalBoolean(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredInteger(){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + /** + * fill the requiredInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredInteger) to fetch requiredInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredInteger) AS requiredInteger to fetch requiredInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredInteger(){ + unselectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalInteger(){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + /** + * fill the optionalInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalInteger) to fetch optionalInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalInteger) AS optionalInteger to fetch optionalInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalInteger(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredLong(){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + /** + * fill the requiredLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredLong) to fetch requiredLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredLong with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredLong) AS requiredLong to fetch requiredLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredLong(){ + unselectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalLong(){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + /** + * fill the optionalLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalLong) to fetch optionalLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalLong with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalLong) AS optionalLong to fetch optionalLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalLong(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDecimal(){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the requiredDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDecimal) to fetch requiredDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDecimal) AS requiredDecimal to fetch requiredDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDecimal(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDecimal(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the optionalDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDecimal) to fetch optionalDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDecimal) AS optionalDecimal to fetch optionalDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDecimal(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredFloat(){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + /** + * fill the requiredFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredFloat) to fetch requiredFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredFloat) AS requiredFloat to fetch requiredFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredFloat(){ + unselectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalFloat(){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + /** + * fill the optionalFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalFloat) to fetch optionalFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalFloat) AS optionalFloat to fetch optionalFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalFloat(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDouble(){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the requiredDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDouble) to fetch requiredDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDouble) AS requiredDouble to fetch requiredDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDouble(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDouble(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the optionalDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDouble) to fetch optionalDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDouble) AS optionalDouble to fetch optionalDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDouble(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDate(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + /** + * fill the requiredDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDate) to fetch requiredDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDate(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDate(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + /** + * fill the optionalDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDate) to fetch optionalDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDate(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredTime(){ + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + /** + * fill the requiredTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredTime) to fetch requiredTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredTime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalTime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + /** + * fill the optionalTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalTime) to fetch optionalTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalTime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDatetime(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + /** + * fill the requiredDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDatetime) to fetch requiredDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDatetime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDatetime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + /** + * fill the optionalDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDatetime) to fetch optionalDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDatetime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectCreateTime(){ + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectCreateTime(){ + unselectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectUpdateTime(){ + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectUpdateTime(){ + unselectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectVersion(){ + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectVersion(){ + unselectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.ID_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public ScalarTypeProbeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public ScalarTypeProbeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public ScalarTypeProbeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public ScalarTypeProbeRequest filterByTypePlatform(TypePlatform... typePlatform){ + if (typePlatform == null || typePlatform.length == 0) { + throw new IllegalArgumentException("filterByTypePlatform parameter typePlatform cannot be empty"); + } + return appendSearchCriteria(createTypePlatformCriteria(Operator.EQUAL, (Object[])typePlatform)); + } + + public ScalarTypeProbeRequest withTypePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createTypePlatformCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withTypePlatformIsUnknown(){ + return withTypePlatform(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withTypePlatformIsKnown(){ + return withTypePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTypePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest filterByTypePlatform(Long typePlatform){ + if(typePlatform == null){ + return this; + } + return withTypePlatform(Operator.EQUAL, typePlatform); + } + public ScalarTypeProbeRequest withTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY)); + } + + public ScalarTypeProbeRequest withoutTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY))); + } + + public ScalarTypeProbeRequest filterByRequiredString(String... requiredString){ + if (requiredString == null || requiredString.length == 0) { + throw new IllegalArgumentException("filterByRequiredString parameter requiredString cannot be empty"); + } + return appendSearchCriteria(createRequiredStringCriteria(Operator.EQUAL, (Object[])requiredString)); + } + + public ScalarTypeProbeRequest withRequiredString(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredStringIsUnknown(){ + return withRequiredString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredStringIsKnown(){ + return withRequiredString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredStringIsNot(String requiredString){ + return withRequiredString(Operator.NOT_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIn(String... requiredString){ + return withRequiredString(Operator.IN, (Object[])requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotIn(String... requiredString){ + return withRequiredString(Operator.NOT_IN, (Object[])requiredString); + } + public ScalarTypeProbeRequest withRequiredStringGreaterThan(String requiredString){ + return withRequiredString(Operator.GREATER_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringGreaterThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.GREATER_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThan(String requiredString){ + return withRequiredString(Operator.LESS_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.LESS_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringBetween(String startOfRequiredString, String endOfRequiredString){ + return withRequiredString(Operator.BETWEEN, startOfRequiredString, endOfRequiredString); + } + public ScalarTypeProbeRequest withRequiredStringStartingWith(String requiredString){ + return withRequiredString(Operator.BEGIN_WITH, requiredString); + } + public ScalarTypeProbeRequest withRequiredStringContaining(String requiredString){ + return withRequiredString(Operator.CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotContaining(String requiredString){ + return withRequiredString(Operator.NOT_CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotStartingWith(String requiredString){ + return withRequiredString(Operator.NOT_BEGIN_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringEndingWith(String requiredString){ + return withRequiredString(Operator.END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotEndingWith(String requiredString){ + return withRequiredString(Operator.NOT_END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIs(String requiredString){ + return withRequiredString(Operator.EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringSoundingLike(String requiredString){ + return withRequiredString(Operator.SOUNDS_LIKE, requiredString); + } + + + + public ScalarTypeProbeRequest filterByOptionalString(String... optionalString){ + if (optionalString == null || optionalString.length == 0) { + throw new IllegalArgumentException("filterByOptionalString parameter optionalString cannot be empty"); + } + return appendSearchCriteria(createOptionalStringCriteria(Operator.EQUAL, (Object[])optionalString)); + } + + public ScalarTypeProbeRequest withOptionalString(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalStringIsUnknown(){ + return withOptionalString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalStringIsKnown(){ + return withOptionalString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalStringIsNot(String optionalString){ + return withOptionalString(Operator.NOT_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIn(String... optionalString){ + return withOptionalString(Operator.IN, (Object[])optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotIn(String... optionalString){ + return withOptionalString(Operator.NOT_IN, (Object[])optionalString); + } + public ScalarTypeProbeRequest withOptionalStringGreaterThan(String optionalString){ + return withOptionalString(Operator.GREATER_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringGreaterThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.GREATER_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThan(String optionalString){ + return withOptionalString(Operator.LESS_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.LESS_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringBetween(String startOfOptionalString, String endOfOptionalString){ + return withOptionalString(Operator.BETWEEN, startOfOptionalString, endOfOptionalString); + } + public ScalarTypeProbeRequest withOptionalStringStartingWith(String optionalString){ + return withOptionalString(Operator.BEGIN_WITH, optionalString); + } + public ScalarTypeProbeRequest withOptionalStringContaining(String optionalString){ + return withOptionalString(Operator.CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotContaining(String optionalString){ + return withOptionalString(Operator.NOT_CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotStartingWith(String optionalString){ + return withOptionalString(Operator.NOT_BEGIN_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringEndingWith(String optionalString){ + return withOptionalString(Operator.END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotEndingWith(String optionalString){ + return withOptionalString(Operator.NOT_END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIs(String optionalString){ + return withOptionalString(Operator.EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringSoundingLike(String optionalString){ + return withOptionalString(Operator.SOUNDS_LIKE, optionalString); + } + + + + public ScalarTypeProbeRequest filterByLargeText(String... largeText){ + if (largeText == null || largeText.length == 0) { + throw new IllegalArgumentException("filterByLargeText parameter largeText cannot be empty"); + } + return appendSearchCriteria(createLargeTextCriteria(Operator.EQUAL, (Object[])largeText)); + } + + public ScalarTypeProbeRequest withLargeText(Operator operator, Object... values){ + return appendSearchCriteria(createLargeTextCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withLargeTextIsUnknown(){ + return withLargeText(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withLargeTextIsKnown(){ + return withLargeText(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLargeTextCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.LARGE_TEXT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withLargeTextIsNot(String largeText){ + return withLargeText(Operator.NOT_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextIn(String... largeText){ + return withLargeText(Operator.IN, (Object[])largeText); + } + + public ScalarTypeProbeRequest withLargeTextNotIn(String... largeText){ + return withLargeText(Operator.NOT_IN, (Object[])largeText); + } + public ScalarTypeProbeRequest withLargeTextGreaterThan(String largeText){ + return withLargeText(Operator.GREATER_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextGreaterThanOrEqualTo(String largeText){ + return withLargeText(Operator.GREATER_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThan(String largeText){ + return withLargeText(Operator.LESS_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThanOrEqualTo(String largeText){ + return withLargeText(Operator.LESS_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextBetween(String startOfLargeText, String endOfLargeText){ + return withLargeText(Operator.BETWEEN, startOfLargeText, endOfLargeText); + } + public ScalarTypeProbeRequest withLargeTextIs(String largeText){ + return withLargeText(Operator.EQUAL, largeText); + } + + + + public ScalarTypeProbeRequest filterByRequiredBoolean(Boolean... requiredBoolean){ + if (requiredBoolean == null || requiredBoolean.length == 0) { + throw new IllegalArgumentException("filterByRequiredBoolean parameter requiredBoolean cannot be empty"); + } + return appendSearchCriteria(createRequiredBooleanCriteria(Operator.EQUAL, (Object[])requiredBoolean)); + } + + public ScalarTypeProbeRequest withRequiredBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsUnknown(){ + return withRequiredBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsKnown(){ + return withRequiredBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByOptionalBoolean(Boolean... optionalBoolean){ + if (optionalBoolean == null || optionalBoolean.length == 0) { + throw new IllegalArgumentException("filterByOptionalBoolean parameter optionalBoolean cannot be empty"); + } + return appendSearchCriteria(createOptionalBooleanCriteria(Operator.EQUAL, (Object[])optionalBoolean)); + } + + public ScalarTypeProbeRequest withOptionalBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsUnknown(){ + return withOptionalBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsKnown(){ + return withOptionalBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByRequiredInteger(Integer... requiredInteger){ + if (requiredInteger == null || requiredInteger.length == 0) { + throw new IllegalArgumentException("filterByRequiredInteger parameter requiredInteger cannot be empty"); + } + return appendSearchCriteria(createRequiredIntegerCriteria(Operator.EQUAL, (Object[])requiredInteger)); + } + + public ScalarTypeProbeRequest withRequiredInteger(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsUnknown(){ + return withRequiredInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsKnown(){ + return withRequiredInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredIntegerIs(Integer requiredInteger){ + return withRequiredInteger(Operator.EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsNot(Integer requiredInteger){ + return withRequiredInteger(Operator.NOT_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.IN, (Object[])requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerNotIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.NOT_IN, (Object[])requiredInteger); + } + public ScalarTypeProbeRequest withRequiredIntegerGreaterThan(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerGreaterThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThan(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerBetween(Integer startOfRequiredInteger, Integer endOfRequiredInteger){ + return withRequiredInteger(Operator.BETWEEN, startOfRequiredInteger, endOfRequiredInteger); + } + + + + public ScalarTypeProbeRequest filterByOptionalInteger(Integer... optionalInteger){ + if (optionalInteger == null || optionalInteger.length == 0) { + throw new IllegalArgumentException("filterByOptionalInteger parameter optionalInteger cannot be empty"); + } + return appendSearchCriteria(createOptionalIntegerCriteria(Operator.EQUAL, (Object[])optionalInteger)); + } + + public ScalarTypeProbeRequest withOptionalInteger(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsUnknown(){ + return withOptionalInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsKnown(){ + return withOptionalInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalIntegerIs(Integer optionalInteger){ + return withOptionalInteger(Operator.EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsNot(Integer optionalInteger){ + return withOptionalInteger(Operator.NOT_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.IN, (Object[])optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerNotIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.NOT_IN, (Object[])optionalInteger); + } + public ScalarTypeProbeRequest withOptionalIntegerGreaterThan(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerGreaterThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThan(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerBetween(Integer startOfOptionalInteger, Integer endOfOptionalInteger){ + return withOptionalInteger(Operator.BETWEEN, startOfOptionalInteger, endOfOptionalInteger); + } + + + + public ScalarTypeProbeRequest filterByRequiredLong(Long... requiredLong){ + if (requiredLong == null || requiredLong.length == 0) { + throw new IllegalArgumentException("filterByRequiredLong parameter requiredLong cannot be empty"); + } + return appendSearchCriteria(createRequiredLongCriteria(Operator.EQUAL, (Object[])requiredLong)); + } + + public ScalarTypeProbeRequest withRequiredLong(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredLongIsUnknown(){ + return withRequiredLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredLongIsKnown(){ + return withRequiredLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredLongIs(Long requiredLong){ + return withRequiredLong(Operator.EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIsNot(Long requiredLong){ + return withRequiredLong(Operator.NOT_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIn(Long... requiredLong){ + return withRequiredLong(Operator.IN, (Object[])requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongNotIn(Long... requiredLong){ + return withRequiredLong(Operator.NOT_IN, (Object[])requiredLong); + } + public ScalarTypeProbeRequest withRequiredLongGreaterThan(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongGreaterThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThan(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongBetween(Long startOfRequiredLong, Long endOfRequiredLong){ + return withRequiredLong(Operator.BETWEEN, startOfRequiredLong, endOfRequiredLong); + } + + + + public ScalarTypeProbeRequest filterByOptionalLong(Long... optionalLong){ + if (optionalLong == null || optionalLong.length == 0) { + throw new IllegalArgumentException("filterByOptionalLong parameter optionalLong cannot be empty"); + } + return appendSearchCriteria(createOptionalLongCriteria(Operator.EQUAL, (Object[])optionalLong)); + } + + public ScalarTypeProbeRequest withOptionalLong(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalLongIsUnknown(){ + return withOptionalLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalLongIsKnown(){ + return withOptionalLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalLongIs(Long optionalLong){ + return withOptionalLong(Operator.EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIsNot(Long optionalLong){ + return withOptionalLong(Operator.NOT_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIn(Long... optionalLong){ + return withOptionalLong(Operator.IN, (Object[])optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongNotIn(Long... optionalLong){ + return withOptionalLong(Operator.NOT_IN, (Object[])optionalLong); + } + public ScalarTypeProbeRequest withOptionalLongGreaterThan(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongGreaterThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThan(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongBetween(Long startOfOptionalLong, Long endOfOptionalLong){ + return withOptionalLong(Operator.BETWEEN, startOfOptionalLong, endOfOptionalLong); + } + + + + public ScalarTypeProbeRequest filterByRequiredDecimal(BigDecimal... requiredDecimal){ + if (requiredDecimal == null || requiredDecimal.length == 0) { + throw new IllegalArgumentException("filterByRequiredDecimal parameter requiredDecimal cannot be empty"); + } + return appendSearchCriteria(createRequiredDecimalCriteria(Operator.EQUAL, (Object[])requiredDecimal)); + } + + public ScalarTypeProbeRequest withRequiredDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsUnknown(){ + return withRequiredDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsKnown(){ + return withRequiredDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDecimalIs(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsNot(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.NOT_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.IN, (Object[])requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalNotIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.NOT_IN, (Object[])requiredDecimal); + } + public ScalarTypeProbeRequest withRequiredDecimalGreaterThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalGreaterThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalBetween(BigDecimal startOfRequiredDecimal, BigDecimal endOfRequiredDecimal){ + return withRequiredDecimal(Operator.BETWEEN, startOfRequiredDecimal, endOfRequiredDecimal); + } + + + + public ScalarTypeProbeRequest filterByOptionalDecimal(BigDecimal... optionalDecimal){ + if (optionalDecimal == null || optionalDecimal.length == 0) { + throw new IllegalArgumentException("filterByOptionalDecimal parameter optionalDecimal cannot be empty"); + } + return appendSearchCriteria(createOptionalDecimalCriteria(Operator.EQUAL, (Object[])optionalDecimal)); + } + + public ScalarTypeProbeRequest withOptionalDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsUnknown(){ + return withOptionalDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsKnown(){ + return withOptionalDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDecimalIs(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsNot(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.NOT_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.IN, (Object[])optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalNotIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.NOT_IN, (Object[])optionalDecimal); + } + public ScalarTypeProbeRequest withOptionalDecimalGreaterThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalGreaterThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalBetween(BigDecimal startOfOptionalDecimal, BigDecimal endOfOptionalDecimal){ + return withOptionalDecimal(Operator.BETWEEN, startOfOptionalDecimal, endOfOptionalDecimal); + } + + + + public ScalarTypeProbeRequest filterByRequiredFloat(Float... requiredFloat){ + if (requiredFloat == null || requiredFloat.length == 0) { + throw new IllegalArgumentException("filterByRequiredFloat parameter requiredFloat cannot be empty"); + } + return appendSearchCriteria(createRequiredFloatCriteria(Operator.EQUAL, (Object[])requiredFloat)); + } + + public ScalarTypeProbeRequest withRequiredFloat(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredFloatIsUnknown(){ + return withRequiredFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredFloatIsKnown(){ + return withRequiredFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredFloatIs(Float requiredFloat){ + return withRequiredFloat(Operator.EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIsNot(Float requiredFloat){ + return withRequiredFloat(Operator.NOT_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIn(Float... requiredFloat){ + return withRequiredFloat(Operator.IN, (Object[])requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatNotIn(Float... requiredFloat){ + return withRequiredFloat(Operator.NOT_IN, (Object[])requiredFloat); + } + public ScalarTypeProbeRequest withRequiredFloatGreaterThan(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatGreaterThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThan(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatBetween(Float startOfRequiredFloat, Float endOfRequiredFloat){ + return withRequiredFloat(Operator.BETWEEN, startOfRequiredFloat, endOfRequiredFloat); + } + + + + public ScalarTypeProbeRequest filterByOptionalFloat(Float... optionalFloat){ + if (optionalFloat == null || optionalFloat.length == 0) { + throw new IllegalArgumentException("filterByOptionalFloat parameter optionalFloat cannot be empty"); + } + return appendSearchCriteria(createOptionalFloatCriteria(Operator.EQUAL, (Object[])optionalFloat)); + } + + public ScalarTypeProbeRequest withOptionalFloat(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalFloatIsUnknown(){ + return withOptionalFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalFloatIsKnown(){ + return withOptionalFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalFloatIs(Float optionalFloat){ + return withOptionalFloat(Operator.EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIsNot(Float optionalFloat){ + return withOptionalFloat(Operator.NOT_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIn(Float... optionalFloat){ + return withOptionalFloat(Operator.IN, (Object[])optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatNotIn(Float... optionalFloat){ + return withOptionalFloat(Operator.NOT_IN, (Object[])optionalFloat); + } + public ScalarTypeProbeRequest withOptionalFloatGreaterThan(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatGreaterThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThan(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatBetween(Float startOfOptionalFloat, Float endOfOptionalFloat){ + return withOptionalFloat(Operator.BETWEEN, startOfOptionalFloat, endOfOptionalFloat); + } + + + + public ScalarTypeProbeRequest filterByRequiredDouble(Double... requiredDouble){ + if (requiredDouble == null || requiredDouble.length == 0) { + throw new IllegalArgumentException("filterByRequiredDouble parameter requiredDouble cannot be empty"); + } + return appendSearchCriteria(createRequiredDoubleCriteria(Operator.EQUAL, (Object[])requiredDouble)); + } + + public ScalarTypeProbeRequest withRequiredDouble(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsUnknown(){ + return withRequiredDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsKnown(){ + return withRequiredDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDoubleIs(Double requiredDouble){ + return withRequiredDouble(Operator.EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsNot(Double requiredDouble){ + return withRequiredDouble(Operator.NOT_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIn(Double... requiredDouble){ + return withRequiredDouble(Operator.IN, (Object[])requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleNotIn(Double... requiredDouble){ + return withRequiredDouble(Operator.NOT_IN, (Object[])requiredDouble); + } + public ScalarTypeProbeRequest withRequiredDoubleGreaterThan(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleGreaterThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThan(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleBetween(Double startOfRequiredDouble, Double endOfRequiredDouble){ + return withRequiredDouble(Operator.BETWEEN, startOfRequiredDouble, endOfRequiredDouble); + } + + + + public ScalarTypeProbeRequest filterByOptionalDouble(Double... optionalDouble){ + if (optionalDouble == null || optionalDouble.length == 0) { + throw new IllegalArgumentException("filterByOptionalDouble parameter optionalDouble cannot be empty"); + } + return appendSearchCriteria(createOptionalDoubleCriteria(Operator.EQUAL, (Object[])optionalDouble)); + } + + public ScalarTypeProbeRequest withOptionalDouble(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsUnknown(){ + return withOptionalDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsKnown(){ + return withOptionalDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDoubleIs(Double optionalDouble){ + return withOptionalDouble(Operator.EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsNot(Double optionalDouble){ + return withOptionalDouble(Operator.NOT_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIn(Double... optionalDouble){ + return withOptionalDouble(Operator.IN, (Object[])optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleNotIn(Double... optionalDouble){ + return withOptionalDouble(Operator.NOT_IN, (Object[])optionalDouble); + } + public ScalarTypeProbeRequest withOptionalDoubleGreaterThan(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleGreaterThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThan(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleBetween(Double startOfOptionalDouble, Double endOfOptionalDouble){ + return withOptionalDouble(Operator.BETWEEN, startOfOptionalDouble, endOfOptionalDouble); + } + + + + public ScalarTypeProbeRequest filterByRequiredDate(LocalDate... requiredDate){ + if (requiredDate == null || requiredDate.length == 0) { + throw new IllegalArgumentException("filterByRequiredDate parameter requiredDate cannot be empty"); + } + return appendSearchCriteria(createRequiredDateCriteria(Operator.EQUAL, (Object[])requiredDate)); + } + + public ScalarTypeProbeRequest withRequiredDate(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDateIsUnknown(){ + return withRequiredDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDateIsKnown(){ + return withRequiredDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDateIs(LocalDate requiredDate){ + return withRequiredDate(Operator.EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIsNot(LocalDate requiredDate){ + return withRequiredDate(Operator.NOT_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.IN, (Object[])requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateNotIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.NOT_IN, (Object[])requiredDate); + } + public ScalarTypeProbeRequest withRequiredDateGreaterThan(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateGreaterThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThan(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(LocalDate startOfRequiredDate, LocalDate endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + public ScalarTypeProbeRequest withRequiredDateBefore(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBefore(Date requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(Date requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(Date startOfRequiredDate, Date endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDate(LocalDate... optionalDate){ + if (optionalDate == null || optionalDate.length == 0) { + throw new IllegalArgumentException("filterByOptionalDate parameter optionalDate cannot be empty"); + } + return appendSearchCriteria(createOptionalDateCriteria(Operator.EQUAL, (Object[])optionalDate)); + } + + public ScalarTypeProbeRequest withOptionalDate(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDateIsUnknown(){ + return withOptionalDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDateIsKnown(){ + return withOptionalDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDateIs(LocalDate optionalDate){ + return withOptionalDate(Operator.EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIsNot(LocalDate optionalDate){ + return withOptionalDate(Operator.NOT_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.IN, (Object[])optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateNotIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.NOT_IN, (Object[])optionalDate); + } + public ScalarTypeProbeRequest withOptionalDateGreaterThan(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateGreaterThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThan(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(LocalDate startOfOptionalDate, LocalDate endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + public ScalarTypeProbeRequest withOptionalDateBefore(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBefore(Date optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(Date optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(Date startOfOptionalDate, Date endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + + + + + public ScalarTypeProbeRequest filterByRequiredTime(LocalTime... requiredTime){ + if (requiredTime == null || requiredTime.length == 0) { + throw new IllegalArgumentException("filterByRequiredTime parameter requiredTime cannot be empty"); + } + return appendSearchCriteria(createRequiredTimeCriteria(Operator.EQUAL, (Object[])requiredTime)); + } + + public ScalarTypeProbeRequest withRequiredTime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredTimeIsUnknown(){ + return withRequiredTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredTimeIsKnown(){ + return withRequiredTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredTimeIs(LocalTime requiredTime){ + return withRequiredTime(Operator.EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIsNot(LocalTime requiredTime){ + return withRequiredTime(Operator.NOT_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.IN, (Object[])requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeNotIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.NOT_IN, (Object[])requiredTime); + } + public ScalarTypeProbeRequest withRequiredTimeGreaterThan(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeGreaterThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThan(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeBetween(LocalTime startOfRequiredTime, LocalTime endOfRequiredTime){ + return withRequiredTime(Operator.BETWEEN, startOfRequiredTime, endOfRequiredTime); + } + + + public ScalarTypeProbeRequest filterByOptionalTime(LocalTime... optionalTime){ + if (optionalTime == null || optionalTime.length == 0) { + throw new IllegalArgumentException("filterByOptionalTime parameter optionalTime cannot be empty"); + } + return appendSearchCriteria(createOptionalTimeCriteria(Operator.EQUAL, (Object[])optionalTime)); + } + + public ScalarTypeProbeRequest withOptionalTime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalTimeIsUnknown(){ + return withOptionalTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalTimeIsKnown(){ + return withOptionalTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalTimeIs(LocalTime optionalTime){ + return withOptionalTime(Operator.EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIsNot(LocalTime optionalTime){ + return withOptionalTime(Operator.NOT_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.IN, (Object[])optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeNotIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.NOT_IN, (Object[])optionalTime); + } + public ScalarTypeProbeRequest withOptionalTimeGreaterThan(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeGreaterThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThan(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeBetween(LocalTime startOfOptionalTime, LocalTime endOfOptionalTime){ + return withOptionalTime(Operator.BETWEEN, startOfOptionalTime, endOfOptionalTime); + } + + + public ScalarTypeProbeRequest filterByRequiredDatetime(LocalDateTime... requiredDatetime){ + if (requiredDatetime == null || requiredDatetime.length == 0) { + throw new IllegalArgumentException("filterByRequiredDatetime parameter requiredDatetime cannot be empty"); + } + return appendSearchCriteria(createRequiredDatetimeCriteria(Operator.EQUAL, (Object[])requiredDatetime)); + } + + public ScalarTypeProbeRequest withRequiredDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsUnknown(){ + return withRequiredDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsKnown(){ + return withRequiredDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIs(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsNot(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.NOT_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.IN, (Object[])requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeNotIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.NOT_IN, (Object[])requiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(LocalDateTime startOfRequiredDatetime, LocalDateTime endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeBefore(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBefore(Date requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(Date requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(Date startOfRequiredDatetime, Date endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDatetime(LocalDateTime... optionalDatetime){ + if (optionalDatetime == null || optionalDatetime.length == 0) { + throw new IllegalArgumentException("filterByOptionalDatetime parameter optionalDatetime cannot be empty"); + } + return appendSearchCriteria(createOptionalDatetimeCriteria(Operator.EQUAL, (Object[])optionalDatetime)); + } + + public ScalarTypeProbeRequest withOptionalDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsUnknown(){ + return withOptionalDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsKnown(){ + return withOptionalDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIs(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsNot(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.NOT_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.IN, (Object[])optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeNotIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.NOT_IN, (Object[])optionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(LocalDateTime startOfOptionalDatetime, LocalDateTime endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeBefore(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBefore(Date optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(Date optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(Date startOfOptionalDatetime, Date endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + + + + + public ScalarTypeProbeRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public ScalarTypeProbeRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.CREATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public ScalarTypeProbeRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public ScalarTypeProbeRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public ScalarTypeProbeRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public ScalarTypeProbeRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public ScalarTypeProbeRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.UPDATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public ScalarTypeProbeRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public ScalarTypeProbeRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.VERSION_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public ScalarTypeProbeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public ScalarTypeProbeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public ScalarTypeProbeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public ScalarTypeProbeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public ScalarTypeProbeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest minRequiredInteger(){ + return minRequiredIntegerAs(prefix("minOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredInteger(){ + return maxRequiredIntegerAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredInteger(){ + return sumRequiredIntegerAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredInteger(){ + return avgRequiredIntegerAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredInteger(){ + return standardDeviationRequiredIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredInteger(){ + return squareRootOfPopulationStandardDeviationRequiredIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredInteger(){ + return sampleVarianceRequiredIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredInteger(){ + return samplePopulationVarianceRequiredIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalInteger(){ + return minOptionalIntegerAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalInteger(){ + return maxOptionalIntegerAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalInteger(){ + return sumOptionalIntegerAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalInteger(){ + return avgOptionalIntegerAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalInteger(){ + return standardDeviationOptionalIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalInteger(){ + return squareRootOfPopulationStandardDeviationOptionalIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalInteger(){ + return sampleVarianceOptionalIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalInteger(){ + return samplePopulationVarianceOptionalIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredLong(){ + return minRequiredLongAs(prefix("minOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredLongAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredLong(){ + return maxRequiredLongAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredLongAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredLong(){ + return sumRequiredLongAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredLong(){ + return avgRequiredLongAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredLong(){ + return standardDeviationRequiredLongAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLong(){ + return squareRootOfPopulationStandardDeviationRequiredLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredLong(){ + return sampleVarianceRequiredLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLong(){ + return samplePopulationVarianceRequiredLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalLong(){ + return minOptionalLongAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalLongAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalLong(){ + return maxOptionalLongAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalLongAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalLong(){ + return sumOptionalLongAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalLong(){ + return avgOptionalLongAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalLong(){ + return standardDeviationOptionalLongAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLong(){ + return squareRootOfPopulationStandardDeviationOptionalLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalLong(){ + return sampleVarianceOptionalLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLong(){ + return samplePopulationVarianceOptionalLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDecimal(){ + return minRequiredDecimalAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDecimal(){ + return maxRequiredDecimalAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDecimal(){ + return sumRequiredDecimalAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDecimal(){ + return avgRequiredDecimalAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDecimal(){ + return standardDeviationRequiredDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimal(){ + return squareRootOfPopulationStandardDeviationRequiredDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDecimal(){ + return sampleVarianceRequiredDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimal(){ + return samplePopulationVarianceRequiredDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDecimal(){ + return minOptionalDecimalAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDecimal(){ + return maxOptionalDecimalAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDecimal(){ + return sumOptionalDecimalAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDecimal(){ + return avgOptionalDecimalAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDecimal(){ + return standardDeviationOptionalDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimal(){ + return squareRootOfPopulationStandardDeviationOptionalDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDecimal(){ + return sampleVarianceOptionalDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimal(){ + return samplePopulationVarianceOptionalDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredFloat(){ + return minRequiredFloatAs(prefix("minOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredFloat(){ + return maxRequiredFloatAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredFloat(){ + return sumRequiredFloatAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredFloat(){ + return avgRequiredFloatAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredFloat(){ + return standardDeviationRequiredFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloat(){ + return squareRootOfPopulationStandardDeviationRequiredFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredFloat(){ + return sampleVarianceRequiredFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloat(){ + return samplePopulationVarianceRequiredFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalFloat(){ + return minOptionalFloatAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalFloat(){ + return maxOptionalFloatAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalFloat(){ + return sumOptionalFloatAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalFloat(){ + return avgOptionalFloatAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalFloat(){ + return standardDeviationOptionalFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloat(){ + return squareRootOfPopulationStandardDeviationOptionalFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalFloat(){ + return sampleVarianceOptionalFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloat(){ + return samplePopulationVarianceOptionalFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDouble(){ + return minRequiredDoubleAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDouble(){ + return maxRequiredDoubleAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDouble(){ + return sumRequiredDoubleAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDouble(){ + return avgRequiredDoubleAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDouble(){ + return standardDeviationRequiredDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDouble(){ + return squareRootOfPopulationStandardDeviationRequiredDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDouble(){ + return sampleVarianceRequiredDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDouble(){ + return samplePopulationVarianceRequiredDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDouble(){ + return minOptionalDoubleAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDouble(){ + return maxOptionalDoubleAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDouble(){ + return sumOptionalDoubleAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDouble(){ + return avgOptionalDoubleAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDouble(){ + return standardDeviationOptionalDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDouble(){ + return squareRootOfPopulationStandardDeviationOptionalDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDouble(){ + return sampleVarianceOptionalDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDouble(){ + return samplePopulationVarianceOptionalDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(){ + return groupByTypePlatformWithDetails(Q.typePlatforms().unlimited()); + } + + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequest subRequest){ + aggregate(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest groupById(){ + groupBy(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdAs(String retName){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY, function); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatform(){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformAs(String retName){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredString(){ + groupBy(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalString(){ + groupBy(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByLargeText(){ + groupBy(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextAs(String retName){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBoolean(){ + groupBy(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBoolean(){ + groupBy(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredInteger(){ + groupBy(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalInteger(){ + groupBy(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLong(){ + groupBy(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLong(){ + groupBy(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimal(){ + groupBy(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimal(){ + groupBy(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloat(){ + groupBy(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloat(){ + groupBy(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDouble(){ + groupBy(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDouble(){ + groupBy(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDate(){ + groupBy(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDate(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTime(){ + groupBy(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTime(){ + groupBy(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetime(){ + groupBy(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetime(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTime(){ + groupBy(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTime(){ + groupBy(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByVersion(){ + groupBy(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionAs(String retName){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY, function); + return this; + } + + + + public ScalarTypeProbeRequest orderByIdAscending(){ + addOrderByAscending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByIdDescending(){ + addOrderByDescending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformAscending(){ + addOrderByAscending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformDescending(){ + addOrderByDescending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByRequiredStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByLargeTextAscending(){ + addOrderByAscending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByLargeTextDescending(){ + addOrderByDescending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionAscending(){ + addOrderByAscending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionDescending(){ + addOrderByDescending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest rollUpToTypePlatform(){ + TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); + this.withTypePlatformMatching(typePlatform) + .groupByTypePlatformWith(typePlatform); + return typePlatform; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform){ + return facetByTypePlatformAs(facetName, typePlatform, true); + } + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform, boolean includeAllFacets){ + addFacet(facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTypePlatformAs", facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public ScalarTypeProbeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public ScalarTypeProbeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public ScalarTypeProbeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public ScalarTypeProbeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java new file mode 100644 index 000000000..b7bc639f5 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -0,0 +1,123 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +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 TypePlatform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "TypePlatform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5afe0d829346ae9bcaf7f37458837cfbdcdee743f3e9fb8fab9c754126349de5"; + 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( + "scalar_type_probe_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + TypePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("PascalCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SCALAR_TYPE_PROBE_LIST_PROPERTY = "scalar_type_probe_list"; + private String name; + + private SmartList scalarTypeProbeList; + + public String getName(){ + return this.name; + } + + public SmartList getScalarTypeProbeList(){ + return this.scalarTypeProbeList; + } + public TypePlatform 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 TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + if (scalarTypeProbe == null){ + return this; + } + + if(null == this.scalarTypeProbeList){ + this.scalarTypeProbeList = new SmartList<>(); + } + + this.scalarTypeProbeList.add(scalarTypeProbe); + scalarTypeProbe.updateTypePlatform(this); + return this; + } + + public static TypePlatform refer(Long id){ + TypePlatform refer = new TypePlatform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public TypePlatform 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 "scalar_type_probe_list": this.scalarTypeProbeList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "scalar_type_probe_list": return this.scalarTypeProbeList; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java new file mode 100644 index 000000000..62df23ea0 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -0,0 +1,51 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class TypePlatformChecker implements Checker{ + + public String type(){ + return TypePlatform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, typePlatform)){ + markAsChecked(_context, typePlatform); + doCheck(_context, typePlatform, _parentLocation); + } + } + + public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if((typePlatform == null)){ + return; + } + if(typePlatform.needPersist()){ + } + if(typePlatform.newItem()){ + }else if(typePlatform.updateItem()){ + if(!typePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, typePlatform.getProperty(TypePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; typePlatform.getScalarTypeProbeList() != null && i < typePlatform.getScalarTypeProbeList().size(); i++){ + ScalarTypeProbe scalarTypeProbe = typePlatform.getScalarTypeProbeList().get(i); + new ScalarTypeProbeChecker().checkAndFix(_context, scalarTypeProbe, newLocation(_parentLocation, "scalar_type_probe_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java new file mode 100644 index 000000000..01a63a43c --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeListExpression; +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 TypePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public TypePlatformExpression(Expression expression){ + super(expression); + } + + public TypePlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public TypePlatformExpression updateId(Long id){ + return new TypePlatformExpression(this, $it -> {((TypePlatform)$it).__internalSet("id", id); return this;}); + } + + public TypePlatformExpression save(UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public TypePlatformExpression save(String intent, UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", TypePlatform::getName); + } + public TypePlatformExpression updateName(String name){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).updateName(name)); + } + + public ScalarTypeProbeListExpression getScalarTypeProbeList(){ + return new ScalarTypeProbeListExpression(loaded("scalar_type_probe_list", "getScalarTypeProbeList", TypePlatform::getScalarTypeProbeList)); + } + public TypePlatformExpression addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).addScalarTypeProbe(scalarTypeProbe)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java new file mode 100644 index 000000000..3974c0610 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class TypePlatformListExpression extends SmartListExpression { + public TypePlatformListExpression(Expression> expression){ + super(expression); + } + + public TypePlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public TypePlatformExpression first() { + return new TypePlatformExpression(super.first()); + } + + public TypePlatformExpression get(int index) { + return new TypePlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java new file mode 100644 index 000000000..0ac2f1d18 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -0,0 +1,2099 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest; +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 TypePlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public TypePlatformRequest(Class returnType){ + this(returnType, () -> (T) new TypePlatform()); + } + + protected TypePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public TypePlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public TypePlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public TypePlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public TypePlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public TypePlatformRequest 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 TypePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public TypePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public TypePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public TypePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (TypePlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public TypePlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ + super.internalMatchAny(typePlatform); + return this; + } + + public TypePlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public TypePlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public TypePlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public TypePlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public TypePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(TypePlatform.ID_PROPERTY); + selectProperty(TypePlatform.NAME_PROPERTY); + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectChildren(){ + super.selectAny(); + selectScalarTypeProbeList(); + return selectId().selectName().selectVersion(); + } + + + public TypePlatformRequest selectId(){ + selectProperty(TypePlatform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectId(){ + unselectProperty(TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest selectName(){ + selectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectName(){ + unselectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest selectVersion(){ + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectVersion(){ + unselectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + public TypePlatformRequest selectScalarTypeProbeList(){ + return selectScalarTypeProbeListWith(Q.scalarTypeProbes().selectSelf()); + } + + public TypePlatformRequest selectScalarTypeProbeListWith(ScalarTypeProbeRequest scalarTypeProbeList){ + enhanceRelation(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, scalarTypeProbeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectScalarTypeProbeListWith", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.ID_PROPERTY, operator, values); + } + + public TypePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public TypePlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public TypePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public TypePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public TypePlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public TypePlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.NAME_PROPERTY, operator, values); + } + + public TypePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public TypePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public TypePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public TypePlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public TypePlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public TypePlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public TypePlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public TypePlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public TypePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public TypePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public TypePlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public TypePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public TypePlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public TypePlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public TypePlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public TypePlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.VERSION_PROPERTY, operator, values); + } + + public TypePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public TypePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public TypePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public TypePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public TypePlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public TypePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public TypePlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public TypePlatformRequest withScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + } + + public TypePlatformRequest withoutScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY))); + } + + public TypePlatformRequest haveScalarTypeProbes(){ + return withScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest haveNoScalarTypeProbes(){ + return withoutScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public TypePlatformRequest 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 TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ + aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); + return this; + } + + public TypePlatformRequest groupById(){ + groupBy(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdAs(String retName){ + groupBy(retName, TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.ID_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByName(){ + groupBy(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameAs(String retName){ + groupBy(retName, TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.NAME_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByVersion(){ + groupBy(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionAs(String retName){ + groupBy(retName, TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.VERSION_PROPERTY, function); + return this; + } + + + + public TypePlatformRequest orderByIdAscending(){ + addOrderByAscending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByIdDescending(){ + addOrderByDescending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameAscending(){ + addOrderByAscending(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescending(){ + addOrderByDescending(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByVersionAscending(){ + addOrderByAscending(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest orderByVersionDescending(){ + addOrderByDescending(TypePlatform.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(name, subRequest, false); + } + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest statsFromScalarTypeProbes(ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(REFINEMENTS, subRequest); + } + public TypePlatformRequest countScalarTypeProbes(){ + addRelationCount("Count", Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesAs(String name){ + addRelationCount(name, Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesWith(String name, ScalarTypeProbeRequest subRequest){ + addRelationCount(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesWith", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name){ + return minRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name){ + return maxRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name){ + return sumRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name){ + return avgRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name){ + return minOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name){ + return maxOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name){ + return sumOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name){ + return avgOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name){ + return minRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name){ + return maxRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name){ + return sumRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name){ + return avgRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name){ + return minOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name){ + return maxOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name){ + return sumOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name){ + return avgOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name){ + return minRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name){ + return maxRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name){ + return sumRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name){ + return avgRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name){ + return minOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name){ + return maxOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name){ + return sumOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name){ + return avgOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name){ + return minRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name){ + return maxRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name){ + return sumRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name){ + return avgRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name){ + return minOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name){ + return maxOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name){ + return sumOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name){ + return avgOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name){ + return minRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name){ + return maxRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name){ + return sumRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name){ + return avgRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name){ + return minOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name){ + return maxOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name){ + return sumOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name){ + return avgOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public TypePlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public TypePlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public TypePlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public TypePlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public TypePlatformRequest 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 TypePlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..d97c5af41 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.scalartypeconformanceservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/model.xml b/examples/scalar-type-probe/json-profiles/PascalCase/model.xml new file mode 100644 index 000000000..3e50d4171 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/model.xml @@ -0,0 +1,39 @@ + + + + + + diff --git a/examples/scalar-type-probe/json-profiles/base-model.xml b/examples/scalar-type-probe/json-profiles/base-model.xml new file mode 100644 index 000000000..6fd6f2bc5 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/base-model.xml @@ -0,0 +1,39 @@ + + + + + + diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml b/examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml new file mode 100644 index 000000000..6f3d904d8 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + scalar-type-conformance-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 1.555-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.555-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/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java new file mode 100644 index 000000000..5ba171d6c --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; + +public interface Constants { + public static final long TYPE_PLATFORM_ID = 1l; + public static final TypePlatform TYPE_PLATFORM = TypePlatform.refer(TYPE_PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java new file mode 100644 index 000000000..124278a85 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java @@ -0,0 +1,18 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeExpression; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static TypePlatformExpression typePlatform(TypePlatform typePlatform){ + return new TypePlatformExpression(new ValueExpression(typePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.typePlatform()")); + } + public static ScalarTypeProbeExpression scalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new ScalarTypeProbeExpression(new ValueExpression(scalarTypeProbe, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.scalarTypeProbe()")); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java new file mode 100644 index 000000000..59b3f02e9 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -0,0 +1,617 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerTypePlatform(); + registerScalarTypeProbe(); + } + private void registerTypePlatform() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); + entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } + private void registerScalarTypeProbe() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); + entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY, Long.class) + ; + PropertyDescriptor typePlatform = + entityDescriptor.addObjectProperty($factory, com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class) + ; + PropertyDescriptor requiredString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY, String.class) + ; + PropertyDescriptor optionalString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, String.class) + ; + PropertyDescriptor largeText = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY, String.class) + ; + PropertyDescriptor requiredBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor optionalBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor requiredInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor optionalInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor requiredLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor optionalLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor requiredDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor optionalDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor requiredFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor optionalFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor requiredDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor optionalDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor requiredDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor optionalDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor requiredTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor optionalTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor requiredDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor optionalDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") + .with("isTime", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..27b2be578 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -0,0 +1,36 @@ +package com.example.scalartypeconformanceservice; + +/** 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.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .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("TypePlatform", 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("ScalarTypeProbe", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("type_platform", "typePlatform"), java.util.Map.entry("required_string", "requiredString"), java.util.Map.entry("optional_string", "optionalString"), java.util.Map.entry("large_text", "largeText"), java.util.Map.entry("required_boolean", "requiredBoolean"), java.util.Map.entry("optional_boolean", "optionalBoolean"), java.util.Map.entry("required_integer", "requiredInteger"), java.util.Map.entry("optional_integer", "optionalInteger"), java.util.Map.entry("required_long", "requiredLong"), java.util.Map.entry("optional_long", "optionalLong"), java.util.Map.entry("required_decimal", "requiredDecimal"), java.util.Map.entry("optional_decimal", "optionalDecimal"), java.util.Map.entry("required_float", "requiredFloat"), java.util.Map.entry("optional_float", "optionalFloat"), java.util.Map.entry("required_double", "requiredDouble"), java.util.Map.entry("optional_double", "optionalDouble"), java.util.Map.entry("required_date", "requiredDate"), java.util.Map.entry("optional_date", "optionalDate"), java.util.Map.entry("required_time", "requiredTime"), java.util.Map.entry("optional_time", "optionalTime"), java.util.Map.entry("required_datetime", "requiredDatetime"), java.util.Map.entry("optional_datetime", "optionalDatetime"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.typePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.scalartypeconformanceservice.typeplatform.TypePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.scalartypeconformanceservice.typeplatform.TypePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Scalar Type Conformance"); + domainRoot.auditAs("create generated Domain Root TypePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("TypePlatform", domainRoot.getId())); + } +} diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java new file mode 100644 index 000000000..9b6fc69cd --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatforms(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatformsWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbes(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbesWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java new file mode 100644 index 000000000..45450dfc0 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.UserContext; +public interface ScalarTypeConformanceServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java new file mode 100644 index 000000000..1e0717527 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -0,0 +1,544 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class ScalarTypeProbe extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "ScalarTypeProbe"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8d1d53171c01628f604255bcfa7e7d52b6260332cee701781027b0233eae926b"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("type_platform", 1), java.util.Map.entry("required_string", 2), java.util.Map.entry("optional_string", 3), java.util.Map.entry("large_text", 4), java.util.Map.entry("required_boolean", 5), java.util.Map.entry("optional_boolean", 6), java.util.Map.entry("required_integer", 7), java.util.Map.entry("optional_integer", 8), java.util.Map.entry("required_long", 9), java.util.Map.entry("optional_long", 10), java.util.Map.entry("required_decimal", 11), java.util.Map.entry("optional_decimal", 12), java.util.Map.entry("required_float", 13), java.util.Map.entry("optional_float", 14), java.util.Map.entry("required_double", 15), java.util.Map.entry("optional_double", 16), java.util.Map.entry("required_date", 17), java.util.Map.entry("optional_date", 18), java.util.Map.entry("required_time", 19), java.util.Map.entry("optional_time", 20), java.util.Map.entry("required_datetime", 21), java.util.Map.entry("optional_datetime", 22), java.util.Map.entry("create_time", 23), java.util.Map.entry("update_time", 24), java.util.Map.entry("version", 25)); + 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("type_platform", java.util.List.of("typePlatform", "type_platform")), java.util.Map.entry("required_string", java.util.List.of("requiredString", "required_string")), java.util.Map.entry("optional_string", java.util.List.of("optionalString", "optional_string")), java.util.Map.entry("large_text", java.util.List.of("largeText", "large_text")), java.util.Map.entry("required_boolean", java.util.List.of("requiredBoolean", "required_boolean")), java.util.Map.entry("optional_boolean", java.util.List.of("optionalBoolean", "optional_boolean")), java.util.Map.entry("required_integer", java.util.List.of("requiredInteger", "required_integer")), java.util.Map.entry("optional_integer", java.util.List.of("optionalInteger", "optional_integer")), java.util.Map.entry("required_long", java.util.List.of("requiredLong", "required_long")), java.util.Map.entry("optional_long", java.util.List.of("optionalLong", "optional_long")), java.util.Map.entry("required_decimal", java.util.List.of("requiredDecimal", "required_decimal")), java.util.Map.entry("optional_decimal", java.util.List.of("optionalDecimal", "optional_decimal")), java.util.Map.entry("required_float", java.util.List.of("requiredFloat", "required_float")), java.util.Map.entry("optional_float", java.util.List.of("optionalFloat", "optional_float")), java.util.Map.entry("required_double", java.util.List.of("requiredDouble", "required_double")), java.util.Map.entry("optional_double", java.util.List.of("optionalDouble", "optional_double")), java.util.Map.entry("required_date", java.util.List.of("requiredDate", "required_date")), java.util.Map.entry("optional_date", java.util.List.of("optionalDate", "optional_date")), java.util.Map.entry("required_time", java.util.List.of("requiredTime", "required_time")), java.util.Map.entry("optional_time", java.util.List.of("optionalTime", "optional_time")), java.util.Map.entry("required_datetime", java.util.List.of("requiredDatetime", "required_datetime")), java.util.Map.entry("optional_datetime", java.util.List.of("optionalDatetime", "optional_datetime")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + ScalarTypeProbe.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String TYPE_PLATFORM_PROPERTY = "type_platform"; + public static final String REQUIRED_STRING_PROPERTY = "required_string"; + public static final String OPTIONAL_STRING_PROPERTY = "optional_string"; + public static final String LARGE_TEXT_PROPERTY = "large_text"; + public static final String REQUIRED_BOOLEAN_PROPERTY = "required_boolean"; + public static final String OPTIONAL_BOOLEAN_PROPERTY = "optional_boolean"; + public static final String REQUIRED_INTEGER_PROPERTY = "required_integer"; + public static final String OPTIONAL_INTEGER_PROPERTY = "optional_integer"; + public static final String REQUIRED_LONG_PROPERTY = "required_long"; + public static final String OPTIONAL_LONG_PROPERTY = "optional_long"; + public static final String REQUIRED_DECIMAL_PROPERTY = "required_decimal"; + public static final String OPTIONAL_DECIMAL_PROPERTY = "optional_decimal"; + public static final String REQUIRED_FLOAT_PROPERTY = "required_float"; + public static final String OPTIONAL_FLOAT_PROPERTY = "optional_float"; + public static final String REQUIRED_DOUBLE_PROPERTY = "required_double"; + public static final String OPTIONAL_DOUBLE_PROPERTY = "optional_double"; + public static final String REQUIRED_DATE_PROPERTY = "required_date"; + public static final String OPTIONAL_DATE_PROPERTY = "optional_date"; + public static final String REQUIRED_TIME_PROPERTY = "required_time"; + public static final String OPTIONAL_TIME_PROPERTY = "optional_time"; + public static final String REQUIRED_DATETIME_PROPERTY = "required_datetime"; + public static final String OPTIONAL_DATETIME_PROPERTY = "optional_datetime"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private TypePlatform typePlatform; + + private String requiredString; + + private String optionalString; + + private String largeText; + + private Boolean requiredBoolean; + + private Boolean optionalBoolean; + + private Integer requiredInteger; + + private Integer optionalInteger; + + private Long requiredLong; + + private Long optionalLong; + + private BigDecimal requiredDecimal; + + private BigDecimal optionalDecimal; + + private Float requiredFloat; + + private Float optionalFloat; + + private Double requiredDouble; + + private Double optionalDouble; + + private LocalDate requiredDate; + + private LocalDate optionalDate; + + private LocalTime requiredTime; + + private LocalTime optionalTime; + + private LocalDateTime requiredDatetime; + + private LocalDateTime optionalDatetime; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public TypePlatform getTypePlatform(){ + return this.typePlatform; + } + + public String getRequiredString(){ + return this.requiredString; + } + + public String getOptionalString(){ + return this.optionalString; + } + + public String getLargeText(){ + return this.largeText; + } + + public Boolean isRequiredBoolean(){ + return this.requiredBoolean; + } + + public Boolean isOptionalBoolean(){ + return this.optionalBoolean; + } + + public Integer getRequiredInteger(){ + return this.requiredInteger; + } + + public Integer getOptionalInteger(){ + return this.optionalInteger; + } + + public Long getRequiredLong(){ + return this.requiredLong; + } + + public Long getOptionalLong(){ + return this.optionalLong; + } + + public BigDecimal getRequiredDecimal(){ + return this.requiredDecimal; + } + + public BigDecimal getOptionalDecimal(){ + return this.optionalDecimal; + } + + public Float getRequiredFloat(){ + return this.requiredFloat; + } + + public Float getOptionalFloat(){ + return this.optionalFloat; + } + + public Double getRequiredDouble(){ + return this.requiredDouble; + } + + public Double getOptionalDouble(){ + return this.optionalDouble; + } + + public LocalDate getRequiredDate(){ + return this.requiredDate; + } + + public LocalDate getOptionalDate(){ + return this.optionalDate; + } + + public LocalTime getRequiredTime(){ + return this.requiredTime; + } + + public LocalTime getOptionalTime(){ + return this.optionalTime; + } + + public LocalDateTime getRequiredDatetime(){ + return this.requiredDatetime; + } + + public LocalDateTime getOptionalDatetime(){ + return this.optionalDatetime; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public ScalarTypeProbe updateTypePlatform(TypePlatform typePlatform){ + if(isPropertyLoaded(TYPE_PLATFORM_PROPERTY) && Objects.equals(this.typePlatform, typePlatform)){ + return this; + } + handleUpdate(TYPE_PLATFORM_PROPERTY, getTypePlatform(), typePlatform); + this.typePlatform = typePlatform; + return this; + } + + public ScalarTypeProbe updateRequiredString(String requiredString){ + requiredString = (requiredString == null ? null : requiredString.trim()); + if(isPropertyLoaded(REQUIRED_STRING_PROPERTY) && Objects.equals(this.requiredString, requiredString)){ + return this; + } + handleUpdate(REQUIRED_STRING_PROPERTY, getRequiredString(), requiredString); + this.requiredString = requiredString; + return this; + } + + public ScalarTypeProbe updateOptionalString(String optionalString){ + optionalString = (optionalString == null ? null : optionalString.trim()); + if(isPropertyLoaded(OPTIONAL_STRING_PROPERTY) && Objects.equals(this.optionalString, optionalString)){ + return this; + } + handleUpdate(OPTIONAL_STRING_PROPERTY, getOptionalString(), optionalString); + this.optionalString = optionalString; + return this; + } + + public ScalarTypeProbe updateLargeText(String largeText){ + if(isPropertyLoaded(LARGE_TEXT_PROPERTY) && Objects.equals(this.largeText, largeText)){ + return this; + } + handleUpdate(LARGE_TEXT_PROPERTY, getLargeText(), largeText); + this.largeText = largeText; + return this; + } + + public ScalarTypeProbe updateRequiredBoolean(Boolean requiredBoolean){ + if(isPropertyLoaded(REQUIRED_BOOLEAN_PROPERTY) && Objects.equals(this.requiredBoolean, requiredBoolean)){ + return this; + } + handleUpdate(REQUIRED_BOOLEAN_PROPERTY, isRequiredBoolean(), requiredBoolean); + this.requiredBoolean = requiredBoolean; + return this; + } + + public ScalarTypeProbe updateOptionalBoolean(Boolean optionalBoolean){ + if(isPropertyLoaded(OPTIONAL_BOOLEAN_PROPERTY) && Objects.equals(this.optionalBoolean, optionalBoolean)){ + return this; + } + handleUpdate(OPTIONAL_BOOLEAN_PROPERTY, isOptionalBoolean(), optionalBoolean); + this.optionalBoolean = optionalBoolean; + return this; + } + + public ScalarTypeProbe updateRequiredInteger(Integer requiredInteger){ + if(isPropertyLoaded(REQUIRED_INTEGER_PROPERTY) && Objects.equals(this.requiredInteger, requiredInteger)){ + return this; + } + handleUpdate(REQUIRED_INTEGER_PROPERTY, getRequiredInteger(), requiredInteger); + this.requiredInteger = requiredInteger; + return this; + } + + public ScalarTypeProbe updateOptionalInteger(Integer optionalInteger){ + if(isPropertyLoaded(OPTIONAL_INTEGER_PROPERTY) && Objects.equals(this.optionalInteger, optionalInteger)){ + return this; + } + handleUpdate(OPTIONAL_INTEGER_PROPERTY, getOptionalInteger(), optionalInteger); + this.optionalInteger = optionalInteger; + return this; + } + + public ScalarTypeProbe updateRequiredLong(Long requiredLong){ + if(isPropertyLoaded(REQUIRED_LONG_PROPERTY) && Objects.equals(this.requiredLong, requiredLong)){ + return this; + } + handleUpdate(REQUIRED_LONG_PROPERTY, getRequiredLong(), requiredLong); + this.requiredLong = requiredLong; + return this; + } + + public ScalarTypeProbe updateOptionalLong(Long optionalLong){ + if(isPropertyLoaded(OPTIONAL_LONG_PROPERTY) && Objects.equals(this.optionalLong, optionalLong)){ + return this; + } + handleUpdate(OPTIONAL_LONG_PROPERTY, getOptionalLong(), optionalLong); + this.optionalLong = optionalLong; + return this; + } + + public ScalarTypeProbe updateRequiredDecimal(BigDecimal requiredDecimal){ + if(isPropertyLoaded(REQUIRED_DECIMAL_PROPERTY) && Objects.equals(this.requiredDecimal, requiredDecimal)){ + return this; + } + handleUpdate(REQUIRED_DECIMAL_PROPERTY, getRequiredDecimal(), requiredDecimal); + this.requiredDecimal = requiredDecimal; + return this; + } + + public ScalarTypeProbe updateOptionalDecimal(BigDecimal optionalDecimal){ + if(isPropertyLoaded(OPTIONAL_DECIMAL_PROPERTY) && Objects.equals(this.optionalDecimal, optionalDecimal)){ + return this; + } + handleUpdate(OPTIONAL_DECIMAL_PROPERTY, getOptionalDecimal(), optionalDecimal); + this.optionalDecimal = optionalDecimal; + return this; + } + + public ScalarTypeProbe updateRequiredFloat(Float requiredFloat){ + if(isPropertyLoaded(REQUIRED_FLOAT_PROPERTY) && Objects.equals(this.requiredFloat, requiredFloat)){ + return this; + } + handleUpdate(REQUIRED_FLOAT_PROPERTY, getRequiredFloat(), requiredFloat); + this.requiredFloat = requiredFloat; + return this; + } + + public ScalarTypeProbe updateOptionalFloat(Float optionalFloat){ + if(isPropertyLoaded(OPTIONAL_FLOAT_PROPERTY) && Objects.equals(this.optionalFloat, optionalFloat)){ + return this; + } + handleUpdate(OPTIONAL_FLOAT_PROPERTY, getOptionalFloat(), optionalFloat); + this.optionalFloat = optionalFloat; + return this; + } + + public ScalarTypeProbe updateRequiredDouble(Double requiredDouble){ + if(isPropertyLoaded(REQUIRED_DOUBLE_PROPERTY) && Objects.equals(this.requiredDouble, requiredDouble)){ + return this; + } + handleUpdate(REQUIRED_DOUBLE_PROPERTY, getRequiredDouble(), requiredDouble); + this.requiredDouble = requiredDouble; + return this; + } + + public ScalarTypeProbe updateOptionalDouble(Double optionalDouble){ + if(isPropertyLoaded(OPTIONAL_DOUBLE_PROPERTY) && Objects.equals(this.optionalDouble, optionalDouble)){ + return this; + } + handleUpdate(OPTIONAL_DOUBLE_PROPERTY, getOptionalDouble(), optionalDouble); + this.optionalDouble = optionalDouble; + return this; + } + + public ScalarTypeProbe updateRequiredDate(LocalDate requiredDate){ + if(isPropertyLoaded(REQUIRED_DATE_PROPERTY) && Objects.equals(this.requiredDate, requiredDate)){ + return this; + } + handleUpdate(REQUIRED_DATE_PROPERTY, getRequiredDate(), requiredDate); + this.requiredDate = requiredDate; + return this; + } + + public ScalarTypeProbe updateOptionalDate(LocalDate optionalDate){ + if(isPropertyLoaded(OPTIONAL_DATE_PROPERTY) && Objects.equals(this.optionalDate, optionalDate)){ + return this; + } + handleUpdate(OPTIONAL_DATE_PROPERTY, getOptionalDate(), optionalDate); + this.optionalDate = optionalDate; + return this; + } + + public ScalarTypeProbe updateRequiredTime(LocalTime requiredTime){ + if(isPropertyLoaded(REQUIRED_TIME_PROPERTY) && Objects.equals(this.requiredTime, requiredTime)){ + return this; + } + handleUpdate(REQUIRED_TIME_PROPERTY, getRequiredTime(), requiredTime); + this.requiredTime = requiredTime; + return this; + } + + public ScalarTypeProbe updateOptionalTime(LocalTime optionalTime){ + if(isPropertyLoaded(OPTIONAL_TIME_PROPERTY) && Objects.equals(this.optionalTime, optionalTime)){ + return this; + } + handleUpdate(OPTIONAL_TIME_PROPERTY, getOptionalTime(), optionalTime); + this.optionalTime = optionalTime; + return this; + } + + public ScalarTypeProbe updateRequiredDatetime(LocalDateTime requiredDatetime){ + if(isPropertyLoaded(REQUIRED_DATETIME_PROPERTY) && Objects.equals(this.requiredDatetime, requiredDatetime)){ + return this; + } + handleUpdate(REQUIRED_DATETIME_PROPERTY, getRequiredDatetime(), requiredDatetime); + this.requiredDatetime = requiredDatetime; + return this; + } + + public ScalarTypeProbe updateOptionalDatetime(LocalDateTime optionalDatetime){ + if(isPropertyLoaded(OPTIONAL_DATETIME_PROPERTY) && Objects.equals(this.optionalDatetime, optionalDatetime)){ + return this; + } + handleUpdate(OPTIONAL_DATETIME_PROPERTY, getOptionalDatetime(), optionalDatetime); + this.optionalDatetime = optionalDatetime; + return this; + } + + public ScalarTypeProbe updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public ScalarTypeProbe updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static ScalarTypeProbe refer(Long id){ + ScalarTypeProbe refer = new ScalarTypeProbe(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public ScalarTypeProbe 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 "type_platform": this.typePlatform = (TypePlatform) value; break; + + case "required_string": this.requiredString = (value == null ? null : ((String)value).trim()); break; + + case "optional_string": this.optionalString = (value == null ? null : ((String)value).trim()); break; + + case "large_text": this.largeText = (String) value; break; + + case "required_boolean": this.requiredBoolean = (Boolean) value; break; + + case "optional_boolean": this.optionalBoolean = (Boolean) value; break; + + case "required_integer": this.requiredInteger = (Integer) value; break; + + case "optional_integer": this.optionalInteger = (Integer) value; break; + + case "required_long": this.requiredLong = (Long) value; break; + + case "optional_long": this.optionalLong = (Long) value; break; + + case "required_decimal": this.requiredDecimal = (BigDecimal) value; break; + + case "optional_decimal": this.optionalDecimal = (BigDecimal) value; break; + + case "required_float": this.requiredFloat = (Float) value; break; + + case "optional_float": this.optionalFloat = (Float) value; break; + + case "required_double": this.requiredDouble = (Double) value; break; + + case "optional_double": this.optionalDouble = (Double) value; break; + + case "required_date": this.requiredDate = (LocalDate) value; break; + + case "optional_date": this.optionalDate = (LocalDate) value; break; + + case "required_time": this.requiredTime = (LocalTime) value; break; + + case "optional_time": this.optionalTime = (LocalTime) value; break; + + case "required_datetime": this.requiredDatetime = (LocalDateTime) value; break; + + case "optional_datetime": this.optionalDatetime = (LocalDateTime) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "type_platform": return this.typePlatform; + case "required_string": return this.requiredString; + case "optional_string": return this.optionalString; + case "large_text": return this.largeText; + case "required_boolean": return this.requiredBoolean; + case "optional_boolean": return this.optionalBoolean; + case "required_integer": return this.requiredInteger; + case "optional_integer": return this.optionalInteger; + case "required_long": return this.requiredLong; + case "optional_long": return this.optionalLong; + case "required_decimal": return this.requiredDecimal; + case "optional_decimal": return this.optionalDecimal; + case "required_float": return this.requiredFloat; + case "optional_float": return this.optionalFloat; + case "required_double": return this.requiredDouble; + case "optional_double": return this.optionalDouble; + case "required_date": return this.requiredDate; + case "optional_date": return this.optionalDate; + case "required_time": return this.requiredTime; + case "optional_time": return this.optionalTime; + case "required_datetime": return this.requiredDatetime; + case "optional_datetime": return this.optionalDatetime; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java new file mode 100644 index 000000000..3ad70ad88 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -0,0 +1,282 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class ScalarTypeProbeChecker implements Checker{ + + public String type(){ + return ScalarTypeProbe.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if(needCheck(_context, scalarTypeProbe)){ + markAsChecked(_context, scalarTypeProbe); + doCheck(_context, scalarTypeProbe, _parentLocation); + } + } + + public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if((scalarTypeProbe == null)){ + return; + } + if(scalarTypeProbe.needPersist()){ + } + if(scalarTypeProbe.newItem()){ + if(scalarTypeProbe.getCreateTime() == null){ + scalarTypeProbe.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + }if(scalarTypeProbe.getUpdateTime() == null){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + } + }else if(scalarTypeProbe.updateItem()){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("large_text")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "large_text"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkTypePlatform(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY), newLocation(_parentLocation, "type_platform")); + checkRequiredString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY), newLocation(_parentLocation, "required_string")); + checkOptionalString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY), newLocation(_parentLocation, "optional_string")); + checkLargeText(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY), newLocation(_parentLocation, "large_text")); + checkRequiredBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY), newLocation(_parentLocation, "required_boolean")); + checkOptionalBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY), newLocation(_parentLocation, "optional_boolean")); + checkRequiredInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY), newLocation(_parentLocation, "required_integer")); + checkOptionalInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY), newLocation(_parentLocation, "optional_integer")); + checkRequiredLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY), newLocation(_parentLocation, "required_long")); + checkOptionalLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY), newLocation(_parentLocation, "optional_long")); + checkRequiredDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY), newLocation(_parentLocation, "required_decimal")); + checkOptionalDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY), newLocation(_parentLocation, "optional_decimal")); + checkRequiredFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY), newLocation(_parentLocation, "required_float")); + checkOptionalFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY), newLocation(_parentLocation, "optional_float")); + checkRequiredDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY), newLocation(_parentLocation, "required_double")); + checkOptionalDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY), newLocation(_parentLocation, "optional_double")); + checkRequiredDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY), newLocation(_parentLocation, "required_date")); + checkOptionalDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY), newLocation(_parentLocation, "optional_date")); + checkRequiredTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY), newLocation(_parentLocation, "required_time")); + checkOptionalTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY), newLocation(_parentLocation, "optional_time")); + checkRequiredDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY), newLocation(_parentLocation, "required_datetime")); + checkOptionalDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY), newLocation(_parentLocation, "optional_datetime")); + checkCreateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkTypePlatform(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, typePlatform); + if((typePlatform == null)){ + return; + } + new TypePlatformChecker().checkAndFix(_context, typePlatform, _parentLocation); + } + public void checkRequiredString(UserContext _context, String requiredString, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredString); + if((requiredString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, requiredString); + + } + public void checkOptionalString(UserContext _context, String optionalString, ObjectLocation _parentLocation){ + if((optionalString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, optionalString); + + } + public void checkLargeText(UserContext _context, String largeText, ObjectLocation _parentLocation){ + if((largeText == null)){ + return; + } + } + public void checkRequiredBoolean(UserContext _context, Boolean requiredBoolean, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredBoolean); + if((requiredBoolean == null)){ + return; + } + } + public void checkOptionalBoolean(UserContext _context, Boolean optionalBoolean, ObjectLocation _parentLocation){ + if((optionalBoolean == null)){ + return; + } + } + public void checkRequiredInteger(UserContext _context, Integer requiredInteger, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredInteger); + if((requiredInteger == null)){ + return; + } + } + public void checkOptionalInteger(UserContext _context, Integer optionalInteger, ObjectLocation _parentLocation){ + if((optionalInteger == null)){ + return; + } + } + public void checkRequiredLong(UserContext _context, Long requiredLong, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredLong); + if((requiredLong == null)){ + return; + } + } + public void checkOptionalLong(UserContext _context, Long optionalLong, ObjectLocation _parentLocation){ + if((optionalLong == null)){ + return; + } + } + public void checkRequiredDecimal(UserContext _context, BigDecimal requiredDecimal, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDecimal); + if((requiredDecimal == null)){ + return; + } + } + public void checkOptionalDecimal(UserContext _context, BigDecimal optionalDecimal, ObjectLocation _parentLocation){ + if((optionalDecimal == null)){ + return; + } + } + public void checkRequiredFloat(UserContext _context, Float requiredFloat, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredFloat); + if((requiredFloat == null)){ + return; + } + } + public void checkOptionalFloat(UserContext _context, Float optionalFloat, ObjectLocation _parentLocation){ + if((optionalFloat == null)){ + return; + } + } + public void checkRequiredDouble(UserContext _context, Double requiredDouble, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDouble); + if((requiredDouble == null)){ + return; + } + } + public void checkOptionalDouble(UserContext _context, Double optionalDouble, ObjectLocation _parentLocation){ + if((optionalDouble == null)){ + return; + } + } + public void checkRequiredDate(UserContext _context, LocalDate requiredDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDate); + if((requiredDate == null)){ + return; + } + } + public void checkOptionalDate(UserContext _context, LocalDate optionalDate, ObjectLocation _parentLocation){ + if((optionalDate == null)){ + return; + } + } + public void checkRequiredTime(UserContext _context, LocalTime requiredTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredTime); + if((requiredTime == null)){ + return; + } + } + public void checkOptionalTime(UserContext _context, LocalTime optionalTime, ObjectLocation _parentLocation){ + if((optionalTime == null)){ + return; + } + } + public void checkRequiredDatetime(UserContext _context, LocalDateTime requiredDatetime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDatetime); + if((requiredDatetime == null)){ + return; + } + } + public void checkOptionalDatetime(UserContext _context, LocalDateTime optionalDatetime, ObjectLocation _parentLocation){ + if((optionalDatetime == null)){ + return; + } + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java new file mode 100644 index 000000000..4ff37872d --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java @@ -0,0 +1,211 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.function.Function; + +public class ScalarTypeProbeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public ScalarTypeProbeExpression(Expression expression){ + super(expression); + } + + public ScalarTypeProbeExpression(Expression expression, Function function){ + super(expression, function); + } + + public ScalarTypeProbeExpression updateId(Long id){ + return new ScalarTypeProbeExpression(this, $it -> {((ScalarTypeProbe)$it).__internalSet("id", id); return this;}); + } + + public ScalarTypeProbeExpression save(UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs("Saved by Expression").save(userContext)); + } + + public ScalarTypeProbeExpression save(String intent, UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public TypePlatformExpression getTypePlatform(){ + return new TypePlatformExpression(loaded("type_platform", "getTypePlatform", ScalarTypeProbe::getTypePlatform)); + } + + public ScalarTypeProbeExpression updateTypePlatform(TypePlatform typePlatform){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateTypePlatform(typePlatform)); + } + + public Expression getRequiredString(){ + return loaded("required_string", "getRequiredString", ScalarTypeProbe::getRequiredString); + } + public ScalarTypeProbeExpression updateRequiredString(String requiredString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredString(requiredString)); + } + + public Expression getOptionalString(){ + return loaded("optional_string", "getOptionalString", ScalarTypeProbe::getOptionalString); + } + public ScalarTypeProbeExpression updateOptionalString(String optionalString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalString(optionalString)); + } + + public Expression getLargeText(){ + return loaded("large_text", "getLargeText", ScalarTypeProbe::getLargeText); + } + public ScalarTypeProbeExpression updateLargeText(String largeText){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateLargeText(largeText)); + } + + public Expression isRequiredBoolean(){ + return loaded("required_boolean", "isRequiredBoolean", ScalarTypeProbe::isRequiredBoolean); + } + public ScalarTypeProbeExpression updateRequiredBoolean(Boolean requiredBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredBoolean(requiredBoolean)); + } + + public Expression isOptionalBoolean(){ + return loaded("optional_boolean", "isOptionalBoolean", ScalarTypeProbe::isOptionalBoolean); + } + public ScalarTypeProbeExpression updateOptionalBoolean(Boolean optionalBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalBoolean(optionalBoolean)); + } + + public Expression getRequiredInteger(){ + return loaded("required_integer", "getRequiredInteger", ScalarTypeProbe::getRequiredInteger); + } + public ScalarTypeProbeExpression updateRequiredInteger(Integer requiredInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredInteger(requiredInteger)); + } + + public Expression getOptionalInteger(){ + return loaded("optional_integer", "getOptionalInteger", ScalarTypeProbe::getOptionalInteger); + } + public ScalarTypeProbeExpression updateOptionalInteger(Integer optionalInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalInteger(optionalInteger)); + } + + public Expression getRequiredLong(){ + return loaded("required_long", "getRequiredLong", ScalarTypeProbe::getRequiredLong); + } + public ScalarTypeProbeExpression updateRequiredLong(Long requiredLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredLong(requiredLong)); + } + + public Expression getOptionalLong(){ + return loaded("optional_long", "getOptionalLong", ScalarTypeProbe::getOptionalLong); + } + public ScalarTypeProbeExpression updateOptionalLong(Long optionalLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalLong(optionalLong)); + } + + public Expression getRequiredDecimal(){ + return loaded("required_decimal", "getRequiredDecimal", ScalarTypeProbe::getRequiredDecimal); + } + public ScalarTypeProbeExpression updateRequiredDecimal(BigDecimal requiredDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDecimal(requiredDecimal)); + } + + public Expression getOptionalDecimal(){ + return loaded("optional_decimal", "getOptionalDecimal", ScalarTypeProbe::getOptionalDecimal); + } + public ScalarTypeProbeExpression updateOptionalDecimal(BigDecimal optionalDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDecimal(optionalDecimal)); + } + + public Expression getRequiredFloat(){ + return loaded("required_float", "getRequiredFloat", ScalarTypeProbe::getRequiredFloat); + } + public ScalarTypeProbeExpression updateRequiredFloat(Float requiredFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredFloat(requiredFloat)); + } + + public Expression getOptionalFloat(){ + return loaded("optional_float", "getOptionalFloat", ScalarTypeProbe::getOptionalFloat); + } + public ScalarTypeProbeExpression updateOptionalFloat(Float optionalFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalFloat(optionalFloat)); + } + + public Expression getRequiredDouble(){ + return loaded("required_double", "getRequiredDouble", ScalarTypeProbe::getRequiredDouble); + } + public ScalarTypeProbeExpression updateRequiredDouble(Double requiredDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDouble(requiredDouble)); + } + + public Expression getOptionalDouble(){ + return loaded("optional_double", "getOptionalDouble", ScalarTypeProbe::getOptionalDouble); + } + public ScalarTypeProbeExpression updateOptionalDouble(Double optionalDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDouble(optionalDouble)); + } + + public Expression getRequiredDate(){ + return loaded("required_date", "getRequiredDate", ScalarTypeProbe::getRequiredDate); + } + public ScalarTypeProbeExpression updateRequiredDate(LocalDate requiredDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDate(requiredDate)); + } + + public Expression getOptionalDate(){ + return loaded("optional_date", "getOptionalDate", ScalarTypeProbe::getOptionalDate); + } + public ScalarTypeProbeExpression updateOptionalDate(LocalDate optionalDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDate(optionalDate)); + } + + public Expression getRequiredTime(){ + return loaded("required_time", "getRequiredTime", ScalarTypeProbe::getRequiredTime); + } + public ScalarTypeProbeExpression updateRequiredTime(LocalTime requiredTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredTime(requiredTime)); + } + + public Expression getOptionalTime(){ + return loaded("optional_time", "getOptionalTime", ScalarTypeProbe::getOptionalTime); + } + public ScalarTypeProbeExpression updateOptionalTime(LocalTime optionalTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalTime(optionalTime)); + } + + public Expression getRequiredDatetime(){ + return loaded("required_datetime", "getRequiredDatetime", ScalarTypeProbe::getRequiredDatetime); + } + public ScalarTypeProbeExpression updateRequiredDatetime(LocalDateTime requiredDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDatetime(requiredDatetime)); + } + + public Expression getOptionalDatetime(){ + return loaded("optional_datetime", "getOptionalDatetime", ScalarTypeProbe::getOptionalDatetime); + } + public ScalarTypeProbeExpression updateOptionalDatetime(LocalDateTime optionalDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDatetime(optionalDatetime)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", ScalarTypeProbe::getCreateTime); + } + public ScalarTypeProbeExpression updateCreateTime(LocalDateTime createTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", ScalarTypeProbe::getUpdateTime); + } + public ScalarTypeProbeExpression updateUpdateTime(LocalDateTime updateTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java new file mode 100644 index 000000000..8f2542a82 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class ScalarTypeProbeListExpression extends SmartListExpression { + public ScalarTypeProbeListExpression(Expression> expression){ + super(expression); + } + + public ScalarTypeProbeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public ScalarTypeProbeExpression first() { + return new ScalarTypeProbeExpression(super.first()); + } + + public ScalarTypeProbeExpression get(int index) { + return new ScalarTypeProbeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java new file mode 100644 index 000000000..6a60aaedd --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -0,0 +1,3766 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; + +public class ScalarTypeProbeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest(Class returnType){ + this(returnType, () -> (T) new ScalarTypeProbe()); + } + + protected ScalarTypeProbeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public ScalarTypeProbeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public ScalarTypeProbeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public ScalarTypeProbeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public ScalarTypeProbeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public ScalarTypeProbeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (ScalarTypeProbeRequest)super.appendSearchCriteria(searchCriteria); + } + + public ScalarTypeProbeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarTypeProbe){ + super.internalMatchAny(scalarTypeProbe); + return this; + } + + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public ScalarTypeProbeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public ScalarTypeProbeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public ScalarTypeProbeRequest selectSelf(){ + super.selectSelf(); + return selectId().selectTypePlatformIdOnly().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectSelfFields(){ + return selectSelf(); + } + + public ScalarTypeProbeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(ScalarTypeProbe.ID_PROPERTY); + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectAll(){ + super.selectAll(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectChildren(){ + super.selectAny(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public ScalarTypeProbeRequest selectId(){ + selectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectId(){ + unselectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectTypePlatformIdOnly(){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectTypePlatform(){ + return selectTypePlatformWith(Q.typePlatforms().unlimited().selectSelf()); + } + + public ScalarTypeProbeRequest selectTypePlatformWith(TypePlatformRequest typePlatform){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + enhanceRelation(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTypePlatformWith", null, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + public ScalarTypeProbeRequest unselectTypePlatform(){ + unselectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredString(){ + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + /** + * fill the requiredString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredString) to fetch requiredString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredString(){ + unselectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalString(){ + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + /** + * fill the optionalString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalString) to fetch optionalString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalString(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectLargeText(){ + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + /** + * fill the largeText with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS largeText) to fetch largeText property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectLargeText(){ + unselectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredBoolean(){ + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the requiredBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredBoolean) to fetch requiredBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredBoolean(){ + unselectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalBoolean(){ + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the optionalBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalBoolean) to fetch optionalBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalBoolean(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredInteger(){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + /** + * fill the requiredInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredInteger) to fetch requiredInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredInteger) AS requiredInteger to fetch requiredInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredInteger(){ + unselectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalInteger(){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + /** + * fill the optionalInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalInteger) to fetch optionalInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalInteger) AS optionalInteger to fetch optionalInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalInteger(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredLong(){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + /** + * fill the requiredLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredLong) to fetch requiredLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredLong with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredLong) AS requiredLong to fetch requiredLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredLong(){ + unselectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalLong(){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + /** + * fill the optionalLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalLong) to fetch optionalLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalLong with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalLong) AS optionalLong to fetch optionalLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalLong(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDecimal(){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the requiredDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDecimal) to fetch requiredDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDecimal) AS requiredDecimal to fetch requiredDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDecimal(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDecimal(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the optionalDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDecimal) to fetch optionalDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDecimal) AS optionalDecimal to fetch optionalDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDecimal(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredFloat(){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + /** + * fill the requiredFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredFloat) to fetch requiredFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredFloat) AS requiredFloat to fetch requiredFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredFloat(){ + unselectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalFloat(){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + /** + * fill the optionalFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalFloat) to fetch optionalFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalFloat) AS optionalFloat to fetch optionalFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalFloat(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDouble(){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the requiredDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDouble) to fetch requiredDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDouble) AS requiredDouble to fetch requiredDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDouble(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDouble(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the optionalDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDouble) to fetch optionalDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDouble) AS optionalDouble to fetch optionalDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDouble(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDate(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + /** + * fill the requiredDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDate) to fetch requiredDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDate(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDate(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + /** + * fill the optionalDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDate) to fetch optionalDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDate(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredTime(){ + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + /** + * fill the requiredTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredTime) to fetch requiredTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredTime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalTime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + /** + * fill the optionalTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalTime) to fetch optionalTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalTime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDatetime(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + /** + * fill the requiredDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDatetime) to fetch requiredDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDatetime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDatetime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + /** + * fill the optionalDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDatetime) to fetch optionalDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDatetime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectCreateTime(){ + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectCreateTime(){ + unselectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectUpdateTime(){ + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectUpdateTime(){ + unselectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectVersion(){ + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectVersion(){ + unselectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.ID_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public ScalarTypeProbeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public ScalarTypeProbeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public ScalarTypeProbeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public ScalarTypeProbeRequest filterByTypePlatform(TypePlatform... typePlatform){ + if (typePlatform == null || typePlatform.length == 0) { + throw new IllegalArgumentException("filterByTypePlatform parameter typePlatform cannot be empty"); + } + return appendSearchCriteria(createTypePlatformCriteria(Operator.EQUAL, (Object[])typePlatform)); + } + + public ScalarTypeProbeRequest withTypePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createTypePlatformCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withTypePlatformIsUnknown(){ + return withTypePlatform(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withTypePlatformIsKnown(){ + return withTypePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTypePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest filterByTypePlatform(Long typePlatform){ + if(typePlatform == null){ + return this; + } + return withTypePlatform(Operator.EQUAL, typePlatform); + } + public ScalarTypeProbeRequest withTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY)); + } + + public ScalarTypeProbeRequest withoutTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY))); + } + + public ScalarTypeProbeRequest filterByRequiredString(String... requiredString){ + if (requiredString == null || requiredString.length == 0) { + throw new IllegalArgumentException("filterByRequiredString parameter requiredString cannot be empty"); + } + return appendSearchCriteria(createRequiredStringCriteria(Operator.EQUAL, (Object[])requiredString)); + } + + public ScalarTypeProbeRequest withRequiredString(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredStringIsUnknown(){ + return withRequiredString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredStringIsKnown(){ + return withRequiredString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredStringIsNot(String requiredString){ + return withRequiredString(Operator.NOT_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIn(String... requiredString){ + return withRequiredString(Operator.IN, (Object[])requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotIn(String... requiredString){ + return withRequiredString(Operator.NOT_IN, (Object[])requiredString); + } + public ScalarTypeProbeRequest withRequiredStringGreaterThan(String requiredString){ + return withRequiredString(Operator.GREATER_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringGreaterThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.GREATER_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThan(String requiredString){ + return withRequiredString(Operator.LESS_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.LESS_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringBetween(String startOfRequiredString, String endOfRequiredString){ + return withRequiredString(Operator.BETWEEN, startOfRequiredString, endOfRequiredString); + } + public ScalarTypeProbeRequest withRequiredStringStartingWith(String requiredString){ + return withRequiredString(Operator.BEGIN_WITH, requiredString); + } + public ScalarTypeProbeRequest withRequiredStringContaining(String requiredString){ + return withRequiredString(Operator.CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotContaining(String requiredString){ + return withRequiredString(Operator.NOT_CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotStartingWith(String requiredString){ + return withRequiredString(Operator.NOT_BEGIN_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringEndingWith(String requiredString){ + return withRequiredString(Operator.END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotEndingWith(String requiredString){ + return withRequiredString(Operator.NOT_END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIs(String requiredString){ + return withRequiredString(Operator.EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringSoundingLike(String requiredString){ + return withRequiredString(Operator.SOUNDS_LIKE, requiredString); + } + + + + public ScalarTypeProbeRequest filterByOptionalString(String... optionalString){ + if (optionalString == null || optionalString.length == 0) { + throw new IllegalArgumentException("filterByOptionalString parameter optionalString cannot be empty"); + } + return appendSearchCriteria(createOptionalStringCriteria(Operator.EQUAL, (Object[])optionalString)); + } + + public ScalarTypeProbeRequest withOptionalString(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalStringIsUnknown(){ + return withOptionalString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalStringIsKnown(){ + return withOptionalString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalStringIsNot(String optionalString){ + return withOptionalString(Operator.NOT_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIn(String... optionalString){ + return withOptionalString(Operator.IN, (Object[])optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotIn(String... optionalString){ + return withOptionalString(Operator.NOT_IN, (Object[])optionalString); + } + public ScalarTypeProbeRequest withOptionalStringGreaterThan(String optionalString){ + return withOptionalString(Operator.GREATER_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringGreaterThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.GREATER_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThan(String optionalString){ + return withOptionalString(Operator.LESS_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.LESS_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringBetween(String startOfOptionalString, String endOfOptionalString){ + return withOptionalString(Operator.BETWEEN, startOfOptionalString, endOfOptionalString); + } + public ScalarTypeProbeRequest withOptionalStringStartingWith(String optionalString){ + return withOptionalString(Operator.BEGIN_WITH, optionalString); + } + public ScalarTypeProbeRequest withOptionalStringContaining(String optionalString){ + return withOptionalString(Operator.CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotContaining(String optionalString){ + return withOptionalString(Operator.NOT_CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotStartingWith(String optionalString){ + return withOptionalString(Operator.NOT_BEGIN_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringEndingWith(String optionalString){ + return withOptionalString(Operator.END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotEndingWith(String optionalString){ + return withOptionalString(Operator.NOT_END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIs(String optionalString){ + return withOptionalString(Operator.EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringSoundingLike(String optionalString){ + return withOptionalString(Operator.SOUNDS_LIKE, optionalString); + } + + + + public ScalarTypeProbeRequest filterByLargeText(String... largeText){ + if (largeText == null || largeText.length == 0) { + throw new IllegalArgumentException("filterByLargeText parameter largeText cannot be empty"); + } + return appendSearchCriteria(createLargeTextCriteria(Operator.EQUAL, (Object[])largeText)); + } + + public ScalarTypeProbeRequest withLargeText(Operator operator, Object... values){ + return appendSearchCriteria(createLargeTextCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withLargeTextIsUnknown(){ + return withLargeText(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withLargeTextIsKnown(){ + return withLargeText(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLargeTextCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.LARGE_TEXT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withLargeTextIsNot(String largeText){ + return withLargeText(Operator.NOT_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextIn(String... largeText){ + return withLargeText(Operator.IN, (Object[])largeText); + } + + public ScalarTypeProbeRequest withLargeTextNotIn(String... largeText){ + return withLargeText(Operator.NOT_IN, (Object[])largeText); + } + public ScalarTypeProbeRequest withLargeTextGreaterThan(String largeText){ + return withLargeText(Operator.GREATER_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextGreaterThanOrEqualTo(String largeText){ + return withLargeText(Operator.GREATER_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThan(String largeText){ + return withLargeText(Operator.LESS_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThanOrEqualTo(String largeText){ + return withLargeText(Operator.LESS_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextBetween(String startOfLargeText, String endOfLargeText){ + return withLargeText(Operator.BETWEEN, startOfLargeText, endOfLargeText); + } + public ScalarTypeProbeRequest withLargeTextIs(String largeText){ + return withLargeText(Operator.EQUAL, largeText); + } + + + + public ScalarTypeProbeRequest filterByRequiredBoolean(Boolean... requiredBoolean){ + if (requiredBoolean == null || requiredBoolean.length == 0) { + throw new IllegalArgumentException("filterByRequiredBoolean parameter requiredBoolean cannot be empty"); + } + return appendSearchCriteria(createRequiredBooleanCriteria(Operator.EQUAL, (Object[])requiredBoolean)); + } + + public ScalarTypeProbeRequest withRequiredBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsUnknown(){ + return withRequiredBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsKnown(){ + return withRequiredBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByOptionalBoolean(Boolean... optionalBoolean){ + if (optionalBoolean == null || optionalBoolean.length == 0) { + throw new IllegalArgumentException("filterByOptionalBoolean parameter optionalBoolean cannot be empty"); + } + return appendSearchCriteria(createOptionalBooleanCriteria(Operator.EQUAL, (Object[])optionalBoolean)); + } + + public ScalarTypeProbeRequest withOptionalBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsUnknown(){ + return withOptionalBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsKnown(){ + return withOptionalBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByRequiredInteger(Integer... requiredInteger){ + if (requiredInteger == null || requiredInteger.length == 0) { + throw new IllegalArgumentException("filterByRequiredInteger parameter requiredInteger cannot be empty"); + } + return appendSearchCriteria(createRequiredIntegerCriteria(Operator.EQUAL, (Object[])requiredInteger)); + } + + public ScalarTypeProbeRequest withRequiredInteger(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsUnknown(){ + return withRequiredInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsKnown(){ + return withRequiredInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredIntegerIs(Integer requiredInteger){ + return withRequiredInteger(Operator.EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsNot(Integer requiredInteger){ + return withRequiredInteger(Operator.NOT_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.IN, (Object[])requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerNotIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.NOT_IN, (Object[])requiredInteger); + } + public ScalarTypeProbeRequest withRequiredIntegerGreaterThan(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerGreaterThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThan(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerBetween(Integer startOfRequiredInteger, Integer endOfRequiredInteger){ + return withRequiredInteger(Operator.BETWEEN, startOfRequiredInteger, endOfRequiredInteger); + } + + + + public ScalarTypeProbeRequest filterByOptionalInteger(Integer... optionalInteger){ + if (optionalInteger == null || optionalInteger.length == 0) { + throw new IllegalArgumentException("filterByOptionalInteger parameter optionalInteger cannot be empty"); + } + return appendSearchCriteria(createOptionalIntegerCriteria(Operator.EQUAL, (Object[])optionalInteger)); + } + + public ScalarTypeProbeRequest withOptionalInteger(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsUnknown(){ + return withOptionalInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsKnown(){ + return withOptionalInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalIntegerIs(Integer optionalInteger){ + return withOptionalInteger(Operator.EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsNot(Integer optionalInteger){ + return withOptionalInteger(Operator.NOT_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.IN, (Object[])optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerNotIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.NOT_IN, (Object[])optionalInteger); + } + public ScalarTypeProbeRequest withOptionalIntegerGreaterThan(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerGreaterThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThan(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerBetween(Integer startOfOptionalInteger, Integer endOfOptionalInteger){ + return withOptionalInteger(Operator.BETWEEN, startOfOptionalInteger, endOfOptionalInteger); + } + + + + public ScalarTypeProbeRequest filterByRequiredLong(Long... requiredLong){ + if (requiredLong == null || requiredLong.length == 0) { + throw new IllegalArgumentException("filterByRequiredLong parameter requiredLong cannot be empty"); + } + return appendSearchCriteria(createRequiredLongCriteria(Operator.EQUAL, (Object[])requiredLong)); + } + + public ScalarTypeProbeRequest withRequiredLong(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredLongIsUnknown(){ + return withRequiredLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredLongIsKnown(){ + return withRequiredLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredLongIs(Long requiredLong){ + return withRequiredLong(Operator.EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIsNot(Long requiredLong){ + return withRequiredLong(Operator.NOT_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIn(Long... requiredLong){ + return withRequiredLong(Operator.IN, (Object[])requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongNotIn(Long... requiredLong){ + return withRequiredLong(Operator.NOT_IN, (Object[])requiredLong); + } + public ScalarTypeProbeRequest withRequiredLongGreaterThan(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongGreaterThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThan(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongBetween(Long startOfRequiredLong, Long endOfRequiredLong){ + return withRequiredLong(Operator.BETWEEN, startOfRequiredLong, endOfRequiredLong); + } + + + + public ScalarTypeProbeRequest filterByOptionalLong(Long... optionalLong){ + if (optionalLong == null || optionalLong.length == 0) { + throw new IllegalArgumentException("filterByOptionalLong parameter optionalLong cannot be empty"); + } + return appendSearchCriteria(createOptionalLongCriteria(Operator.EQUAL, (Object[])optionalLong)); + } + + public ScalarTypeProbeRequest withOptionalLong(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalLongIsUnknown(){ + return withOptionalLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalLongIsKnown(){ + return withOptionalLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalLongIs(Long optionalLong){ + return withOptionalLong(Operator.EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIsNot(Long optionalLong){ + return withOptionalLong(Operator.NOT_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIn(Long... optionalLong){ + return withOptionalLong(Operator.IN, (Object[])optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongNotIn(Long... optionalLong){ + return withOptionalLong(Operator.NOT_IN, (Object[])optionalLong); + } + public ScalarTypeProbeRequest withOptionalLongGreaterThan(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongGreaterThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThan(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongBetween(Long startOfOptionalLong, Long endOfOptionalLong){ + return withOptionalLong(Operator.BETWEEN, startOfOptionalLong, endOfOptionalLong); + } + + + + public ScalarTypeProbeRequest filterByRequiredDecimal(BigDecimal... requiredDecimal){ + if (requiredDecimal == null || requiredDecimal.length == 0) { + throw new IllegalArgumentException("filterByRequiredDecimal parameter requiredDecimal cannot be empty"); + } + return appendSearchCriteria(createRequiredDecimalCriteria(Operator.EQUAL, (Object[])requiredDecimal)); + } + + public ScalarTypeProbeRequest withRequiredDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsUnknown(){ + return withRequiredDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsKnown(){ + return withRequiredDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDecimalIs(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsNot(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.NOT_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.IN, (Object[])requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalNotIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.NOT_IN, (Object[])requiredDecimal); + } + public ScalarTypeProbeRequest withRequiredDecimalGreaterThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalGreaterThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalBetween(BigDecimal startOfRequiredDecimal, BigDecimal endOfRequiredDecimal){ + return withRequiredDecimal(Operator.BETWEEN, startOfRequiredDecimal, endOfRequiredDecimal); + } + + + + public ScalarTypeProbeRequest filterByOptionalDecimal(BigDecimal... optionalDecimal){ + if (optionalDecimal == null || optionalDecimal.length == 0) { + throw new IllegalArgumentException("filterByOptionalDecimal parameter optionalDecimal cannot be empty"); + } + return appendSearchCriteria(createOptionalDecimalCriteria(Operator.EQUAL, (Object[])optionalDecimal)); + } + + public ScalarTypeProbeRequest withOptionalDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsUnknown(){ + return withOptionalDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsKnown(){ + return withOptionalDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDecimalIs(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsNot(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.NOT_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.IN, (Object[])optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalNotIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.NOT_IN, (Object[])optionalDecimal); + } + public ScalarTypeProbeRequest withOptionalDecimalGreaterThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalGreaterThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalBetween(BigDecimal startOfOptionalDecimal, BigDecimal endOfOptionalDecimal){ + return withOptionalDecimal(Operator.BETWEEN, startOfOptionalDecimal, endOfOptionalDecimal); + } + + + + public ScalarTypeProbeRequest filterByRequiredFloat(Float... requiredFloat){ + if (requiredFloat == null || requiredFloat.length == 0) { + throw new IllegalArgumentException("filterByRequiredFloat parameter requiredFloat cannot be empty"); + } + return appendSearchCriteria(createRequiredFloatCriteria(Operator.EQUAL, (Object[])requiredFloat)); + } + + public ScalarTypeProbeRequest withRequiredFloat(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredFloatIsUnknown(){ + return withRequiredFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredFloatIsKnown(){ + return withRequiredFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredFloatIs(Float requiredFloat){ + return withRequiredFloat(Operator.EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIsNot(Float requiredFloat){ + return withRequiredFloat(Operator.NOT_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIn(Float... requiredFloat){ + return withRequiredFloat(Operator.IN, (Object[])requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatNotIn(Float... requiredFloat){ + return withRequiredFloat(Operator.NOT_IN, (Object[])requiredFloat); + } + public ScalarTypeProbeRequest withRequiredFloatGreaterThan(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatGreaterThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThan(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatBetween(Float startOfRequiredFloat, Float endOfRequiredFloat){ + return withRequiredFloat(Operator.BETWEEN, startOfRequiredFloat, endOfRequiredFloat); + } + + + + public ScalarTypeProbeRequest filterByOptionalFloat(Float... optionalFloat){ + if (optionalFloat == null || optionalFloat.length == 0) { + throw new IllegalArgumentException("filterByOptionalFloat parameter optionalFloat cannot be empty"); + } + return appendSearchCriteria(createOptionalFloatCriteria(Operator.EQUAL, (Object[])optionalFloat)); + } + + public ScalarTypeProbeRequest withOptionalFloat(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalFloatIsUnknown(){ + return withOptionalFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalFloatIsKnown(){ + return withOptionalFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalFloatIs(Float optionalFloat){ + return withOptionalFloat(Operator.EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIsNot(Float optionalFloat){ + return withOptionalFloat(Operator.NOT_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIn(Float... optionalFloat){ + return withOptionalFloat(Operator.IN, (Object[])optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatNotIn(Float... optionalFloat){ + return withOptionalFloat(Operator.NOT_IN, (Object[])optionalFloat); + } + public ScalarTypeProbeRequest withOptionalFloatGreaterThan(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatGreaterThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThan(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatBetween(Float startOfOptionalFloat, Float endOfOptionalFloat){ + return withOptionalFloat(Operator.BETWEEN, startOfOptionalFloat, endOfOptionalFloat); + } + + + + public ScalarTypeProbeRequest filterByRequiredDouble(Double... requiredDouble){ + if (requiredDouble == null || requiredDouble.length == 0) { + throw new IllegalArgumentException("filterByRequiredDouble parameter requiredDouble cannot be empty"); + } + return appendSearchCriteria(createRequiredDoubleCriteria(Operator.EQUAL, (Object[])requiredDouble)); + } + + public ScalarTypeProbeRequest withRequiredDouble(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsUnknown(){ + return withRequiredDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsKnown(){ + return withRequiredDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDoubleIs(Double requiredDouble){ + return withRequiredDouble(Operator.EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsNot(Double requiredDouble){ + return withRequiredDouble(Operator.NOT_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIn(Double... requiredDouble){ + return withRequiredDouble(Operator.IN, (Object[])requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleNotIn(Double... requiredDouble){ + return withRequiredDouble(Operator.NOT_IN, (Object[])requiredDouble); + } + public ScalarTypeProbeRequest withRequiredDoubleGreaterThan(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleGreaterThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThan(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleBetween(Double startOfRequiredDouble, Double endOfRequiredDouble){ + return withRequiredDouble(Operator.BETWEEN, startOfRequiredDouble, endOfRequiredDouble); + } + + + + public ScalarTypeProbeRequest filterByOptionalDouble(Double... optionalDouble){ + if (optionalDouble == null || optionalDouble.length == 0) { + throw new IllegalArgumentException("filterByOptionalDouble parameter optionalDouble cannot be empty"); + } + return appendSearchCriteria(createOptionalDoubleCriteria(Operator.EQUAL, (Object[])optionalDouble)); + } + + public ScalarTypeProbeRequest withOptionalDouble(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsUnknown(){ + return withOptionalDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsKnown(){ + return withOptionalDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDoubleIs(Double optionalDouble){ + return withOptionalDouble(Operator.EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsNot(Double optionalDouble){ + return withOptionalDouble(Operator.NOT_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIn(Double... optionalDouble){ + return withOptionalDouble(Operator.IN, (Object[])optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleNotIn(Double... optionalDouble){ + return withOptionalDouble(Operator.NOT_IN, (Object[])optionalDouble); + } + public ScalarTypeProbeRequest withOptionalDoubleGreaterThan(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleGreaterThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThan(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleBetween(Double startOfOptionalDouble, Double endOfOptionalDouble){ + return withOptionalDouble(Operator.BETWEEN, startOfOptionalDouble, endOfOptionalDouble); + } + + + + public ScalarTypeProbeRequest filterByRequiredDate(LocalDate... requiredDate){ + if (requiredDate == null || requiredDate.length == 0) { + throw new IllegalArgumentException("filterByRequiredDate parameter requiredDate cannot be empty"); + } + return appendSearchCriteria(createRequiredDateCriteria(Operator.EQUAL, (Object[])requiredDate)); + } + + public ScalarTypeProbeRequest withRequiredDate(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDateIsUnknown(){ + return withRequiredDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDateIsKnown(){ + return withRequiredDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDateIs(LocalDate requiredDate){ + return withRequiredDate(Operator.EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIsNot(LocalDate requiredDate){ + return withRequiredDate(Operator.NOT_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.IN, (Object[])requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateNotIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.NOT_IN, (Object[])requiredDate); + } + public ScalarTypeProbeRequest withRequiredDateGreaterThan(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateGreaterThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThan(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(LocalDate startOfRequiredDate, LocalDate endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + public ScalarTypeProbeRequest withRequiredDateBefore(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBefore(Date requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(Date requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(Date startOfRequiredDate, Date endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDate(LocalDate... optionalDate){ + if (optionalDate == null || optionalDate.length == 0) { + throw new IllegalArgumentException("filterByOptionalDate parameter optionalDate cannot be empty"); + } + return appendSearchCriteria(createOptionalDateCriteria(Operator.EQUAL, (Object[])optionalDate)); + } + + public ScalarTypeProbeRequest withOptionalDate(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDateIsUnknown(){ + return withOptionalDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDateIsKnown(){ + return withOptionalDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDateIs(LocalDate optionalDate){ + return withOptionalDate(Operator.EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIsNot(LocalDate optionalDate){ + return withOptionalDate(Operator.NOT_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.IN, (Object[])optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateNotIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.NOT_IN, (Object[])optionalDate); + } + public ScalarTypeProbeRequest withOptionalDateGreaterThan(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateGreaterThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThan(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(LocalDate startOfOptionalDate, LocalDate endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + public ScalarTypeProbeRequest withOptionalDateBefore(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBefore(Date optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(Date optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(Date startOfOptionalDate, Date endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + + + + + public ScalarTypeProbeRequest filterByRequiredTime(LocalTime... requiredTime){ + if (requiredTime == null || requiredTime.length == 0) { + throw new IllegalArgumentException("filterByRequiredTime parameter requiredTime cannot be empty"); + } + return appendSearchCriteria(createRequiredTimeCriteria(Operator.EQUAL, (Object[])requiredTime)); + } + + public ScalarTypeProbeRequest withRequiredTime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredTimeIsUnknown(){ + return withRequiredTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredTimeIsKnown(){ + return withRequiredTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredTimeIs(LocalTime requiredTime){ + return withRequiredTime(Operator.EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIsNot(LocalTime requiredTime){ + return withRequiredTime(Operator.NOT_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.IN, (Object[])requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeNotIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.NOT_IN, (Object[])requiredTime); + } + public ScalarTypeProbeRequest withRequiredTimeGreaterThan(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeGreaterThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThan(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeBetween(LocalTime startOfRequiredTime, LocalTime endOfRequiredTime){ + return withRequiredTime(Operator.BETWEEN, startOfRequiredTime, endOfRequiredTime); + } + + + public ScalarTypeProbeRequest filterByOptionalTime(LocalTime... optionalTime){ + if (optionalTime == null || optionalTime.length == 0) { + throw new IllegalArgumentException("filterByOptionalTime parameter optionalTime cannot be empty"); + } + return appendSearchCriteria(createOptionalTimeCriteria(Operator.EQUAL, (Object[])optionalTime)); + } + + public ScalarTypeProbeRequest withOptionalTime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalTimeIsUnknown(){ + return withOptionalTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalTimeIsKnown(){ + return withOptionalTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalTimeIs(LocalTime optionalTime){ + return withOptionalTime(Operator.EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIsNot(LocalTime optionalTime){ + return withOptionalTime(Operator.NOT_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.IN, (Object[])optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeNotIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.NOT_IN, (Object[])optionalTime); + } + public ScalarTypeProbeRequest withOptionalTimeGreaterThan(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeGreaterThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThan(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeBetween(LocalTime startOfOptionalTime, LocalTime endOfOptionalTime){ + return withOptionalTime(Operator.BETWEEN, startOfOptionalTime, endOfOptionalTime); + } + + + public ScalarTypeProbeRequest filterByRequiredDatetime(LocalDateTime... requiredDatetime){ + if (requiredDatetime == null || requiredDatetime.length == 0) { + throw new IllegalArgumentException("filterByRequiredDatetime parameter requiredDatetime cannot be empty"); + } + return appendSearchCriteria(createRequiredDatetimeCriteria(Operator.EQUAL, (Object[])requiredDatetime)); + } + + public ScalarTypeProbeRequest withRequiredDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsUnknown(){ + return withRequiredDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsKnown(){ + return withRequiredDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIs(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsNot(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.NOT_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.IN, (Object[])requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeNotIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.NOT_IN, (Object[])requiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(LocalDateTime startOfRequiredDatetime, LocalDateTime endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeBefore(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBefore(Date requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(Date requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(Date startOfRequiredDatetime, Date endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDatetime(LocalDateTime... optionalDatetime){ + if (optionalDatetime == null || optionalDatetime.length == 0) { + throw new IllegalArgumentException("filterByOptionalDatetime parameter optionalDatetime cannot be empty"); + } + return appendSearchCriteria(createOptionalDatetimeCriteria(Operator.EQUAL, (Object[])optionalDatetime)); + } + + public ScalarTypeProbeRequest withOptionalDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsUnknown(){ + return withOptionalDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsKnown(){ + return withOptionalDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIs(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsNot(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.NOT_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.IN, (Object[])optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeNotIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.NOT_IN, (Object[])optionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(LocalDateTime startOfOptionalDatetime, LocalDateTime endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeBefore(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBefore(Date optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(Date optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(Date startOfOptionalDatetime, Date endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + + + + + public ScalarTypeProbeRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public ScalarTypeProbeRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.CREATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public ScalarTypeProbeRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public ScalarTypeProbeRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public ScalarTypeProbeRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public ScalarTypeProbeRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public ScalarTypeProbeRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.UPDATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public ScalarTypeProbeRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public ScalarTypeProbeRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.VERSION_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public ScalarTypeProbeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public ScalarTypeProbeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public ScalarTypeProbeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public ScalarTypeProbeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public ScalarTypeProbeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest minRequiredInteger(){ + return minRequiredIntegerAs(prefix("minOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredInteger(){ + return maxRequiredIntegerAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredInteger(){ + return sumRequiredIntegerAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredInteger(){ + return avgRequiredIntegerAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredInteger(){ + return standardDeviationRequiredIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredInteger(){ + return squareRootOfPopulationStandardDeviationRequiredIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredInteger(){ + return sampleVarianceRequiredIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredInteger(){ + return samplePopulationVarianceRequiredIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalInteger(){ + return minOptionalIntegerAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalInteger(){ + return maxOptionalIntegerAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalInteger(){ + return sumOptionalIntegerAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalInteger(){ + return avgOptionalIntegerAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalInteger(){ + return standardDeviationOptionalIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalInteger(){ + return squareRootOfPopulationStandardDeviationOptionalIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalInteger(){ + return sampleVarianceOptionalIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalInteger(){ + return samplePopulationVarianceOptionalIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredLong(){ + return minRequiredLongAs(prefix("minOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredLongAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredLong(){ + return maxRequiredLongAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredLongAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredLong(){ + return sumRequiredLongAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredLong(){ + return avgRequiredLongAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredLong(){ + return standardDeviationRequiredLongAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLong(){ + return squareRootOfPopulationStandardDeviationRequiredLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredLong(){ + return sampleVarianceRequiredLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLong(){ + return samplePopulationVarianceRequiredLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalLong(){ + return minOptionalLongAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalLongAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalLong(){ + return maxOptionalLongAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalLongAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalLong(){ + return sumOptionalLongAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalLong(){ + return avgOptionalLongAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalLong(){ + return standardDeviationOptionalLongAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLong(){ + return squareRootOfPopulationStandardDeviationOptionalLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalLong(){ + return sampleVarianceOptionalLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLong(){ + return samplePopulationVarianceOptionalLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDecimal(){ + return minRequiredDecimalAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDecimal(){ + return maxRequiredDecimalAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDecimal(){ + return sumRequiredDecimalAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDecimal(){ + return avgRequiredDecimalAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDecimal(){ + return standardDeviationRequiredDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimal(){ + return squareRootOfPopulationStandardDeviationRequiredDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDecimal(){ + return sampleVarianceRequiredDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimal(){ + return samplePopulationVarianceRequiredDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDecimal(){ + return minOptionalDecimalAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDecimal(){ + return maxOptionalDecimalAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDecimal(){ + return sumOptionalDecimalAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDecimal(){ + return avgOptionalDecimalAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDecimal(){ + return standardDeviationOptionalDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimal(){ + return squareRootOfPopulationStandardDeviationOptionalDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDecimal(){ + return sampleVarianceOptionalDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimal(){ + return samplePopulationVarianceOptionalDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredFloat(){ + return minRequiredFloatAs(prefix("minOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredFloat(){ + return maxRequiredFloatAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredFloat(){ + return sumRequiredFloatAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredFloat(){ + return avgRequiredFloatAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredFloat(){ + return standardDeviationRequiredFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloat(){ + return squareRootOfPopulationStandardDeviationRequiredFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredFloat(){ + return sampleVarianceRequiredFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloat(){ + return samplePopulationVarianceRequiredFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalFloat(){ + return minOptionalFloatAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalFloat(){ + return maxOptionalFloatAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalFloat(){ + return sumOptionalFloatAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalFloat(){ + return avgOptionalFloatAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalFloat(){ + return standardDeviationOptionalFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloat(){ + return squareRootOfPopulationStandardDeviationOptionalFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalFloat(){ + return sampleVarianceOptionalFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloat(){ + return samplePopulationVarianceOptionalFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDouble(){ + return minRequiredDoubleAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDouble(){ + return maxRequiredDoubleAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDouble(){ + return sumRequiredDoubleAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDouble(){ + return avgRequiredDoubleAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDouble(){ + return standardDeviationRequiredDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDouble(){ + return squareRootOfPopulationStandardDeviationRequiredDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDouble(){ + return sampleVarianceRequiredDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDouble(){ + return samplePopulationVarianceRequiredDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDouble(){ + return minOptionalDoubleAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDouble(){ + return maxOptionalDoubleAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDouble(){ + return sumOptionalDoubleAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDouble(){ + return avgOptionalDoubleAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDouble(){ + return standardDeviationOptionalDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDouble(){ + return squareRootOfPopulationStandardDeviationOptionalDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDouble(){ + return sampleVarianceOptionalDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDouble(){ + return samplePopulationVarianceOptionalDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(){ + return groupByTypePlatformWithDetails(Q.typePlatforms().unlimited()); + } + + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequest subRequest){ + aggregate(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest groupById(){ + groupBy(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdAs(String retName){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY, function); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatform(){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformAs(String retName){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredString(){ + groupBy(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalString(){ + groupBy(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByLargeText(){ + groupBy(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextAs(String retName){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBoolean(){ + groupBy(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBoolean(){ + groupBy(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredInteger(){ + groupBy(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalInteger(){ + groupBy(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLong(){ + groupBy(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLong(){ + groupBy(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimal(){ + groupBy(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimal(){ + groupBy(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloat(){ + groupBy(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloat(){ + groupBy(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDouble(){ + groupBy(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDouble(){ + groupBy(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDate(){ + groupBy(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDate(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTime(){ + groupBy(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTime(){ + groupBy(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetime(){ + groupBy(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetime(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTime(){ + groupBy(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTime(){ + groupBy(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByVersion(){ + groupBy(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionAs(String retName){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY, function); + return this; + } + + + + public ScalarTypeProbeRequest orderByIdAscending(){ + addOrderByAscending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByIdDescending(){ + addOrderByDescending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformAscending(){ + addOrderByAscending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformDescending(){ + addOrderByDescending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByRequiredStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByLargeTextAscending(){ + addOrderByAscending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByLargeTextDescending(){ + addOrderByDescending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionAscending(){ + addOrderByAscending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionDescending(){ + addOrderByDescending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest rollUpToTypePlatform(){ + TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); + this.withTypePlatformMatching(typePlatform) + .groupByTypePlatformWith(typePlatform); + return typePlatform; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform){ + return facetByTypePlatformAs(facetName, typePlatform, true); + } + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform, boolean includeAllFacets){ + addFacet(facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTypePlatformAs", facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public ScalarTypeProbeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public ScalarTypeProbeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public ScalarTypeProbeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public ScalarTypeProbeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java new file mode 100644 index 000000000..d7fdce2e1 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -0,0 +1,123 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +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 TypePlatform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "TypePlatform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5afe0d829346ae9bcaf7f37458837cfbdcdee743f3e9fb8fab9c754126349de5"; + 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( + "scalar_type_probe_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + TypePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SCALAR_TYPE_PROBE_LIST_PROPERTY = "scalar_type_probe_list"; + private String name; + + private SmartList scalarTypeProbeList; + + public String getName(){ + return this.name; + } + + public SmartList getScalarTypeProbeList(){ + return this.scalarTypeProbeList; + } + public TypePlatform 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 TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + if (scalarTypeProbe == null){ + return this; + } + + if(null == this.scalarTypeProbeList){ + this.scalarTypeProbeList = new SmartList<>(); + } + + this.scalarTypeProbeList.add(scalarTypeProbe); + scalarTypeProbe.updateTypePlatform(this); + return this; + } + + public static TypePlatform refer(Long id){ + TypePlatform refer = new TypePlatform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public TypePlatform 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 "scalar_type_probe_list": this.scalarTypeProbeList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "scalar_type_probe_list": return this.scalarTypeProbeList; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java new file mode 100644 index 000000000..62df23ea0 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -0,0 +1,51 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class TypePlatformChecker implements Checker{ + + public String type(){ + return TypePlatform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, typePlatform)){ + markAsChecked(_context, typePlatform); + doCheck(_context, typePlatform, _parentLocation); + } + } + + public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if((typePlatform == null)){ + return; + } + if(typePlatform.needPersist()){ + } + if(typePlatform.newItem()){ + }else if(typePlatform.updateItem()){ + if(!typePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, typePlatform.getProperty(TypePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; typePlatform.getScalarTypeProbeList() != null && i < typePlatform.getScalarTypeProbeList().size(); i++){ + ScalarTypeProbe scalarTypeProbe = typePlatform.getScalarTypeProbeList().get(i); + new ScalarTypeProbeChecker().checkAndFix(_context, scalarTypeProbe, newLocation(_parentLocation, "scalar_type_probe_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java new file mode 100644 index 000000000..01a63a43c --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeListExpression; +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 TypePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public TypePlatformExpression(Expression expression){ + super(expression); + } + + public TypePlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public TypePlatformExpression updateId(Long id){ + return new TypePlatformExpression(this, $it -> {((TypePlatform)$it).__internalSet("id", id); return this;}); + } + + public TypePlatformExpression save(UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public TypePlatformExpression save(String intent, UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", TypePlatform::getName); + } + public TypePlatformExpression updateName(String name){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).updateName(name)); + } + + public ScalarTypeProbeListExpression getScalarTypeProbeList(){ + return new ScalarTypeProbeListExpression(loaded("scalar_type_probe_list", "getScalarTypeProbeList", TypePlatform::getScalarTypeProbeList)); + } + public TypePlatformExpression addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).addScalarTypeProbe(scalarTypeProbe)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java new file mode 100644 index 000000000..3974c0610 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class TypePlatformListExpression extends SmartListExpression { + public TypePlatformListExpression(Expression> expression){ + super(expression); + } + + public TypePlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public TypePlatformExpression first() { + return new TypePlatformExpression(super.first()); + } + + public TypePlatformExpression get(int index) { + return new TypePlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java new file mode 100644 index 000000000..0ac2f1d18 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -0,0 +1,2099 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest; +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 TypePlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public TypePlatformRequest(Class returnType){ + this(returnType, () -> (T) new TypePlatform()); + } + + protected TypePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public TypePlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public TypePlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public TypePlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public TypePlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public TypePlatformRequest 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 TypePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public TypePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public TypePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public TypePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (TypePlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public TypePlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ + super.internalMatchAny(typePlatform); + return this; + } + + public TypePlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public TypePlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public TypePlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public TypePlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public TypePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(TypePlatform.ID_PROPERTY); + selectProperty(TypePlatform.NAME_PROPERTY); + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectChildren(){ + super.selectAny(); + selectScalarTypeProbeList(); + return selectId().selectName().selectVersion(); + } + + + public TypePlatformRequest selectId(){ + selectProperty(TypePlatform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectId(){ + unselectProperty(TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest selectName(){ + selectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectName(){ + unselectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest selectVersion(){ + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectVersion(){ + unselectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + public TypePlatformRequest selectScalarTypeProbeList(){ + return selectScalarTypeProbeListWith(Q.scalarTypeProbes().selectSelf()); + } + + public TypePlatformRequest selectScalarTypeProbeListWith(ScalarTypeProbeRequest scalarTypeProbeList){ + enhanceRelation(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, scalarTypeProbeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectScalarTypeProbeListWith", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.ID_PROPERTY, operator, values); + } + + public TypePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public TypePlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public TypePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public TypePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public TypePlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public TypePlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.NAME_PROPERTY, operator, values); + } + + public TypePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public TypePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public TypePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public TypePlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public TypePlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public TypePlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public TypePlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public TypePlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public TypePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public TypePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public TypePlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public TypePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public TypePlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public TypePlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public TypePlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public TypePlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.VERSION_PROPERTY, operator, values); + } + + public TypePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public TypePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public TypePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public TypePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public TypePlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public TypePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public TypePlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public TypePlatformRequest withScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + } + + public TypePlatformRequest withoutScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY))); + } + + public TypePlatformRequest haveScalarTypeProbes(){ + return withScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest haveNoScalarTypeProbes(){ + return withoutScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public TypePlatformRequest 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 TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ + aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); + return this; + } + + public TypePlatformRequest groupById(){ + groupBy(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdAs(String retName){ + groupBy(retName, TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.ID_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByName(){ + groupBy(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameAs(String retName){ + groupBy(retName, TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.NAME_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByVersion(){ + groupBy(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionAs(String retName){ + groupBy(retName, TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.VERSION_PROPERTY, function); + return this; + } + + + + public TypePlatformRequest orderByIdAscending(){ + addOrderByAscending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByIdDescending(){ + addOrderByDescending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameAscending(){ + addOrderByAscending(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescending(){ + addOrderByDescending(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByVersionAscending(){ + addOrderByAscending(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest orderByVersionDescending(){ + addOrderByDescending(TypePlatform.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(name, subRequest, false); + } + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest statsFromScalarTypeProbes(ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(REFINEMENTS, subRequest); + } + public TypePlatformRequest countScalarTypeProbes(){ + addRelationCount("Count", Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesAs(String name){ + addRelationCount(name, Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesWith(String name, ScalarTypeProbeRequest subRequest){ + addRelationCount(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesWith", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name){ + return minRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name){ + return maxRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name){ + return sumRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name){ + return avgRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name){ + return minOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name){ + return maxOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name){ + return sumOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name){ + return avgOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name){ + return minRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name){ + return maxRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name){ + return sumRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name){ + return avgRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name){ + return minOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name){ + return maxOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name){ + return sumOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name){ + return avgOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name){ + return minRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name){ + return maxRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name){ + return sumRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name){ + return avgRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name){ + return minOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name){ + return maxOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name){ + return sumOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name){ + return avgOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name){ + return minRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name){ + return maxRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name){ + return sumRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name){ + return avgRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name){ + return minOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name){ + return maxOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name){ + return sumOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name){ + return avgOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name){ + return minRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name){ + return maxRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name){ + return sumRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name){ + return avgRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name){ + return minOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name){ + return maxOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name){ + return sumOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name){ + return avgOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public TypePlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public TypePlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public TypePlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public TypePlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public TypePlatformRequest 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 TypePlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..d97c5af41 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.scalartypeconformanceservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/model.xml b/examples/scalar-type-probe/json-profiles/camelCase/model.xml new file mode 100644 index 000000000..6fd6f2bc5 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/model.xml @@ -0,0 +1,39 @@ + + + + + + diff --git a/examples/scalar-type-probe/json-profiles/manifest.json b/examples/scalar-type-probe/json-profiles/manifest.json new file mode 100644 index 000000000..6a55ae660 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/manifest.json @@ -0,0 +1,412 @@ +{ + "profiles" : { + "camelCase" : { + "files" : { + "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java" : "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java" : "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java" : "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java" : "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java" : "5c3acc14ce9185a24460c9b85afba2dd57f39c240b04fbd8ccea443e436a001e", + "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java" : "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java" : "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java" : "8c0dc1f8945933a86e9a5fac31c07fb977e858916441b50d3b84bbed83bf0341", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java" : "78dfd21f0e6918121c43028dc5cce7ecbdb7e1467b447db0d3dac07b17433a69", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler" : "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java" : "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "lib/pom.xml" : "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java" : "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java" : "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "lib/src/main/java/com/example/scalartypeconformanceservice/E.java" : "5b30ec087b361856c32a7cfaa7adaf494a1351692256004bfdefe834d7011d99", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java" : "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java" : "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java" : "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e" + }, + "evaluation" : { + "solids" : [ { + "ruleId" : "KSML-UPLOAD-001", + "title" : "Model upload is non-empty", + "message" : "The upload contains 1 files.", + "path" : "model.zip", + "objectName" : null, + "fieldName" : null, + "xmlPath" : null, + "lineNumber" : null, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.zip" + }, { + "ruleId" : "KSML-UPLOAD-005", + "title" : "Valid entrypoint found", + "message" : "Resolved entrypoint: model.xml", + "path" : "model.xml", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.xml" + }, { + "ruleId" : "KSML-XML-002", + "title" : "XML is well-formed", + "message" : "The XML document model.xml was parsed successfully.", + "path" : "model.xml", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.xml" + }, { + "ruleId" : "KSML-ROOT-003", + "title" : "Standard root name", + "message" : "Root name 'scalar-type-conformance-service' is well-formed.", + "path" : "/root", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root" + }, { + "ruleId" : "KSML-ROOT-008", + "title" : "Default JSON field naming", + "message" : "External JSON business fields use the default camelCase profile.", + "path" : "/root", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root" + }, { + "ruleId" : "KSML-OBJECT-001", + "title" : "Object display metadata exists", + "message" : "Object 'type_platform' defines display name, module, and module key metadata.", + "path" : "/root/type_platform", + "objectName" : "type_platform", + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 7, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "type_platform" + }, { + "ruleId" : "KSML-OBJECT-001", + "title" : "Object display metadata exists", + "message" : "Object 'scalar_type_probe' defines display name, module, and module key metadata.", + "path" : "/root/scalar_type_probe", + "objectName" : "scalar_type_probe", + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 12, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "scalar_type_probe" + }, { + "ruleId" : "KSML-REFERENCE-003", + "title" : "Reference target exists", + "message" : "Reference 'type_platform' in 'scalar_type_probe' successfully resolves to target object 'type_platform'.", + "path" : "/root/scalar_type_probe/type_platform", + "objectName" : "scalar_type_probe", + "fieldName" : "type_platform", + "xmlPath" : "model.xml", + "lineNumber" : 15, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "scalar_type_probe.type_platform" + }, { + "ruleId" : "KSML-DOMAIN-ROOT-003", + "title" : "One domain root found", + "message" : "Exactly one domain root candidate 'type_platform' was found.", + "path" : "/root", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root" + } ], + "warnings" : [ ], + "suggestions" : [ ], + "errors" : [ ], + "privacyFindings" : [ ], + "privacyRegions" : [ ], + "errorSummaries" : [ ] + }, + "modelSha256" : "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762" + }, + "snake_case" : { + "files" : { + "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java" : "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java" : "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java" : "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java" : "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java" : "a912abea3e686e5dcf4de14fc4fb594c53e5fb3bd36e0d565baa4035a398f793", + "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java" : "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java" : "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java" : "d5eb32050c3d76724f5728a9a98cf1af5b97e280dc57018c12531a5af470b7b3", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java" : "bc983ba89daad16e2e522e7c6b68b1c9c202db923e4d86f9d0858e37f63032b1", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler" : "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java" : "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "lib/pom.xml" : "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java" : "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java" : "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "lib/src/main/java/com/example/scalartypeconformanceservice/E.java" : "07bda7cfc1c24acea406381d33150f44bf6c32c7a5e9485abbdda5fdc3cec4d1", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java" : "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java" : "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java" : "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e" + }, + "evaluation" : { + "solids" : [ { + "ruleId" : "KSML-UPLOAD-001", + "title" : "Model upload is non-empty", + "message" : "The upload contains 1 files.", + "path" : "model.zip", + "objectName" : null, + "fieldName" : null, + "xmlPath" : null, + "lineNumber" : null, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.zip" + }, { + "ruleId" : "KSML-UPLOAD-005", + "title" : "Valid entrypoint found", + "message" : "Resolved entrypoint: model.xml", + "path" : "model.xml", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.xml" + }, { + "ruleId" : "KSML-XML-002", + "title" : "XML is well-formed", + "message" : "The XML document model.xml was parsed successfully.", + "path" : "model.xml", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.xml" + }, { + "ruleId" : "KSML-ROOT-003", + "title" : "Standard root name", + "message" : "Root name 'scalar-type-conformance-service' is well-formed.", + "path" : "/root", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root" + }, { + "ruleId" : "KSML-ROOT-008", + "title" : "Explicit JSON field naming", + "message" : "External JSON business fields use the snake_case profile.", + "path" : "/root/@json_field_naming", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root/@json_field_naming" + }, { + "ruleId" : "KSML-OBJECT-001", + "title" : "Object display metadata exists", + "message" : "Object 'type_platform' defines display name, module, and module key metadata.", + "path" : "/root/type_platform", + "objectName" : "type_platform", + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 7, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "type_platform" + }, { + "ruleId" : "KSML-OBJECT-001", + "title" : "Object display metadata exists", + "message" : "Object 'scalar_type_probe' defines display name, module, and module key metadata.", + "path" : "/root/scalar_type_probe", + "objectName" : "scalar_type_probe", + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 12, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "scalar_type_probe" + }, { + "ruleId" : "KSML-REFERENCE-003", + "title" : "Reference target exists", + "message" : "Reference 'type_platform' in 'scalar_type_probe' successfully resolves to target object 'type_platform'.", + "path" : "/root/scalar_type_probe/type_platform", + "objectName" : "scalar_type_probe", + "fieldName" : "type_platform", + "xmlPath" : "model.xml", + "lineNumber" : 15, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "scalar_type_probe.type_platform" + }, { + "ruleId" : "KSML-DOMAIN-ROOT-003", + "title" : "One domain root found", + "message" : "Exactly one domain root candidate 'type_platform' was found.", + "path" : "/root", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root" + } ], + "warnings" : [ ], + "suggestions" : [ ], + "errors" : [ ], + "privacyFindings" : [ ], + "privacyRegions" : [ ], + "errorSummaries" : [ ] + }, + "modelSha256" : "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6" + }, + "PascalCase" : { + "files" : { + "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java" : "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java" : "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java" : "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java" : "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java" : "67278565b479fbd509b7087d03c1fbebe206707529fb3aa0b2b32f175afe48fb", + "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java" : "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java" : "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java" : "942fbe9038116a9330f01da69cb807a03b5630447e4ad9b9fddf1670547bfaec", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java" : "5f6fd4941b22a8a77ba523ff082ac4290aa00c076dc44726d28d5a786e83f097", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler" : "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java" : "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "lib/pom.xml" : "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java" : "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java" : "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "lib/src/main/java/com/example/scalartypeconformanceservice/E.java" : "897af4eeaa2235e2fd4cf3665977ba6326aae246d659f8f12a87cf98083c0e68", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java" : "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java" : "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java" : "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e" + }, + "evaluation" : { + "solids" : [ { + "ruleId" : "KSML-UPLOAD-001", + "title" : "Model upload is non-empty", + "message" : "The upload contains 1 files.", + "path" : "model.zip", + "objectName" : null, + "fieldName" : null, + "xmlPath" : null, + "lineNumber" : null, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.zip" + }, { + "ruleId" : "KSML-UPLOAD-005", + "title" : "Valid entrypoint found", + "message" : "Resolved entrypoint: model.xml", + "path" : "model.xml", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.xml" + }, { + "ruleId" : "KSML-XML-002", + "title" : "XML is well-formed", + "message" : "The XML document model.xml was parsed successfully.", + "path" : "model.xml", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "model.xml" + }, { + "ruleId" : "KSML-ROOT-003", + "title" : "Standard root name", + "message" : "Root name 'scalar-type-conformance-service' is well-formed.", + "path" : "/root", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root" + }, { + "ruleId" : "KSML-ROOT-008", + "title" : "Explicit JSON field naming", + "message" : "External JSON business fields use the PascalCase profile.", + "path" : "/root/@json_field_naming", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root/@json_field_naming" + }, { + "ruleId" : "KSML-OBJECT-001", + "title" : "Object display metadata exists", + "message" : "Object 'type_platform' defines display name, module, and module key metadata.", + "path" : "/root/type_platform", + "objectName" : "type_platform", + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 7, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "type_platform" + }, { + "ruleId" : "KSML-OBJECT-001", + "title" : "Object display metadata exists", + "message" : "Object 'scalar_type_probe' defines display name, module, and module key metadata.", + "path" : "/root/scalar_type_probe", + "objectName" : "scalar_type_probe", + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 12, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "scalar_type_probe" + }, { + "ruleId" : "KSML-REFERENCE-003", + "title" : "Reference target exists", + "message" : "Reference 'type_platform' in 'scalar_type_probe' successfully resolves to target object 'type_platform'.", + "path" : "/root/scalar_type_probe/type_platform", + "objectName" : "scalar_type_probe", + "fieldName" : "type_platform", + "xmlPath" : "model.xml", + "lineNumber" : 15, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "scalar_type_probe.type_platform" + }, { + "ruleId" : "KSML-DOMAIN-ROOT-003", + "title" : "One domain root found", + "message" : "Exactly one domain root candidate 'type_platform' was found.", + "path" : "/root", + "objectName" : null, + "fieldName" : null, + "xmlPath" : "model.xml", + "lineNumber" : 2, + "action" : "Check agents/ERROR-FIX.md", + "reportTarget" : "/root" + } ], + "warnings" : [ ], + "suggestions" : [ ], + "errors" : [ ], + "privacyFindings" : [ ], + "privacyRegions" : [ ], + "errorSummaries" : [ ] + }, + "modelSha256" : "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d" + } + }, + "localSourceOnly" : true, + "schema" : "teaql.java-json-profile-generated-source/v1", + "baseModelSha256" : "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762" +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/provenance.json b/examples/scalar-type-probe/json-profiles/provenance.json new file mode 100644 index 000000000..77acf2c2a --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/provenance.json @@ -0,0 +1,83 @@ +{ + "producerReceiptSha256": "a190d5ed205b40c0db1ad907fb68379fb0f31a2e8b54f002128fe77eda6b1cca", + "producerSource": { + "commit": "39da6d21fe34e09c05224de15a7a02a07971c552", + "diff": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "status": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sourceContentsSha256": "f57f23380158495beb3748d65e549ee97866901de2184520fd25d65bd224533f", + "assistExporterSha256": "2583414a9d656e89b43b85f1d4e993dcc774b74e2bed0f9b7120d7cb7ea47efd" + }, + "files": { + "base-model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "manifest.json": "519dfe321218a4248a9da550b22d35e3507a0408eb8e60fad1bc009a058afa6d", + "camelCase/model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "5c3acc14ce9185a24460c9b85afba2dd57f39c240b04fbd8ccea443e436a001e", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "8c0dc1f8945933a86e9a5fac31c07fb977e858916441b50d3b84bbed83bf0341", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "78dfd21f0e6918121c43028dc5cce7ecbdb7e1467b447db0d3dac07b17433a69", + "camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "camelCase/lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "5b30ec087b361856c32a7cfaa7adaf494a1351692256004bfdefe834d7011d99", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e", + "snake_case/model.xml": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "a912abea3e686e5dcf4de14fc4fb594c53e5fb3bd36e0d565baa4035a398f793", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "d5eb32050c3d76724f5728a9a98cf1af5b97e280dc57018c12531a5af470b7b3", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "bc983ba89daad16e2e522e7c6b68b1c9c202db923e4d86f9d0858e37f63032b1", + "snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "snake_case/lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "07bda7cfc1c24acea406381d33150f44bf6c32c7a5e9485abbdda5fdc3cec4d1", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e", + "PascalCase/model.xml": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "67278565b479fbd509b7087d03c1fbebe206707529fb3aa0b2b32f175afe48fb", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "942fbe9038116a9330f01da69cb807a03b5630447e4ad9b9fddf1670547bfaec", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "5f6fd4941b22a8a77ba523ff082ac4290aa00c076dc44726d28d5a786e83f097", + "PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "PascalCase/lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "897af4eeaa2235e2fd4cf3665977ba6326aae246d659f8f12a87cf98083c0e68", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e" + } +} diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml b/examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml new file mode 100644 index 000000000..6f3d904d8 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + scalar-type-conformance-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 1.555-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.555-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/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java new file mode 100644 index 000000000..5ba171d6c --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; + +public interface Constants { + public static final long TYPE_PLATFORM_ID = 1l; + public static final TypePlatform TYPE_PLATFORM = TypePlatform.refer(TYPE_PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/E.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/E.java new file mode 100644 index 000000000..3ecfee2a5 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/E.java @@ -0,0 +1,18 @@ + +package com.example.scalartypeconformanceservice; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeExpression; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static TypePlatformExpression typePlatform(TypePlatform typePlatform){ + return new TypePlatformExpression(new ValueExpression(typePlatform, JsonFieldNamingProfile.fromModelValue("snake_case"), "E.typePlatform()")); + } + public static ScalarTypeProbeExpression scalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new ScalarTypeProbeExpression(new ValueExpression(scalarTypeProbe, JsonFieldNamingProfile.fromModelValue("snake_case"), "E.scalarTypeProbe()")); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java new file mode 100644 index 000000000..59b3f02e9 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -0,0 +1,617 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerTypePlatform(); + registerScalarTypeProbe(); + } + private void registerTypePlatform() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); + entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } + private void registerScalarTypeProbe() { + FieldLayout.installGenerated(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); + entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); + entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") + .with("module_key", "type-conformance"); + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY, Long.class) + ; + PropertyDescriptor typePlatform = + entityDescriptor.addObjectProperty($factory, com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.INTERNAL_TYPE, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class) + ; + PropertyDescriptor requiredString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY, String.class) + ; + PropertyDescriptor optionalString = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, String.class) + ; + PropertyDescriptor largeText = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY, String.class) + ; + PropertyDescriptor requiredBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor optionalBoolean = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, Boolean.class) + ; + PropertyDescriptor requiredInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor optionalInteger = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, Integer.class) + ; + PropertyDescriptor requiredLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor optionalLong = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, Long.class) + ; + PropertyDescriptor requiredDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor optionalDecimal = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor requiredFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor optionalFloat = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, Float.class) + ; + PropertyDescriptor requiredDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor optionalDouble = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, Double.class) + ; + PropertyDescriptor requiredDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor optionalDate = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor requiredTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor optionalTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor requiredDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor optionalDatetime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") + .with("isTime", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") + .with("isDouble", "true"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") + .with("isText", "false"); + + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") + .with("isText", "false"); + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..01b4fcb51 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -0,0 +1,36 @@ +package com.example.scalartypeconformanceservice; + +/** 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.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .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("TypePlatform", 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("ScalarTypeProbe", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("type_platform", "type_platform"), java.util.Map.entry("required_string", "required_string"), java.util.Map.entry("optional_string", "optional_string"), java.util.Map.entry("large_text", "large_text"), java.util.Map.entry("required_boolean", "required_boolean"), java.util.Map.entry("optional_boolean", "optional_boolean"), java.util.Map.entry("required_integer", "required_integer"), java.util.Map.entry("optional_integer", "optional_integer"), java.util.Map.entry("required_long", "required_long"), java.util.Map.entry("optional_long", "optional_long"), java.util.Map.entry("required_decimal", "required_decimal"), java.util.Map.entry("optional_decimal", "optional_decimal"), java.util.Map.entry("required_float", "required_float"), java.util.Map.entry("optional_float", "optional_float"), java.util.Map.entry("required_double", "required_double"), java.util.Map.entry("optional_double", "optional_double"), java.util.Map.entry("required_date", "required_date"), java.util.Map.entry("optional_date", "optional_date"), java.util.Map.entry("required_time", "required_time"), java.util.Map.entry("optional_time", "optional_time"), java.util.Map.entry("required_datetime", "required_datetime"), java.util.Map.entry("optional_datetime", "optional_datetime"), java.util.Map.entry("create_time", "create_time"), java.util.Map.entry("update_time", "update_time"), 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.typePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.scalartypeconformanceservice.typeplatform.TypePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.scalartypeconformanceservice.typeplatform.TypePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Scalar Type Conformance"); + domainRoot.auditAs("create generated Domain Root TypePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("TypePlatform", domainRoot.getId())); + } +} diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java new file mode 100644 index 000000000..9b6fc69cd --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatforms(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest typePlatformsWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbes(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest scalarTypeProbesWithMinimalFields(){ + return new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java new file mode 100644 index 000000000..45450dfc0 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.scalartypeconformanceservice; + +import io.teaql.core.UserContext; +public interface ScalarTypeConformanceServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java new file mode 100644 index 000000000..fe99b5c64 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -0,0 +1,544 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class ScalarTypeProbe extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "ScalarTypeProbe"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8d1d53171c01628f604255bcfa7e7d52b6260332cee701781027b0233eae926b"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("type_platform", 1), java.util.Map.entry("required_string", 2), java.util.Map.entry("optional_string", 3), java.util.Map.entry("large_text", 4), java.util.Map.entry("required_boolean", 5), java.util.Map.entry("optional_boolean", 6), java.util.Map.entry("required_integer", 7), java.util.Map.entry("optional_integer", 8), java.util.Map.entry("required_long", 9), java.util.Map.entry("optional_long", 10), java.util.Map.entry("required_decimal", 11), java.util.Map.entry("optional_decimal", 12), java.util.Map.entry("required_float", 13), java.util.Map.entry("optional_float", 14), java.util.Map.entry("required_double", 15), java.util.Map.entry("optional_double", 16), java.util.Map.entry("required_date", 17), java.util.Map.entry("optional_date", 18), java.util.Map.entry("required_time", 19), java.util.Map.entry("optional_time", 20), java.util.Map.entry("required_datetime", 21), java.util.Map.entry("optional_datetime", 22), java.util.Map.entry("create_time", 23), java.util.Map.entry("update_time", 24), java.util.Map.entry("version", 25)); + 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("type_platform", java.util.List.of("typePlatform", "type_platform")), java.util.Map.entry("required_string", java.util.List.of("requiredString", "required_string")), java.util.Map.entry("optional_string", java.util.List.of("optionalString", "optional_string")), java.util.Map.entry("large_text", java.util.List.of("largeText", "large_text")), java.util.Map.entry("required_boolean", java.util.List.of("requiredBoolean", "required_boolean")), java.util.Map.entry("optional_boolean", java.util.List.of("optionalBoolean", "optional_boolean")), java.util.Map.entry("required_integer", java.util.List.of("requiredInteger", "required_integer")), java.util.Map.entry("optional_integer", java.util.List.of("optionalInteger", "optional_integer")), java.util.Map.entry("required_long", java.util.List.of("requiredLong", "required_long")), java.util.Map.entry("optional_long", java.util.List.of("optionalLong", "optional_long")), java.util.Map.entry("required_decimal", java.util.List.of("requiredDecimal", "required_decimal")), java.util.Map.entry("optional_decimal", java.util.List.of("optionalDecimal", "optional_decimal")), java.util.Map.entry("required_float", java.util.List.of("requiredFloat", "required_float")), java.util.Map.entry("optional_float", java.util.List.of("optionalFloat", "optional_float")), java.util.Map.entry("required_double", java.util.List.of("requiredDouble", "required_double")), java.util.Map.entry("optional_double", java.util.List.of("optionalDouble", "optional_double")), java.util.Map.entry("required_date", java.util.List.of("requiredDate", "required_date")), java.util.Map.entry("optional_date", java.util.List.of("optionalDate", "optional_date")), java.util.Map.entry("required_time", java.util.List.of("requiredTime", "required_time")), java.util.Map.entry("optional_time", java.util.List.of("optionalTime", "optional_time")), java.util.Map.entry("required_datetime", java.util.List.of("requiredDatetime", "required_datetime")), java.util.Map.entry("optional_datetime", java.util.List.of("optionalDatetime", "optional_datetime")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + ScalarTypeProbe.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("snake_case"))); + + + public static final String TYPE_PLATFORM_PROPERTY = "type_platform"; + public static final String REQUIRED_STRING_PROPERTY = "required_string"; + public static final String OPTIONAL_STRING_PROPERTY = "optional_string"; + public static final String LARGE_TEXT_PROPERTY = "large_text"; + public static final String REQUIRED_BOOLEAN_PROPERTY = "required_boolean"; + public static final String OPTIONAL_BOOLEAN_PROPERTY = "optional_boolean"; + public static final String REQUIRED_INTEGER_PROPERTY = "required_integer"; + public static final String OPTIONAL_INTEGER_PROPERTY = "optional_integer"; + public static final String REQUIRED_LONG_PROPERTY = "required_long"; + public static final String OPTIONAL_LONG_PROPERTY = "optional_long"; + public static final String REQUIRED_DECIMAL_PROPERTY = "required_decimal"; + public static final String OPTIONAL_DECIMAL_PROPERTY = "optional_decimal"; + public static final String REQUIRED_FLOAT_PROPERTY = "required_float"; + public static final String OPTIONAL_FLOAT_PROPERTY = "optional_float"; + public static final String REQUIRED_DOUBLE_PROPERTY = "required_double"; + public static final String OPTIONAL_DOUBLE_PROPERTY = "optional_double"; + public static final String REQUIRED_DATE_PROPERTY = "required_date"; + public static final String OPTIONAL_DATE_PROPERTY = "optional_date"; + public static final String REQUIRED_TIME_PROPERTY = "required_time"; + public static final String OPTIONAL_TIME_PROPERTY = "optional_time"; + public static final String REQUIRED_DATETIME_PROPERTY = "required_datetime"; + public static final String OPTIONAL_DATETIME_PROPERTY = "optional_datetime"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private TypePlatform typePlatform; + + private String requiredString; + + private String optionalString; + + private String largeText; + + private Boolean requiredBoolean; + + private Boolean optionalBoolean; + + private Integer requiredInteger; + + private Integer optionalInteger; + + private Long requiredLong; + + private Long optionalLong; + + private BigDecimal requiredDecimal; + + private BigDecimal optionalDecimal; + + private Float requiredFloat; + + private Float optionalFloat; + + private Double requiredDouble; + + private Double optionalDouble; + + private LocalDate requiredDate; + + private LocalDate optionalDate; + + private LocalTime requiredTime; + + private LocalTime optionalTime; + + private LocalDateTime requiredDatetime; + + private LocalDateTime optionalDatetime; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public TypePlatform getTypePlatform(){ + return this.typePlatform; + } + + public String getRequiredString(){ + return this.requiredString; + } + + public String getOptionalString(){ + return this.optionalString; + } + + public String getLargeText(){ + return this.largeText; + } + + public Boolean isRequiredBoolean(){ + return this.requiredBoolean; + } + + public Boolean isOptionalBoolean(){ + return this.optionalBoolean; + } + + public Integer getRequiredInteger(){ + return this.requiredInteger; + } + + public Integer getOptionalInteger(){ + return this.optionalInteger; + } + + public Long getRequiredLong(){ + return this.requiredLong; + } + + public Long getOptionalLong(){ + return this.optionalLong; + } + + public BigDecimal getRequiredDecimal(){ + return this.requiredDecimal; + } + + public BigDecimal getOptionalDecimal(){ + return this.optionalDecimal; + } + + public Float getRequiredFloat(){ + return this.requiredFloat; + } + + public Float getOptionalFloat(){ + return this.optionalFloat; + } + + public Double getRequiredDouble(){ + return this.requiredDouble; + } + + public Double getOptionalDouble(){ + return this.optionalDouble; + } + + public LocalDate getRequiredDate(){ + return this.requiredDate; + } + + public LocalDate getOptionalDate(){ + return this.optionalDate; + } + + public LocalTime getRequiredTime(){ + return this.requiredTime; + } + + public LocalTime getOptionalTime(){ + return this.optionalTime; + } + + public LocalDateTime getRequiredDatetime(){ + return this.requiredDatetime; + } + + public LocalDateTime getOptionalDatetime(){ + return this.optionalDatetime; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public ScalarTypeProbe updateTypePlatform(TypePlatform typePlatform){ + if(isPropertyLoaded(TYPE_PLATFORM_PROPERTY) && Objects.equals(this.typePlatform, typePlatform)){ + return this; + } + handleUpdate(TYPE_PLATFORM_PROPERTY, getTypePlatform(), typePlatform); + this.typePlatform = typePlatform; + return this; + } + + public ScalarTypeProbe updateRequiredString(String requiredString){ + requiredString = (requiredString == null ? null : requiredString.trim()); + if(isPropertyLoaded(REQUIRED_STRING_PROPERTY) && Objects.equals(this.requiredString, requiredString)){ + return this; + } + handleUpdate(REQUIRED_STRING_PROPERTY, getRequiredString(), requiredString); + this.requiredString = requiredString; + return this; + } + + public ScalarTypeProbe updateOptionalString(String optionalString){ + optionalString = (optionalString == null ? null : optionalString.trim()); + if(isPropertyLoaded(OPTIONAL_STRING_PROPERTY) && Objects.equals(this.optionalString, optionalString)){ + return this; + } + handleUpdate(OPTIONAL_STRING_PROPERTY, getOptionalString(), optionalString); + this.optionalString = optionalString; + return this; + } + + public ScalarTypeProbe updateLargeText(String largeText){ + if(isPropertyLoaded(LARGE_TEXT_PROPERTY) && Objects.equals(this.largeText, largeText)){ + return this; + } + handleUpdate(LARGE_TEXT_PROPERTY, getLargeText(), largeText); + this.largeText = largeText; + return this; + } + + public ScalarTypeProbe updateRequiredBoolean(Boolean requiredBoolean){ + if(isPropertyLoaded(REQUIRED_BOOLEAN_PROPERTY) && Objects.equals(this.requiredBoolean, requiredBoolean)){ + return this; + } + handleUpdate(REQUIRED_BOOLEAN_PROPERTY, isRequiredBoolean(), requiredBoolean); + this.requiredBoolean = requiredBoolean; + return this; + } + + public ScalarTypeProbe updateOptionalBoolean(Boolean optionalBoolean){ + if(isPropertyLoaded(OPTIONAL_BOOLEAN_PROPERTY) && Objects.equals(this.optionalBoolean, optionalBoolean)){ + return this; + } + handleUpdate(OPTIONAL_BOOLEAN_PROPERTY, isOptionalBoolean(), optionalBoolean); + this.optionalBoolean = optionalBoolean; + return this; + } + + public ScalarTypeProbe updateRequiredInteger(Integer requiredInteger){ + if(isPropertyLoaded(REQUIRED_INTEGER_PROPERTY) && Objects.equals(this.requiredInteger, requiredInteger)){ + return this; + } + handleUpdate(REQUIRED_INTEGER_PROPERTY, getRequiredInteger(), requiredInteger); + this.requiredInteger = requiredInteger; + return this; + } + + public ScalarTypeProbe updateOptionalInteger(Integer optionalInteger){ + if(isPropertyLoaded(OPTIONAL_INTEGER_PROPERTY) && Objects.equals(this.optionalInteger, optionalInteger)){ + return this; + } + handleUpdate(OPTIONAL_INTEGER_PROPERTY, getOptionalInteger(), optionalInteger); + this.optionalInteger = optionalInteger; + return this; + } + + public ScalarTypeProbe updateRequiredLong(Long requiredLong){ + if(isPropertyLoaded(REQUIRED_LONG_PROPERTY) && Objects.equals(this.requiredLong, requiredLong)){ + return this; + } + handleUpdate(REQUIRED_LONG_PROPERTY, getRequiredLong(), requiredLong); + this.requiredLong = requiredLong; + return this; + } + + public ScalarTypeProbe updateOptionalLong(Long optionalLong){ + if(isPropertyLoaded(OPTIONAL_LONG_PROPERTY) && Objects.equals(this.optionalLong, optionalLong)){ + return this; + } + handleUpdate(OPTIONAL_LONG_PROPERTY, getOptionalLong(), optionalLong); + this.optionalLong = optionalLong; + return this; + } + + public ScalarTypeProbe updateRequiredDecimal(BigDecimal requiredDecimal){ + if(isPropertyLoaded(REQUIRED_DECIMAL_PROPERTY) && Objects.equals(this.requiredDecimal, requiredDecimal)){ + return this; + } + handleUpdate(REQUIRED_DECIMAL_PROPERTY, getRequiredDecimal(), requiredDecimal); + this.requiredDecimal = requiredDecimal; + return this; + } + + public ScalarTypeProbe updateOptionalDecimal(BigDecimal optionalDecimal){ + if(isPropertyLoaded(OPTIONAL_DECIMAL_PROPERTY) && Objects.equals(this.optionalDecimal, optionalDecimal)){ + return this; + } + handleUpdate(OPTIONAL_DECIMAL_PROPERTY, getOptionalDecimal(), optionalDecimal); + this.optionalDecimal = optionalDecimal; + return this; + } + + public ScalarTypeProbe updateRequiredFloat(Float requiredFloat){ + if(isPropertyLoaded(REQUIRED_FLOAT_PROPERTY) && Objects.equals(this.requiredFloat, requiredFloat)){ + return this; + } + handleUpdate(REQUIRED_FLOAT_PROPERTY, getRequiredFloat(), requiredFloat); + this.requiredFloat = requiredFloat; + return this; + } + + public ScalarTypeProbe updateOptionalFloat(Float optionalFloat){ + if(isPropertyLoaded(OPTIONAL_FLOAT_PROPERTY) && Objects.equals(this.optionalFloat, optionalFloat)){ + return this; + } + handleUpdate(OPTIONAL_FLOAT_PROPERTY, getOptionalFloat(), optionalFloat); + this.optionalFloat = optionalFloat; + return this; + } + + public ScalarTypeProbe updateRequiredDouble(Double requiredDouble){ + if(isPropertyLoaded(REQUIRED_DOUBLE_PROPERTY) && Objects.equals(this.requiredDouble, requiredDouble)){ + return this; + } + handleUpdate(REQUIRED_DOUBLE_PROPERTY, getRequiredDouble(), requiredDouble); + this.requiredDouble = requiredDouble; + return this; + } + + public ScalarTypeProbe updateOptionalDouble(Double optionalDouble){ + if(isPropertyLoaded(OPTIONAL_DOUBLE_PROPERTY) && Objects.equals(this.optionalDouble, optionalDouble)){ + return this; + } + handleUpdate(OPTIONAL_DOUBLE_PROPERTY, getOptionalDouble(), optionalDouble); + this.optionalDouble = optionalDouble; + return this; + } + + public ScalarTypeProbe updateRequiredDate(LocalDate requiredDate){ + if(isPropertyLoaded(REQUIRED_DATE_PROPERTY) && Objects.equals(this.requiredDate, requiredDate)){ + return this; + } + handleUpdate(REQUIRED_DATE_PROPERTY, getRequiredDate(), requiredDate); + this.requiredDate = requiredDate; + return this; + } + + public ScalarTypeProbe updateOptionalDate(LocalDate optionalDate){ + if(isPropertyLoaded(OPTIONAL_DATE_PROPERTY) && Objects.equals(this.optionalDate, optionalDate)){ + return this; + } + handleUpdate(OPTIONAL_DATE_PROPERTY, getOptionalDate(), optionalDate); + this.optionalDate = optionalDate; + return this; + } + + public ScalarTypeProbe updateRequiredTime(LocalTime requiredTime){ + if(isPropertyLoaded(REQUIRED_TIME_PROPERTY) && Objects.equals(this.requiredTime, requiredTime)){ + return this; + } + handleUpdate(REQUIRED_TIME_PROPERTY, getRequiredTime(), requiredTime); + this.requiredTime = requiredTime; + return this; + } + + public ScalarTypeProbe updateOptionalTime(LocalTime optionalTime){ + if(isPropertyLoaded(OPTIONAL_TIME_PROPERTY) && Objects.equals(this.optionalTime, optionalTime)){ + return this; + } + handleUpdate(OPTIONAL_TIME_PROPERTY, getOptionalTime(), optionalTime); + this.optionalTime = optionalTime; + return this; + } + + public ScalarTypeProbe updateRequiredDatetime(LocalDateTime requiredDatetime){ + if(isPropertyLoaded(REQUIRED_DATETIME_PROPERTY) && Objects.equals(this.requiredDatetime, requiredDatetime)){ + return this; + } + handleUpdate(REQUIRED_DATETIME_PROPERTY, getRequiredDatetime(), requiredDatetime); + this.requiredDatetime = requiredDatetime; + return this; + } + + public ScalarTypeProbe updateOptionalDatetime(LocalDateTime optionalDatetime){ + if(isPropertyLoaded(OPTIONAL_DATETIME_PROPERTY) && Objects.equals(this.optionalDatetime, optionalDatetime)){ + return this; + } + handleUpdate(OPTIONAL_DATETIME_PROPERTY, getOptionalDatetime(), optionalDatetime); + this.optionalDatetime = optionalDatetime; + return this; + } + + public ScalarTypeProbe updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public ScalarTypeProbe updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static ScalarTypeProbe refer(Long id){ + ScalarTypeProbe refer = new ScalarTypeProbe(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public ScalarTypeProbe 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 "type_platform": this.typePlatform = (TypePlatform) value; break; + + case "required_string": this.requiredString = (value == null ? null : ((String)value).trim()); break; + + case "optional_string": this.optionalString = (value == null ? null : ((String)value).trim()); break; + + case "large_text": this.largeText = (String) value; break; + + case "required_boolean": this.requiredBoolean = (Boolean) value; break; + + case "optional_boolean": this.optionalBoolean = (Boolean) value; break; + + case "required_integer": this.requiredInteger = (Integer) value; break; + + case "optional_integer": this.optionalInteger = (Integer) value; break; + + case "required_long": this.requiredLong = (Long) value; break; + + case "optional_long": this.optionalLong = (Long) value; break; + + case "required_decimal": this.requiredDecimal = (BigDecimal) value; break; + + case "optional_decimal": this.optionalDecimal = (BigDecimal) value; break; + + case "required_float": this.requiredFloat = (Float) value; break; + + case "optional_float": this.optionalFloat = (Float) value; break; + + case "required_double": this.requiredDouble = (Double) value; break; + + case "optional_double": this.optionalDouble = (Double) value; break; + + case "required_date": this.requiredDate = (LocalDate) value; break; + + case "optional_date": this.optionalDate = (LocalDate) value; break; + + case "required_time": this.requiredTime = (LocalTime) value; break; + + case "optional_time": this.optionalTime = (LocalTime) value; break; + + case "required_datetime": this.requiredDatetime = (LocalDateTime) value; break; + + case "optional_datetime": this.optionalDatetime = (LocalDateTime) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "type_platform": return this.typePlatform; + case "required_string": return this.requiredString; + case "optional_string": return this.optionalString; + case "large_text": return this.largeText; + case "required_boolean": return this.requiredBoolean; + case "optional_boolean": return this.optionalBoolean; + case "required_integer": return this.requiredInteger; + case "optional_integer": return this.optionalInteger; + case "required_long": return this.requiredLong; + case "optional_long": return this.optionalLong; + case "required_decimal": return this.requiredDecimal; + case "optional_decimal": return this.optionalDecimal; + case "required_float": return this.requiredFloat; + case "optional_float": return this.optionalFloat; + case "required_double": return this.requiredDouble; + case "optional_double": return this.optionalDouble; + case "required_date": return this.requiredDate; + case "optional_date": return this.optionalDate; + case "required_time": return this.requiredTime; + case "optional_time": return this.optionalTime; + case "required_datetime": return this.requiredDatetime; + case "optional_datetime": return this.optionalDatetime; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java new file mode 100644 index 000000000..3ad70ad88 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -0,0 +1,282 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class ScalarTypeProbeChecker implements Checker{ + + public String type(){ + return ScalarTypeProbe.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if(needCheck(_context, scalarTypeProbe)){ + markAsChecked(_context, scalarTypeProbe); + doCheck(_context, scalarTypeProbe, _parentLocation); + } + } + + public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, ObjectLocation _parentLocation){ + if((scalarTypeProbe == null)){ + return; + } + if(scalarTypeProbe.needPersist()){ + } + if(scalarTypeProbe.newItem()){ + if(scalarTypeProbe.getCreateTime() == null){ + scalarTypeProbe.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + }if(scalarTypeProbe.getUpdateTime() == null){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + } + }else if(scalarTypeProbe.updateItem()){ + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_string")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_string"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("large_text")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "large_text"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_boolean")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_boolean"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_integer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_integer"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_long")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_long"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_decimal")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_decimal"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_float")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_float"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_double")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_double"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_date"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("required_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "required_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("optional_datetime")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "optional_datetime"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!scalarTypeProbe.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkTypePlatform(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY), newLocation(_parentLocation, "type_platform")); + checkRequiredString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY), newLocation(_parentLocation, "required_string")); + checkOptionalString(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY), newLocation(_parentLocation, "optional_string")); + checkLargeText(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY), newLocation(_parentLocation, "large_text")); + checkRequiredBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY), newLocation(_parentLocation, "required_boolean")); + checkOptionalBoolean(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY), newLocation(_parentLocation, "optional_boolean")); + checkRequiredInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY), newLocation(_parentLocation, "required_integer")); + checkOptionalInteger(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY), newLocation(_parentLocation, "optional_integer")); + checkRequiredLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY), newLocation(_parentLocation, "required_long")); + checkOptionalLong(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY), newLocation(_parentLocation, "optional_long")); + checkRequiredDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY), newLocation(_parentLocation, "required_decimal")); + checkOptionalDecimal(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY), newLocation(_parentLocation, "optional_decimal")); + checkRequiredFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY), newLocation(_parentLocation, "required_float")); + checkOptionalFloat(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY), newLocation(_parentLocation, "optional_float")); + checkRequiredDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY), newLocation(_parentLocation, "required_double")); + checkOptionalDouble(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY), newLocation(_parentLocation, "optional_double")); + checkRequiredDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY), newLocation(_parentLocation, "required_date")); + checkOptionalDate(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY), newLocation(_parentLocation, "optional_date")); + checkRequiredTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY), newLocation(_parentLocation, "required_time")); + checkOptionalTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY), newLocation(_parentLocation, "optional_time")); + checkRequiredDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY), newLocation(_parentLocation, "required_datetime")); + checkOptionalDatetime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY), newLocation(_parentLocation, "optional_datetime")); + checkCreateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, scalarTypeProbe.getProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkTypePlatform(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, typePlatform); + if((typePlatform == null)){ + return; + } + new TypePlatformChecker().checkAndFix(_context, typePlatform, _parentLocation); + } + public void checkRequiredString(UserContext _context, String requiredString, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredString); + if((requiredString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, requiredString); + + } + public void checkOptionalString(UserContext _context, String optionalString, ObjectLocation _parentLocation){ + if((optionalString == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, optionalString); + + } + public void checkLargeText(UserContext _context, String largeText, ObjectLocation _parentLocation){ + if((largeText == null)){ + return; + } + } + public void checkRequiredBoolean(UserContext _context, Boolean requiredBoolean, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredBoolean); + if((requiredBoolean == null)){ + return; + } + } + public void checkOptionalBoolean(UserContext _context, Boolean optionalBoolean, ObjectLocation _parentLocation){ + if((optionalBoolean == null)){ + return; + } + } + public void checkRequiredInteger(UserContext _context, Integer requiredInteger, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredInteger); + if((requiredInteger == null)){ + return; + } + } + public void checkOptionalInteger(UserContext _context, Integer optionalInteger, ObjectLocation _parentLocation){ + if((optionalInteger == null)){ + return; + } + } + public void checkRequiredLong(UserContext _context, Long requiredLong, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredLong); + if((requiredLong == null)){ + return; + } + } + public void checkOptionalLong(UserContext _context, Long optionalLong, ObjectLocation _parentLocation){ + if((optionalLong == null)){ + return; + } + } + public void checkRequiredDecimal(UserContext _context, BigDecimal requiredDecimal, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDecimal); + if((requiredDecimal == null)){ + return; + } + } + public void checkOptionalDecimal(UserContext _context, BigDecimal optionalDecimal, ObjectLocation _parentLocation){ + if((optionalDecimal == null)){ + return; + } + } + public void checkRequiredFloat(UserContext _context, Float requiredFloat, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredFloat); + if((requiredFloat == null)){ + return; + } + } + public void checkOptionalFloat(UserContext _context, Float optionalFloat, ObjectLocation _parentLocation){ + if((optionalFloat == null)){ + return; + } + } + public void checkRequiredDouble(UserContext _context, Double requiredDouble, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDouble); + if((requiredDouble == null)){ + return; + } + } + public void checkOptionalDouble(UserContext _context, Double optionalDouble, ObjectLocation _parentLocation){ + if((optionalDouble == null)){ + return; + } + } + public void checkRequiredDate(UserContext _context, LocalDate requiredDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDate); + if((requiredDate == null)){ + return; + } + } + public void checkOptionalDate(UserContext _context, LocalDate optionalDate, ObjectLocation _parentLocation){ + if((optionalDate == null)){ + return; + } + } + public void checkRequiredTime(UserContext _context, LocalTime requiredTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredTime); + if((requiredTime == null)){ + return; + } + } + public void checkOptionalTime(UserContext _context, LocalTime optionalTime, ObjectLocation _parentLocation){ + if((optionalTime == null)){ + return; + } + } + public void checkRequiredDatetime(UserContext _context, LocalDateTime requiredDatetime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requiredDatetime); + if((requiredDatetime == null)){ + return; + } + } + public void checkOptionalDatetime(UserContext _context, LocalDateTime optionalDatetime, ObjectLocation _parentLocation){ + if((optionalDatetime == null)){ + return; + } + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java new file mode 100644 index 000000000..4ff37872d --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java @@ -0,0 +1,211 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.function.Function; + +public class ScalarTypeProbeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public ScalarTypeProbeExpression(Expression expression){ + super(expression); + } + + public ScalarTypeProbeExpression(Expression expression, Function function){ + super(expression, function); + } + + public ScalarTypeProbeExpression updateId(Long id){ + return new ScalarTypeProbeExpression(this, $it -> {((ScalarTypeProbe)$it).__internalSet("id", id); return this;}); + } + + public ScalarTypeProbeExpression save(UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs("Saved by Expression").save(userContext)); + } + + public ScalarTypeProbeExpression save(String intent, UserContext userContext){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public TypePlatformExpression getTypePlatform(){ + return new TypePlatformExpression(loaded("type_platform", "getTypePlatform", ScalarTypeProbe::getTypePlatform)); + } + + public ScalarTypeProbeExpression updateTypePlatform(TypePlatform typePlatform){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateTypePlatform(typePlatform)); + } + + public Expression getRequiredString(){ + return loaded("required_string", "getRequiredString", ScalarTypeProbe::getRequiredString); + } + public ScalarTypeProbeExpression updateRequiredString(String requiredString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredString(requiredString)); + } + + public Expression getOptionalString(){ + return loaded("optional_string", "getOptionalString", ScalarTypeProbe::getOptionalString); + } + public ScalarTypeProbeExpression updateOptionalString(String optionalString){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalString(optionalString)); + } + + public Expression getLargeText(){ + return loaded("large_text", "getLargeText", ScalarTypeProbe::getLargeText); + } + public ScalarTypeProbeExpression updateLargeText(String largeText){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateLargeText(largeText)); + } + + public Expression isRequiredBoolean(){ + return loaded("required_boolean", "isRequiredBoolean", ScalarTypeProbe::isRequiredBoolean); + } + public ScalarTypeProbeExpression updateRequiredBoolean(Boolean requiredBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredBoolean(requiredBoolean)); + } + + public Expression isOptionalBoolean(){ + return loaded("optional_boolean", "isOptionalBoolean", ScalarTypeProbe::isOptionalBoolean); + } + public ScalarTypeProbeExpression updateOptionalBoolean(Boolean optionalBoolean){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalBoolean(optionalBoolean)); + } + + public Expression getRequiredInteger(){ + return loaded("required_integer", "getRequiredInteger", ScalarTypeProbe::getRequiredInteger); + } + public ScalarTypeProbeExpression updateRequiredInteger(Integer requiredInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredInteger(requiredInteger)); + } + + public Expression getOptionalInteger(){ + return loaded("optional_integer", "getOptionalInteger", ScalarTypeProbe::getOptionalInteger); + } + public ScalarTypeProbeExpression updateOptionalInteger(Integer optionalInteger){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalInteger(optionalInteger)); + } + + public Expression getRequiredLong(){ + return loaded("required_long", "getRequiredLong", ScalarTypeProbe::getRequiredLong); + } + public ScalarTypeProbeExpression updateRequiredLong(Long requiredLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredLong(requiredLong)); + } + + public Expression getOptionalLong(){ + return loaded("optional_long", "getOptionalLong", ScalarTypeProbe::getOptionalLong); + } + public ScalarTypeProbeExpression updateOptionalLong(Long optionalLong){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalLong(optionalLong)); + } + + public Expression getRequiredDecimal(){ + return loaded("required_decimal", "getRequiredDecimal", ScalarTypeProbe::getRequiredDecimal); + } + public ScalarTypeProbeExpression updateRequiredDecimal(BigDecimal requiredDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDecimal(requiredDecimal)); + } + + public Expression getOptionalDecimal(){ + return loaded("optional_decimal", "getOptionalDecimal", ScalarTypeProbe::getOptionalDecimal); + } + public ScalarTypeProbeExpression updateOptionalDecimal(BigDecimal optionalDecimal){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDecimal(optionalDecimal)); + } + + public Expression getRequiredFloat(){ + return loaded("required_float", "getRequiredFloat", ScalarTypeProbe::getRequiredFloat); + } + public ScalarTypeProbeExpression updateRequiredFloat(Float requiredFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredFloat(requiredFloat)); + } + + public Expression getOptionalFloat(){ + return loaded("optional_float", "getOptionalFloat", ScalarTypeProbe::getOptionalFloat); + } + public ScalarTypeProbeExpression updateOptionalFloat(Float optionalFloat){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalFloat(optionalFloat)); + } + + public Expression getRequiredDouble(){ + return loaded("required_double", "getRequiredDouble", ScalarTypeProbe::getRequiredDouble); + } + public ScalarTypeProbeExpression updateRequiredDouble(Double requiredDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDouble(requiredDouble)); + } + + public Expression getOptionalDouble(){ + return loaded("optional_double", "getOptionalDouble", ScalarTypeProbe::getOptionalDouble); + } + public ScalarTypeProbeExpression updateOptionalDouble(Double optionalDouble){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDouble(optionalDouble)); + } + + public Expression getRequiredDate(){ + return loaded("required_date", "getRequiredDate", ScalarTypeProbe::getRequiredDate); + } + public ScalarTypeProbeExpression updateRequiredDate(LocalDate requiredDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDate(requiredDate)); + } + + public Expression getOptionalDate(){ + return loaded("optional_date", "getOptionalDate", ScalarTypeProbe::getOptionalDate); + } + public ScalarTypeProbeExpression updateOptionalDate(LocalDate optionalDate){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDate(optionalDate)); + } + + public Expression getRequiredTime(){ + return loaded("required_time", "getRequiredTime", ScalarTypeProbe::getRequiredTime); + } + public ScalarTypeProbeExpression updateRequiredTime(LocalTime requiredTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredTime(requiredTime)); + } + + public Expression getOptionalTime(){ + return loaded("optional_time", "getOptionalTime", ScalarTypeProbe::getOptionalTime); + } + public ScalarTypeProbeExpression updateOptionalTime(LocalTime optionalTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalTime(optionalTime)); + } + + public Expression getRequiredDatetime(){ + return loaded("required_datetime", "getRequiredDatetime", ScalarTypeProbe::getRequiredDatetime); + } + public ScalarTypeProbeExpression updateRequiredDatetime(LocalDateTime requiredDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateRequiredDatetime(requiredDatetime)); + } + + public Expression getOptionalDatetime(){ + return loaded("optional_datetime", "getOptionalDatetime", ScalarTypeProbe::getOptionalDatetime); + } + public ScalarTypeProbeExpression updateOptionalDatetime(LocalDateTime optionalDatetime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateOptionalDatetime(optionalDatetime)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", ScalarTypeProbe::getCreateTime); + } + public ScalarTypeProbeExpression updateCreateTime(LocalDateTime createTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", ScalarTypeProbe::getUpdateTime); + } + public ScalarTypeProbeExpression updateUpdateTime(LocalDateTime updateTime){ + return new ScalarTypeProbeExpression(this, $it -> ((ScalarTypeProbe)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java new file mode 100644 index 000000000..8f2542a82 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class ScalarTypeProbeListExpression extends SmartListExpression { + public ScalarTypeProbeListExpression(Expression> expression){ + super(expression); + } + + public ScalarTypeProbeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public ScalarTypeProbeExpression first() { + return new ScalarTypeProbeExpression(super.first()); + } + + public ScalarTypeProbeExpression get(int index) { + return new ScalarTypeProbeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java new file mode 100644 index 000000000..6a60aaedd --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -0,0 +1,3766 @@ + +package com.example.scalartypeconformanceservice.scalartypeprobe; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatform; +import com.example.scalartypeconformanceservice.typeplatform.TypePlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; + +public class ScalarTypeProbeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest(Class returnType){ + this(returnType, () -> (T) new ScalarTypeProbe()); + } + + protected ScalarTypeProbeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public ScalarTypeProbeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public ScalarTypeProbeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public ScalarTypeProbeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public ScalarTypeProbeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public ScalarTypeProbeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public ScalarTypeProbeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public ScalarTypeProbeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (ScalarTypeProbeRequest)super.appendSearchCriteria(searchCriteria); + } + + public ScalarTypeProbeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarTypeProbe){ + super.internalMatchAny(scalarTypeProbe); + return this; + } + + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public ScalarTypeProbeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public ScalarTypeProbeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public ScalarTypeProbeRequest selectSelf(){ + super.selectSelf(); + return selectId().selectTypePlatformIdOnly().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectSelfFields(){ + return selectSelf(); + } + + public ScalarTypeProbeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(ScalarTypeProbe.ID_PROPERTY); + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectAll(){ + super.selectAll(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ScalarTypeProbeRequest selectChildren(){ + super.selectAny(); + return selectId().selectTypePlatform().selectRequiredString().selectOptionalString().selectLargeText().selectRequiredBoolean().selectOptionalBoolean().selectRequiredInteger().selectOptionalInteger().selectRequiredLong().selectOptionalLong().selectRequiredDecimal().selectOptionalDecimal().selectRequiredFloat().selectOptionalFloat().selectRequiredDouble().selectOptionalDouble().selectRequiredDate().selectOptionalDate().selectRequiredTime().selectOptionalTime().selectRequiredDatetime().selectOptionalDatetime().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public ScalarTypeProbeRequest selectId(){ + selectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectId(){ + unselectProperty(ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectTypePlatformIdOnly(){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest selectTypePlatform(){ + return selectTypePlatformWith(Q.typePlatforms().unlimited().selectSelf()); + } + + public ScalarTypeProbeRequest selectTypePlatformWith(TypePlatformRequest typePlatform){ + selectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + enhanceRelation(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTypePlatformWith", null, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + public ScalarTypeProbeRequest unselectTypePlatform(){ + unselectProperty(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredString(){ + selectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + /** + * fill the requiredString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredString) to fetch requiredString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredString(){ + unselectProperty(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalString(){ + selectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + /** + * fill the optionalString with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalString) to fetch optionalString property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalString(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectLargeText(){ + selectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + /** + * fill the largeText with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS largeText) to fetch largeText property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectLargeText(){ + unselectProperty(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredBoolean(){ + selectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the requiredBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredBoolean) to fetch requiredBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredBoolean(){ + unselectProperty(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalBoolean(){ + selectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + /** + * fill the optionalBoolean with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalBoolean) to fetch optionalBoolean property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalBoolean(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredInteger(){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + /** + * fill the requiredInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredInteger) to fetch requiredInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredInteger) AS requiredInteger to fetch requiredInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredInteger(){ + unselectProperty(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalInteger(){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + /** + * fill the optionalInteger with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalInteger) to fetch optionalInteger property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalInteger with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalInteger) AS optionalInteger to fetch optionalInteger property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalInteger(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalInteger(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredLong(){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + /** + * fill the requiredLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredLong) to fetch requiredLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredLong with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredLong) AS requiredLong to fetch requiredLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredLong(){ + unselectProperty(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalLong(){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + /** + * fill the optionalLong with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalLong) to fetch optionalLong property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalLong with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalLong) AS optionalLong to fetch optionalLong property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalLong(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalLong(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDecimal(){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the requiredDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDecimal) to fetch requiredDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDecimal) AS requiredDecimal to fetch requiredDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDecimal(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDecimal(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + /** + * fill the optionalDecimal with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDecimal) to fetch optionalDecimal property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDecimal with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDecimal) AS optionalDecimal to fetch optionalDecimal property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDecimal(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDecimal(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredFloat(){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + /** + * fill the requiredFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredFloat) to fetch requiredFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredFloat) AS requiredFloat to fetch requiredFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredFloat(){ + unselectProperty(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalFloat(){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + /** + * fill the optionalFloat with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalFloat) to fetch optionalFloat property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalFloat with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalFloat) AS optionalFloat to fetch optionalFloat property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalFloat(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalFloat(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDouble(){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the requiredDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDouble) to fetch requiredDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the requiredDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(requiredDouble) AS requiredDouble to fetch requiredDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectRequiredDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectRequiredDouble(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDouble(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + /** + * fill the optionalDouble with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDouble) to fetch optionalDouble property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the optionalDouble with customized aggrFunction, TEAQL uses ({aggrFunction}(optionalDouble) AS optionalDouble to fetch optionalDouble property. + * @param aggrFunction aggrFunction + */ + public ScalarTypeProbeRequest selectOptionalDouble(AggrFunction aggrFunction){ + selectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, aggrFunction); + return this; + } + + + public ScalarTypeProbeRequest unselectOptionalDouble(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDate(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + /** + * fill the requiredDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDate) to fetch requiredDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDate(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDate(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + /** + * fill the optionalDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDate) to fetch optionalDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDate(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredTime(){ + selectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + /** + * fill the requiredTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredTime) to fetch requiredTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredTime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalTime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + /** + * fill the optionalTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalTime) to fetch optionalTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalTime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectRequiredDatetime(){ + selectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + /** + * fill the requiredDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requiredDatetime) to fetch requiredDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectRequiredDatetime(){ + unselectProperty(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectOptionalDatetime(){ + selectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + /** + * fill the optionalDatetime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS optionalDatetime) to fetch optionalDatetime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectOptionalDatetime(){ + unselectProperty(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectCreateTime(){ + selectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectCreateTime(){ + unselectProperty(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectUpdateTime(){ + selectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectUpdateTime(){ + unselectProperty(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest selectVersion(){ + selectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ScalarTypeProbeRequest unselectVersion(){ + unselectProperty(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.ID_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public ScalarTypeProbeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public ScalarTypeProbeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public ScalarTypeProbeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public ScalarTypeProbeRequest filterByTypePlatform(TypePlatform... typePlatform){ + if (typePlatform == null || typePlatform.length == 0) { + throw new IllegalArgumentException("filterByTypePlatform parameter typePlatform cannot be empty"); + } + return appendSearchCriteria(createTypePlatformCriteria(Operator.EQUAL, (Object[])typePlatform)); + } + + public ScalarTypeProbeRequest withTypePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createTypePlatformCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withTypePlatformIsUnknown(){ + return withTypePlatform(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withTypePlatformIsKnown(){ + return withTypePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTypePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest filterByTypePlatform(Long typePlatform){ + if(typePlatform == null){ + return this; + } + return withTypePlatform(Operator.EQUAL, typePlatform); + } + public ScalarTypeProbeRequest withTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY)); + } + + public ScalarTypeProbeRequest withoutTypePlatformMatching(TypePlatformRequest typePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, TypePlatform.ID_PROPERTY))); + } + + public ScalarTypeProbeRequest filterByRequiredString(String... requiredString){ + if (requiredString == null || requiredString.length == 0) { + throw new IllegalArgumentException("filterByRequiredString parameter requiredString cannot be empty"); + } + return appendSearchCriteria(createRequiredStringCriteria(Operator.EQUAL, (Object[])requiredString)); + } + + public ScalarTypeProbeRequest withRequiredString(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredStringIsUnknown(){ + return withRequiredString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredStringIsKnown(){ + return withRequiredString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredStringIsNot(String requiredString){ + return withRequiredString(Operator.NOT_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIn(String... requiredString){ + return withRequiredString(Operator.IN, (Object[])requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotIn(String... requiredString){ + return withRequiredString(Operator.NOT_IN, (Object[])requiredString); + } + public ScalarTypeProbeRequest withRequiredStringGreaterThan(String requiredString){ + return withRequiredString(Operator.GREATER_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringGreaterThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.GREATER_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThan(String requiredString){ + return withRequiredString(Operator.LESS_THAN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringLessThanOrEqualTo(String requiredString){ + return withRequiredString(Operator.LESS_THAN_OR_EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringBetween(String startOfRequiredString, String endOfRequiredString){ + return withRequiredString(Operator.BETWEEN, startOfRequiredString, endOfRequiredString); + } + public ScalarTypeProbeRequest withRequiredStringStartingWith(String requiredString){ + return withRequiredString(Operator.BEGIN_WITH, requiredString); + } + public ScalarTypeProbeRequest withRequiredStringContaining(String requiredString){ + return withRequiredString(Operator.CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotContaining(String requiredString){ + return withRequiredString(Operator.NOT_CONTAIN, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotStartingWith(String requiredString){ + return withRequiredString(Operator.NOT_BEGIN_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringEndingWith(String requiredString){ + return withRequiredString(Operator.END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringNotEndingWith(String requiredString){ + return withRequiredString(Operator.NOT_END_WITH, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringIs(String requiredString){ + return withRequiredString(Operator.EQUAL, requiredString); + } + + public ScalarTypeProbeRequest withRequiredStringSoundingLike(String requiredString){ + return withRequiredString(Operator.SOUNDS_LIKE, requiredString); + } + + + + public ScalarTypeProbeRequest filterByOptionalString(String... optionalString){ + if (optionalString == null || optionalString.length == 0) { + throw new IllegalArgumentException("filterByOptionalString parameter optionalString cannot be empty"); + } + return appendSearchCriteria(createOptionalStringCriteria(Operator.EQUAL, (Object[])optionalString)); + } + + public ScalarTypeProbeRequest withOptionalString(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalStringCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalStringIsUnknown(){ + return withOptionalString(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalStringIsKnown(){ + return withOptionalString(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalStringCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalStringIsNot(String optionalString){ + return withOptionalString(Operator.NOT_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIn(String... optionalString){ + return withOptionalString(Operator.IN, (Object[])optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotIn(String... optionalString){ + return withOptionalString(Operator.NOT_IN, (Object[])optionalString); + } + public ScalarTypeProbeRequest withOptionalStringGreaterThan(String optionalString){ + return withOptionalString(Operator.GREATER_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringGreaterThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.GREATER_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThan(String optionalString){ + return withOptionalString(Operator.LESS_THAN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringLessThanOrEqualTo(String optionalString){ + return withOptionalString(Operator.LESS_THAN_OR_EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringBetween(String startOfOptionalString, String endOfOptionalString){ + return withOptionalString(Operator.BETWEEN, startOfOptionalString, endOfOptionalString); + } + public ScalarTypeProbeRequest withOptionalStringStartingWith(String optionalString){ + return withOptionalString(Operator.BEGIN_WITH, optionalString); + } + public ScalarTypeProbeRequest withOptionalStringContaining(String optionalString){ + return withOptionalString(Operator.CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotContaining(String optionalString){ + return withOptionalString(Operator.NOT_CONTAIN, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotStartingWith(String optionalString){ + return withOptionalString(Operator.NOT_BEGIN_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringEndingWith(String optionalString){ + return withOptionalString(Operator.END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringNotEndingWith(String optionalString){ + return withOptionalString(Operator.NOT_END_WITH, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringIs(String optionalString){ + return withOptionalString(Operator.EQUAL, optionalString); + } + + public ScalarTypeProbeRequest withOptionalStringSoundingLike(String optionalString){ + return withOptionalString(Operator.SOUNDS_LIKE, optionalString); + } + + + + public ScalarTypeProbeRequest filterByLargeText(String... largeText){ + if (largeText == null || largeText.length == 0) { + throw new IllegalArgumentException("filterByLargeText parameter largeText cannot be empty"); + } + return appendSearchCriteria(createLargeTextCriteria(Operator.EQUAL, (Object[])largeText)); + } + + public ScalarTypeProbeRequest withLargeText(Operator operator, Object... values){ + return appendSearchCriteria(createLargeTextCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withLargeTextIsUnknown(){ + return withLargeText(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withLargeTextIsKnown(){ + return withLargeText(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLargeTextCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.LARGE_TEXT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withLargeTextIsNot(String largeText){ + return withLargeText(Operator.NOT_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextIn(String... largeText){ + return withLargeText(Operator.IN, (Object[])largeText); + } + + public ScalarTypeProbeRequest withLargeTextNotIn(String... largeText){ + return withLargeText(Operator.NOT_IN, (Object[])largeText); + } + public ScalarTypeProbeRequest withLargeTextGreaterThan(String largeText){ + return withLargeText(Operator.GREATER_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextGreaterThanOrEqualTo(String largeText){ + return withLargeText(Operator.GREATER_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThan(String largeText){ + return withLargeText(Operator.LESS_THAN, largeText); + } + + public ScalarTypeProbeRequest withLargeTextLessThanOrEqualTo(String largeText){ + return withLargeText(Operator.LESS_THAN_OR_EQUAL, largeText); + } + + public ScalarTypeProbeRequest withLargeTextBetween(String startOfLargeText, String endOfLargeText){ + return withLargeText(Operator.BETWEEN, startOfLargeText, endOfLargeText); + } + public ScalarTypeProbeRequest withLargeTextIs(String largeText){ + return withLargeText(Operator.EQUAL, largeText); + } + + + + public ScalarTypeProbeRequest filterByRequiredBoolean(Boolean... requiredBoolean){ + if (requiredBoolean == null || requiredBoolean.length == 0) { + throw new IllegalArgumentException("filterByRequiredBoolean parameter requiredBoolean cannot be empty"); + } + return appendSearchCriteria(createRequiredBooleanCriteria(Operator.EQUAL, (Object[])requiredBoolean)); + } + + public ScalarTypeProbeRequest withRequiredBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsUnknown(){ + return withRequiredBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredBooleanIsKnown(){ + return withRequiredBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotRequiredBoolean(){ + return withRequiredBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByOptionalBoolean(Boolean... optionalBoolean){ + if (optionalBoolean == null || optionalBoolean.length == 0) { + throw new IllegalArgumentException("filterByOptionalBoolean parameter optionalBoolean cannot be empty"); + } + return appendSearchCriteria(createOptionalBooleanCriteria(Operator.EQUAL, (Object[])optionalBoolean)); + } + + public ScalarTypeProbeRequest withOptionalBoolean(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalBooleanCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsUnknown(){ + return withOptionalBoolean(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalBooleanIsKnown(){ + return withOptionalBoolean(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalBooleanCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest whichAreOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, true); + } + + public ScalarTypeProbeRequest whichAreNotOptionalBoolean(){ + return withOptionalBoolean(Operator.EQUAL, false); + } + + + public ScalarTypeProbeRequest filterByRequiredInteger(Integer... requiredInteger){ + if (requiredInteger == null || requiredInteger.length == 0) { + throw new IllegalArgumentException("filterByRequiredInteger parameter requiredInteger cannot be empty"); + } + return appendSearchCriteria(createRequiredIntegerCriteria(Operator.EQUAL, (Object[])requiredInteger)); + } + + public ScalarTypeProbeRequest withRequiredInteger(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsUnknown(){ + return withRequiredInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsKnown(){ + return withRequiredInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredIntegerIs(Integer requiredInteger){ + return withRequiredInteger(Operator.EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIsNot(Integer requiredInteger){ + return withRequiredInteger(Operator.NOT_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.IN, (Object[])requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerNotIn(Integer... requiredInteger){ + return withRequiredInteger(Operator.NOT_IN, (Object[])requiredInteger); + } + public ScalarTypeProbeRequest withRequiredIntegerGreaterThan(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerGreaterThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.GREATER_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThan(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerLessThanOrEqualTo(Integer requiredInteger){ + return withRequiredInteger(Operator.LESS_THAN_OR_EQUAL, requiredInteger); + } + + public ScalarTypeProbeRequest withRequiredIntegerBetween(Integer startOfRequiredInteger, Integer endOfRequiredInteger){ + return withRequiredInteger(Operator.BETWEEN, startOfRequiredInteger, endOfRequiredInteger); + } + + + + public ScalarTypeProbeRequest filterByOptionalInteger(Integer... optionalInteger){ + if (optionalInteger == null || optionalInteger.length == 0) { + throw new IllegalArgumentException("filterByOptionalInteger parameter optionalInteger cannot be empty"); + } + return appendSearchCriteria(createOptionalIntegerCriteria(Operator.EQUAL, (Object[])optionalInteger)); + } + + public ScalarTypeProbeRequest withOptionalInteger(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalIntegerCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsUnknown(){ + return withOptionalInteger(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsKnown(){ + return withOptionalInteger(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalIntegerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalIntegerIs(Integer optionalInteger){ + return withOptionalInteger(Operator.EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIsNot(Integer optionalInteger){ + return withOptionalInteger(Operator.NOT_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.IN, (Object[])optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerNotIn(Integer... optionalInteger){ + return withOptionalInteger(Operator.NOT_IN, (Object[])optionalInteger); + } + public ScalarTypeProbeRequest withOptionalIntegerGreaterThan(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerGreaterThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.GREATER_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThan(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerLessThanOrEqualTo(Integer optionalInteger){ + return withOptionalInteger(Operator.LESS_THAN_OR_EQUAL, optionalInteger); + } + + public ScalarTypeProbeRequest withOptionalIntegerBetween(Integer startOfOptionalInteger, Integer endOfOptionalInteger){ + return withOptionalInteger(Operator.BETWEEN, startOfOptionalInteger, endOfOptionalInteger); + } + + + + public ScalarTypeProbeRequest filterByRequiredLong(Long... requiredLong){ + if (requiredLong == null || requiredLong.length == 0) { + throw new IllegalArgumentException("filterByRequiredLong parameter requiredLong cannot be empty"); + } + return appendSearchCriteria(createRequiredLongCriteria(Operator.EQUAL, (Object[])requiredLong)); + } + + public ScalarTypeProbeRequest withRequiredLong(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredLongIsUnknown(){ + return withRequiredLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredLongIsKnown(){ + return withRequiredLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredLongIs(Long requiredLong){ + return withRequiredLong(Operator.EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIsNot(Long requiredLong){ + return withRequiredLong(Operator.NOT_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongIn(Long... requiredLong){ + return withRequiredLong(Operator.IN, (Object[])requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongNotIn(Long... requiredLong){ + return withRequiredLong(Operator.NOT_IN, (Object[])requiredLong); + } + public ScalarTypeProbeRequest withRequiredLongGreaterThan(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongGreaterThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.GREATER_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThan(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongLessThanOrEqualTo(Long requiredLong){ + return withRequiredLong(Operator.LESS_THAN_OR_EQUAL, requiredLong); + } + + public ScalarTypeProbeRequest withRequiredLongBetween(Long startOfRequiredLong, Long endOfRequiredLong){ + return withRequiredLong(Operator.BETWEEN, startOfRequiredLong, endOfRequiredLong); + } + + + + public ScalarTypeProbeRequest filterByOptionalLong(Long... optionalLong){ + if (optionalLong == null || optionalLong.length == 0) { + throw new IllegalArgumentException("filterByOptionalLong parameter optionalLong cannot be empty"); + } + return appendSearchCriteria(createOptionalLongCriteria(Operator.EQUAL, (Object[])optionalLong)); + } + + public ScalarTypeProbeRequest withOptionalLong(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalLongCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalLongIsUnknown(){ + return withOptionalLong(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalLongIsKnown(){ + return withOptionalLong(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalLongCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalLongIs(Long optionalLong){ + return withOptionalLong(Operator.EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIsNot(Long optionalLong){ + return withOptionalLong(Operator.NOT_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongIn(Long... optionalLong){ + return withOptionalLong(Operator.IN, (Object[])optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongNotIn(Long... optionalLong){ + return withOptionalLong(Operator.NOT_IN, (Object[])optionalLong); + } + public ScalarTypeProbeRequest withOptionalLongGreaterThan(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongGreaterThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.GREATER_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThan(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongLessThanOrEqualTo(Long optionalLong){ + return withOptionalLong(Operator.LESS_THAN_OR_EQUAL, optionalLong); + } + + public ScalarTypeProbeRequest withOptionalLongBetween(Long startOfOptionalLong, Long endOfOptionalLong){ + return withOptionalLong(Operator.BETWEEN, startOfOptionalLong, endOfOptionalLong); + } + + + + public ScalarTypeProbeRequest filterByRequiredDecimal(BigDecimal... requiredDecimal){ + if (requiredDecimal == null || requiredDecimal.length == 0) { + throw new IllegalArgumentException("filterByRequiredDecimal parameter requiredDecimal cannot be empty"); + } + return appendSearchCriteria(createRequiredDecimalCriteria(Operator.EQUAL, (Object[])requiredDecimal)); + } + + public ScalarTypeProbeRequest withRequiredDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsUnknown(){ + return withRequiredDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsKnown(){ + return withRequiredDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDecimalIs(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIsNot(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.NOT_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.IN, (Object[])requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalNotIn(BigDecimal... requiredDecimal){ + return withRequiredDecimal(Operator.NOT_IN, (Object[])requiredDecimal); + } + public ScalarTypeProbeRequest withRequiredDecimalGreaterThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalGreaterThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.GREATER_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThan(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalLessThanOrEqualTo(BigDecimal requiredDecimal){ + return withRequiredDecimal(Operator.LESS_THAN_OR_EQUAL, requiredDecimal); + } + + public ScalarTypeProbeRequest withRequiredDecimalBetween(BigDecimal startOfRequiredDecimal, BigDecimal endOfRequiredDecimal){ + return withRequiredDecimal(Operator.BETWEEN, startOfRequiredDecimal, endOfRequiredDecimal); + } + + + + public ScalarTypeProbeRequest filterByOptionalDecimal(BigDecimal... optionalDecimal){ + if (optionalDecimal == null || optionalDecimal.length == 0) { + throw new IllegalArgumentException("filterByOptionalDecimal parameter optionalDecimal cannot be empty"); + } + return appendSearchCriteria(createOptionalDecimalCriteria(Operator.EQUAL, (Object[])optionalDecimal)); + } + + public ScalarTypeProbeRequest withOptionalDecimal(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDecimalCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsUnknown(){ + return withOptionalDecimal(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsKnown(){ + return withOptionalDecimal(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDecimalCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDecimalIs(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIsNot(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.NOT_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.IN, (Object[])optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalNotIn(BigDecimal... optionalDecimal){ + return withOptionalDecimal(Operator.NOT_IN, (Object[])optionalDecimal); + } + public ScalarTypeProbeRequest withOptionalDecimalGreaterThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalGreaterThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.GREATER_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThan(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalLessThanOrEqualTo(BigDecimal optionalDecimal){ + return withOptionalDecimal(Operator.LESS_THAN_OR_EQUAL, optionalDecimal); + } + + public ScalarTypeProbeRequest withOptionalDecimalBetween(BigDecimal startOfOptionalDecimal, BigDecimal endOfOptionalDecimal){ + return withOptionalDecimal(Operator.BETWEEN, startOfOptionalDecimal, endOfOptionalDecimal); + } + + + + public ScalarTypeProbeRequest filterByRequiredFloat(Float... requiredFloat){ + if (requiredFloat == null || requiredFloat.length == 0) { + throw new IllegalArgumentException("filterByRequiredFloat parameter requiredFloat cannot be empty"); + } + return appendSearchCriteria(createRequiredFloatCriteria(Operator.EQUAL, (Object[])requiredFloat)); + } + + public ScalarTypeProbeRequest withRequiredFloat(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredFloatIsUnknown(){ + return withRequiredFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredFloatIsKnown(){ + return withRequiredFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredFloatIs(Float requiredFloat){ + return withRequiredFloat(Operator.EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIsNot(Float requiredFloat){ + return withRequiredFloat(Operator.NOT_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatIn(Float... requiredFloat){ + return withRequiredFloat(Operator.IN, (Object[])requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatNotIn(Float... requiredFloat){ + return withRequiredFloat(Operator.NOT_IN, (Object[])requiredFloat); + } + public ScalarTypeProbeRequest withRequiredFloatGreaterThan(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatGreaterThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.GREATER_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThan(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatLessThanOrEqualTo(Float requiredFloat){ + return withRequiredFloat(Operator.LESS_THAN_OR_EQUAL, requiredFloat); + } + + public ScalarTypeProbeRequest withRequiredFloatBetween(Float startOfRequiredFloat, Float endOfRequiredFloat){ + return withRequiredFloat(Operator.BETWEEN, startOfRequiredFloat, endOfRequiredFloat); + } + + + + public ScalarTypeProbeRequest filterByOptionalFloat(Float... optionalFloat){ + if (optionalFloat == null || optionalFloat.length == 0) { + throw new IllegalArgumentException("filterByOptionalFloat parameter optionalFloat cannot be empty"); + } + return appendSearchCriteria(createOptionalFloatCriteria(Operator.EQUAL, (Object[])optionalFloat)); + } + + public ScalarTypeProbeRequest withOptionalFloat(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalFloatCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalFloatIsUnknown(){ + return withOptionalFloat(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalFloatIsKnown(){ + return withOptionalFloat(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalFloatCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalFloatIs(Float optionalFloat){ + return withOptionalFloat(Operator.EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIsNot(Float optionalFloat){ + return withOptionalFloat(Operator.NOT_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatIn(Float... optionalFloat){ + return withOptionalFloat(Operator.IN, (Object[])optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatNotIn(Float... optionalFloat){ + return withOptionalFloat(Operator.NOT_IN, (Object[])optionalFloat); + } + public ScalarTypeProbeRequest withOptionalFloatGreaterThan(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatGreaterThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.GREATER_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThan(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatLessThanOrEqualTo(Float optionalFloat){ + return withOptionalFloat(Operator.LESS_THAN_OR_EQUAL, optionalFloat); + } + + public ScalarTypeProbeRequest withOptionalFloatBetween(Float startOfOptionalFloat, Float endOfOptionalFloat){ + return withOptionalFloat(Operator.BETWEEN, startOfOptionalFloat, endOfOptionalFloat); + } + + + + public ScalarTypeProbeRequest filterByRequiredDouble(Double... requiredDouble){ + if (requiredDouble == null || requiredDouble.length == 0) { + throw new IllegalArgumentException("filterByRequiredDouble parameter requiredDouble cannot be empty"); + } + return appendSearchCriteria(createRequiredDoubleCriteria(Operator.EQUAL, (Object[])requiredDouble)); + } + + public ScalarTypeProbeRequest withRequiredDouble(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsUnknown(){ + return withRequiredDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsKnown(){ + return withRequiredDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDoubleIs(Double requiredDouble){ + return withRequiredDouble(Operator.EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIsNot(Double requiredDouble){ + return withRequiredDouble(Operator.NOT_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleIn(Double... requiredDouble){ + return withRequiredDouble(Operator.IN, (Object[])requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleNotIn(Double... requiredDouble){ + return withRequiredDouble(Operator.NOT_IN, (Object[])requiredDouble); + } + public ScalarTypeProbeRequest withRequiredDoubleGreaterThan(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleGreaterThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.GREATER_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThan(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleLessThanOrEqualTo(Double requiredDouble){ + return withRequiredDouble(Operator.LESS_THAN_OR_EQUAL, requiredDouble); + } + + public ScalarTypeProbeRequest withRequiredDoubleBetween(Double startOfRequiredDouble, Double endOfRequiredDouble){ + return withRequiredDouble(Operator.BETWEEN, startOfRequiredDouble, endOfRequiredDouble); + } + + + + public ScalarTypeProbeRequest filterByOptionalDouble(Double... optionalDouble){ + if (optionalDouble == null || optionalDouble.length == 0) { + throw new IllegalArgumentException("filterByOptionalDouble parameter optionalDouble cannot be empty"); + } + return appendSearchCriteria(createOptionalDoubleCriteria(Operator.EQUAL, (Object[])optionalDouble)); + } + + public ScalarTypeProbeRequest withOptionalDouble(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDoubleCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsUnknown(){ + return withOptionalDouble(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsKnown(){ + return withOptionalDouble(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDoubleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDoubleIs(Double optionalDouble){ + return withOptionalDouble(Operator.EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIsNot(Double optionalDouble){ + return withOptionalDouble(Operator.NOT_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleIn(Double... optionalDouble){ + return withOptionalDouble(Operator.IN, (Object[])optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleNotIn(Double... optionalDouble){ + return withOptionalDouble(Operator.NOT_IN, (Object[])optionalDouble); + } + public ScalarTypeProbeRequest withOptionalDoubleGreaterThan(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleGreaterThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.GREATER_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThan(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleLessThanOrEqualTo(Double optionalDouble){ + return withOptionalDouble(Operator.LESS_THAN_OR_EQUAL, optionalDouble); + } + + public ScalarTypeProbeRequest withOptionalDoubleBetween(Double startOfOptionalDouble, Double endOfOptionalDouble){ + return withOptionalDouble(Operator.BETWEEN, startOfOptionalDouble, endOfOptionalDouble); + } + + + + public ScalarTypeProbeRequest filterByRequiredDate(LocalDate... requiredDate){ + if (requiredDate == null || requiredDate.length == 0) { + throw new IllegalArgumentException("filterByRequiredDate parameter requiredDate cannot be empty"); + } + return appendSearchCriteria(createRequiredDateCriteria(Operator.EQUAL, (Object[])requiredDate)); + } + + public ScalarTypeProbeRequest withRequiredDate(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDateIsUnknown(){ + return withRequiredDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDateIsKnown(){ + return withRequiredDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDateIs(LocalDate requiredDate){ + return withRequiredDate(Operator.EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIsNot(LocalDate requiredDate){ + return withRequiredDate(Operator.NOT_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.IN, (Object[])requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateNotIn(LocalDate... requiredDate){ + return withRequiredDate(Operator.NOT_IN, (Object[])requiredDate); + } + public ScalarTypeProbeRequest withRequiredDateGreaterThan(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateGreaterThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThan(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateLessThanOrEqualTo(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN_OR_EQUAL, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(LocalDate startOfRequiredDate, LocalDate endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + public ScalarTypeProbeRequest withRequiredDateBefore(LocalDate requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBefore(Date requiredDate){ + return withRequiredDate(Operator.LESS_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(LocalDate requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateAfter(Date requiredDate){ + return withRequiredDate(Operator.GREATER_THAN, requiredDate); + } + + public ScalarTypeProbeRequest withRequiredDateBetween(Date startOfRequiredDate, Date endOfRequiredDate){ + return withRequiredDate(Operator.BETWEEN, startOfRequiredDate, endOfRequiredDate); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDate(LocalDate... optionalDate){ + if (optionalDate == null || optionalDate.length == 0) { + throw new IllegalArgumentException("filterByOptionalDate parameter optionalDate cannot be empty"); + } + return appendSearchCriteria(createOptionalDateCriteria(Operator.EQUAL, (Object[])optionalDate)); + } + + public ScalarTypeProbeRequest withOptionalDate(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDateCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDateIsUnknown(){ + return withOptionalDate(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDateIsKnown(){ + return withOptionalDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDateIs(LocalDate optionalDate){ + return withOptionalDate(Operator.EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIsNot(LocalDate optionalDate){ + return withOptionalDate(Operator.NOT_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.IN, (Object[])optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateNotIn(LocalDate... optionalDate){ + return withOptionalDate(Operator.NOT_IN, (Object[])optionalDate); + } + public ScalarTypeProbeRequest withOptionalDateGreaterThan(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateGreaterThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThan(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateLessThanOrEqualTo(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN_OR_EQUAL, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(LocalDate startOfOptionalDate, LocalDate endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + public ScalarTypeProbeRequest withOptionalDateBefore(LocalDate optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBefore(Date optionalDate){ + return withOptionalDate(Operator.LESS_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(LocalDate optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateAfter(Date optionalDate){ + return withOptionalDate(Operator.GREATER_THAN, optionalDate); + } + + public ScalarTypeProbeRequest withOptionalDateBetween(Date startOfOptionalDate, Date endOfOptionalDate){ + return withOptionalDate(Operator.BETWEEN, startOfOptionalDate, endOfOptionalDate); + } + + + + + public ScalarTypeProbeRequest filterByRequiredTime(LocalTime... requiredTime){ + if (requiredTime == null || requiredTime.length == 0) { + throw new IllegalArgumentException("filterByRequiredTime parameter requiredTime cannot be empty"); + } + return appendSearchCriteria(createRequiredTimeCriteria(Operator.EQUAL, (Object[])requiredTime)); + } + + public ScalarTypeProbeRequest withRequiredTime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredTimeIsUnknown(){ + return withRequiredTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredTimeIsKnown(){ + return withRequiredTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredTimeIs(LocalTime requiredTime){ + return withRequiredTime(Operator.EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIsNot(LocalTime requiredTime){ + return withRequiredTime(Operator.NOT_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.IN, (Object[])requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeNotIn(LocalTime... requiredTime){ + return withRequiredTime(Operator.NOT_IN, (Object[])requiredTime); + } + public ScalarTypeProbeRequest withRequiredTimeGreaterThan(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeGreaterThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.GREATER_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThan(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeLessThanOrEqualTo(LocalTime requiredTime){ + return withRequiredTime(Operator.LESS_THAN_OR_EQUAL, requiredTime); + } + + public ScalarTypeProbeRequest withRequiredTimeBetween(LocalTime startOfRequiredTime, LocalTime endOfRequiredTime){ + return withRequiredTime(Operator.BETWEEN, startOfRequiredTime, endOfRequiredTime); + } + + + public ScalarTypeProbeRequest filterByOptionalTime(LocalTime... optionalTime){ + if (optionalTime == null || optionalTime.length == 0) { + throw new IllegalArgumentException("filterByOptionalTime parameter optionalTime cannot be empty"); + } + return appendSearchCriteria(createOptionalTimeCriteria(Operator.EQUAL, (Object[])optionalTime)); + } + + public ScalarTypeProbeRequest withOptionalTime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalTimeIsUnknown(){ + return withOptionalTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalTimeIsKnown(){ + return withOptionalTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalTimeIs(LocalTime optionalTime){ + return withOptionalTime(Operator.EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIsNot(LocalTime optionalTime){ + return withOptionalTime(Operator.NOT_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.IN, (Object[])optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeNotIn(LocalTime... optionalTime){ + return withOptionalTime(Operator.NOT_IN, (Object[])optionalTime); + } + public ScalarTypeProbeRequest withOptionalTimeGreaterThan(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeGreaterThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.GREATER_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThan(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeLessThanOrEqualTo(LocalTime optionalTime){ + return withOptionalTime(Operator.LESS_THAN_OR_EQUAL, optionalTime); + } + + public ScalarTypeProbeRequest withOptionalTimeBetween(LocalTime startOfOptionalTime, LocalTime endOfOptionalTime){ + return withOptionalTime(Operator.BETWEEN, startOfOptionalTime, endOfOptionalTime); + } + + + public ScalarTypeProbeRequest filterByRequiredDatetime(LocalDateTime... requiredDatetime){ + if (requiredDatetime == null || requiredDatetime.length == 0) { + throw new IllegalArgumentException("filterByRequiredDatetime parameter requiredDatetime cannot be empty"); + } + return appendSearchCriteria(createRequiredDatetimeCriteria(Operator.EQUAL, (Object[])requiredDatetime)); + } + + public ScalarTypeProbeRequest withRequiredDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createRequiredDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsUnknown(){ + return withRequiredDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsKnown(){ + return withRequiredDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequiredDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIs(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIsNot(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.NOT_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.IN, (Object[])requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeNotIn(LocalDateTime... requiredDatetime){ + return withRequiredDatetime(Operator.NOT_IN, (Object[])requiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeGreaterThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThan(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeLessThanOrEqualTo(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN_OR_EQUAL, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(LocalDateTime startOfRequiredDatetime, LocalDateTime endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + public ScalarTypeProbeRequest withRequiredDatetimeBefore(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBefore(Date requiredDatetime){ + return withRequiredDatetime(Operator.LESS_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(LocalDateTime requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeAfter(Date requiredDatetime){ + return withRequiredDatetime(Operator.GREATER_THAN, requiredDatetime); + } + + public ScalarTypeProbeRequest withRequiredDatetimeBetween(Date startOfRequiredDatetime, Date endOfRequiredDatetime){ + return withRequiredDatetime(Operator.BETWEEN, startOfRequiredDatetime, endOfRequiredDatetime); + } + + + + + public ScalarTypeProbeRequest filterByOptionalDatetime(LocalDateTime... optionalDatetime){ + if (optionalDatetime == null || optionalDatetime.length == 0) { + throw new IllegalArgumentException("filterByOptionalDatetime parameter optionalDatetime cannot be empty"); + } + return appendSearchCriteria(createOptionalDatetimeCriteria(Operator.EQUAL, (Object[])optionalDatetime)); + } + + public ScalarTypeProbeRequest withOptionalDatetime(Operator operator, Object... values){ + return appendSearchCriteria(createOptionalDatetimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsUnknown(){ + return withOptionalDatetime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsKnown(){ + return withOptionalDatetime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOptionalDatetimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIs(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIsNot(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.NOT_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.IN, (Object[])optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeNotIn(LocalDateTime... optionalDatetime){ + return withOptionalDatetime(Operator.NOT_IN, (Object[])optionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeGreaterThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThan(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeLessThanOrEqualTo(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN_OR_EQUAL, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(LocalDateTime startOfOptionalDatetime, LocalDateTime endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + public ScalarTypeProbeRequest withOptionalDatetimeBefore(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBefore(Date optionalDatetime){ + return withOptionalDatetime(Operator.LESS_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(LocalDateTime optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeAfter(Date optionalDatetime){ + return withOptionalDatetime(Operator.GREATER_THAN, optionalDatetime); + } + + public ScalarTypeProbeRequest withOptionalDatetimeBetween(Date startOfOptionalDatetime, Date endOfOptionalDatetime){ + return withOptionalDatetime(Operator.BETWEEN, startOfOptionalDatetime, endOfOptionalDatetime); + } + + + + + public ScalarTypeProbeRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public ScalarTypeProbeRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.CREATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public ScalarTypeProbeRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public ScalarTypeProbeRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public ScalarTypeProbeRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ScalarTypeProbeRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public ScalarTypeProbeRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public ScalarTypeProbeRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.UPDATE_TIME_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public ScalarTypeProbeRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public ScalarTypeProbeRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ScalarTypeProbeRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public ScalarTypeProbeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public ScalarTypeProbeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(ScalarTypeProbe.VERSION_PROPERTY, operator, values); + } + + public ScalarTypeProbeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public ScalarTypeProbeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public ScalarTypeProbeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public ScalarTypeProbeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public ScalarTypeProbeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public ScalarTypeProbeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public ScalarTypeProbeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest minRequiredInteger(){ + return minRequiredIntegerAs(prefix("minOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredInteger(){ + return maxRequiredIntegerAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredInteger(){ + return sumRequiredIntegerAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredInteger(){ + return avgRequiredIntegerAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredInteger(){ + return standardDeviationRequiredIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredInteger(){ + return squareRootOfPopulationStandardDeviationRequiredIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredInteger(){ + return sampleVarianceRequiredIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredInteger(){ + return samplePopulationVarianceRequiredIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalInteger(){ + return minOptionalIntegerAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalIntegerAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalInteger(){ + return maxOptionalIntegerAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalIntegerAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalInteger(){ + return sumOptionalIntegerAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalIntegerAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalInteger(){ + return avgOptionalIntegerAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalIntegerAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalInteger(){ + return standardDeviationOptionalIntegerAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalIntegerAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalInteger(){ + return squareRootOfPopulationStandardDeviationOptionalIntegerAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalIntegerAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalInteger(){ + return sampleVarianceOptionalIntegerAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalIntegerAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalInteger(){ + return samplePopulationVarianceOptionalIntegerAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalIntegerAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredLong(){ + return minRequiredLongAs(prefix("minOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredLongAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredLong(){ + return maxRequiredLongAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredLongAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredLong(){ + return sumRequiredLongAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredLong(){ + return avgRequiredLongAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredLong(){ + return standardDeviationRequiredLongAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLong(){ + return squareRootOfPopulationStandardDeviationRequiredLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredLong(){ + return sampleVarianceRequiredLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLong(){ + return samplePopulationVarianceRequiredLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalLong(){ + return minOptionalLongAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalLongAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalLong(){ + return maxOptionalLongAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalLongAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalLong(){ + return sumOptionalLongAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalLongAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalLong(){ + return avgOptionalLongAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalLongAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalLong(){ + return standardDeviationOptionalLongAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalLongAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLong(){ + return squareRootOfPopulationStandardDeviationOptionalLongAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalLongAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalLong(){ + return sampleVarianceOptionalLongAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalLongAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLong(){ + return samplePopulationVarianceOptionalLongAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_LONG_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalLongAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDecimal(){ + return minRequiredDecimalAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDecimal(){ + return maxRequiredDecimalAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDecimal(){ + return sumRequiredDecimalAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDecimal(){ + return avgRequiredDecimalAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDecimal(){ + return standardDeviationRequiredDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimal(){ + return squareRootOfPopulationStandardDeviationRequiredDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDecimal(){ + return sampleVarianceRequiredDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimal(){ + return samplePopulationVarianceRequiredDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDecimal(){ + return minOptionalDecimalAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDecimalAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDecimal(){ + return maxOptionalDecimalAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDecimalAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDecimal(){ + return sumOptionalDecimalAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDecimalAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDecimal(){ + return avgOptionalDecimalAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDecimalAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDecimal(){ + return standardDeviationOptionalDecimalAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDecimalAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimal(){ + return squareRootOfPopulationStandardDeviationOptionalDecimalAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDecimalAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDecimal(){ + return sampleVarianceOptionalDecimalAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDecimalAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimal(){ + return samplePopulationVarianceOptionalDecimalAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDecimalAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredFloat(){ + return minRequiredFloatAs(prefix("minOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredFloat(){ + return maxRequiredFloatAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredFloat(){ + return sumRequiredFloatAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredFloat(){ + return avgRequiredFloatAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredFloat(){ + return standardDeviationRequiredFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloat(){ + return squareRootOfPopulationStandardDeviationRequiredFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredFloat(){ + return sampleVarianceRequiredFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloat(){ + return samplePopulationVarianceRequiredFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalFloat(){ + return minOptionalFloatAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalFloatAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalFloat(){ + return maxOptionalFloatAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalFloatAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalFloat(){ + return sumOptionalFloatAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalFloatAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalFloat(){ + return avgOptionalFloatAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalFloatAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalFloat(){ + return standardDeviationOptionalFloatAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalFloatAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloat(){ + return squareRootOfPopulationStandardDeviationOptionalFloatAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalFloatAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalFloat(){ + return sampleVarianceOptionalFloatAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalFloatAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloat(){ + return samplePopulationVarianceOptionalFloatAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalFloatAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minRequiredDouble(){ + return minRequiredDoubleAs(prefix("minOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minRequiredDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxRequiredDouble(){ + return maxRequiredDoubleAs(prefix("maxOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxRequiredDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumRequiredDouble(){ + return sumRequiredDoubleAs(prefix("sumOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumRequiredDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgRequiredDouble(){ + return avgRequiredDoubleAs(prefix("avgOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgRequiredDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationRequiredDouble(){ + return standardDeviationRequiredDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationRequiredDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDouble(){ + return squareRootOfPopulationStandardDeviationRequiredDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationRequiredDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceRequiredDouble(){ + return sampleVarianceRequiredDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceRequiredDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDouble(){ + return samplePopulationVarianceRequiredDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceRequiredDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest minOptionalDouble(){ + return minOptionalDoubleAs(prefix("minOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest minOptionalDoubleAs(String retName){ + super.min(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest maxOptionalDouble(){ + return maxOptionalDoubleAs(prefix("maxOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest maxOptionalDoubleAs(String retName){ + super.max(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sumOptionalDouble(){ + return sumOptionalDoubleAs(prefix("sumOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sumOptionalDoubleAs(String retName){ + super.sum(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest avgOptionalDouble(){ + return avgOptionalDoubleAs(prefix("avgOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest avgOptionalDoubleAs(String retName){ + super.avg(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest standardDeviationOptionalDouble(){ + return standardDeviationOptionalDoubleAs(prefix("standardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest standardDeviationOptionalDoubleAs(String retName){ + super.standardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDouble(){ + return squareRootOfPopulationStandardDeviationOptionalDoubleAs(prefix("squareRootOfPopulationStandardDeviationOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest squareRootOfPopulationStandardDeviationOptionalDoubleAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest sampleVarianceOptionalDouble(){ + return sampleVarianceOptionalDoubleAs(prefix("sampleVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest sampleVarianceOptionalDoubleAs(String retName){ + super.sampleVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDouble(){ + return samplePopulationVarianceOptionalDoubleAs(prefix("samplePopulationVarianceOf",ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY)); + } + + public ScalarTypeProbeRequest samplePopulationVarianceOptionalDoubleAs(String retName){ + super.samplePopulationVariance(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(){ + return groupByTypePlatformWithDetails(Q.typePlatforms().unlimited()); + } + + public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequest subRequest){ + aggregate(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest groupById(){ + groupBy(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdAs(String retName){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.ID_PROPERTY, function); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + return this; + } + public ScalarTypeProbeRequest groupByTypePlatform(){ + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformAs(String retName){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByTypePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredString(){ + groupBy(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalString(){ + groupBy(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalStringWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByLargeText(){ + groupBy(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextAs(String retName){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByLargeTextWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.LARGE_TEXT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBoolean(){ + groupBy(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBoolean(){ + groupBy(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalBooleanWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredInteger(){ + groupBy(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalInteger(){ + groupBy(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalIntegerWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLong(){ + groupBy(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLong(){ + groupBy(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalLongWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimal(){ + groupBy(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimal(){ + groupBy(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDecimalWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloat(){ + groupBy(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloat(){ + groupBy(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalFloatWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDouble(){ + groupBy(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDouble(){ + groupBy(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDoubleWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDate(){ + groupBy(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDate(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTime(){ + groupBy(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTime(){ + groupBy(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetime(){ + groupBy(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByRequiredDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetime(){ + groupBy(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByOptionalDatetimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTime(){ + groupBy(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.CREATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTime(){ + groupBy(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.UPDATE_TIME_PROPERTY, function); + return this; + } + + public ScalarTypeProbeRequest groupByVersion(){ + groupBy(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionAs(String retName){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, ScalarTypeProbe.VERSION_PROPERTY, function); + return this; + } + + + + public ScalarTypeProbeRequest orderByIdAscending(){ + addOrderByAscending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByIdDescending(){ + addOrderByDescending(ScalarTypeProbe.ID_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformAscending(){ + addOrderByAscending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByTypePlatformDescending(){ + addOrderByDescending(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByRequiredStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByOptionalStringAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalStringDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest orderByLargeTextAscending(){ + addOrderByAscending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByLargeTextDescending(){ + addOrderByDescending(ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalBooleanDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalIntegerDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredLongDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalLongDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDecimalDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalFloatDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDoubleDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDateDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDateDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByRequiredDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeAscending(){ + addOrderByAscending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByOptionalDatetimeDescending(){ + addOrderByDescending(ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByCreateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeAscending(){ + addOrderByAscending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByUpdateTimeDescending(){ + addOrderByDescending(ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionAscending(){ + addOrderByAscending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + public ScalarTypeProbeRequest orderByVersionDescending(){ + addOrderByDescending(ScalarTypeProbe.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest rollUpToTypePlatform(){ + TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); + this.withTypePlatformMatching(typePlatform) + .groupByTypePlatformWith(typePlatform); + return typePlatform; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform){ + return facetByTypePlatformAs(facetName, typePlatform, true); + } + + public ScalarTypeProbeRequest facetByTypePlatformAs(String facetName, TypePlatformRequest typePlatform, boolean includeAllFacets){ + addFacet(facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, typePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTypePlatformAs", facetName, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public ScalarTypeProbeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public ScalarTypeProbeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public ScalarTypeProbeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public ScalarTypeProbeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public ScalarTypeProbeRequest 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 ScalarTypeProbeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java new file mode 100644 index 000000000..c879182af --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -0,0 +1,123 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +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 TypePlatform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "TypePlatform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5afe0d829346ae9bcaf7f37458837cfbdcdee743f3e9fb8fab9c754126349de5"; + 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( + "scalar_type_probe_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + TypePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("snake_case"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SCALAR_TYPE_PROBE_LIST_PROPERTY = "scalar_type_probe_list"; + private String name; + + private SmartList scalarTypeProbeList; + + public String getName(){ + return this.name; + } + + public SmartList getScalarTypeProbeList(){ + return this.scalarTypeProbeList; + } + public TypePlatform 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 TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + if (scalarTypeProbe == null){ + return this; + } + + if(null == this.scalarTypeProbeList){ + this.scalarTypeProbeList = new SmartList<>(); + } + + this.scalarTypeProbeList.add(scalarTypeProbe); + scalarTypeProbe.updateTypePlatform(this); + return this; + } + + public static TypePlatform refer(Long id){ + TypePlatform refer = new TypePlatform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public TypePlatform 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 "scalar_type_probe_list": this.scalarTypeProbeList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "scalar_type_probe_list": return this.scalarTypeProbeList; + default: return super.__internalGet(property); + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java new file mode 100644 index 000000000..62df23ea0 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -0,0 +1,51 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class TypePlatformChecker implements Checker{ + + public String type(){ + return TypePlatform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, typePlatform)){ + markAsChecked(_context, typePlatform); + doCheck(_context, typePlatform, _parentLocation); + } + } + + public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocation _parentLocation){ + if((typePlatform == null)){ + return; + } + if(typePlatform.needPersist()){ + } + if(typePlatform.newItem()){ + }else if(typePlatform.updateItem()){ + if(!typePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, typePlatform.getProperty(TypePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; typePlatform.getScalarTypeProbeList() != null && i < typePlatform.getScalarTypeProbeList().size(); i++){ + ScalarTypeProbe scalarTypeProbe = typePlatform.getScalarTypeProbeList().get(i); + new ScalarTypeProbeChecker().checkAndFix(_context, scalarTypeProbe, newLocation(_parentLocation, "scalar_type_probe_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java new file mode 100644 index 000000000..01a63a43c --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeListExpression; +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 TypePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public TypePlatformExpression(Expression expression){ + super(expression); + } + + public TypePlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public TypePlatformExpression updateId(Long id){ + return new TypePlatformExpression(this, $it -> {((TypePlatform)$it).__internalSet("id", id); return this;}); + } + + public TypePlatformExpression save(UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public TypePlatformExpression save(String intent, UserContext userContext){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", TypePlatform::getName); + } + public TypePlatformExpression updateName(String name){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).updateName(name)); + } + + public ScalarTypeProbeListExpression getScalarTypeProbeList(){ + return new ScalarTypeProbeListExpression(loaded("scalar_type_probe_list", "getScalarTypeProbeList", TypePlatform::getScalarTypeProbeList)); + } + public TypePlatformExpression addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ + return new TypePlatformExpression(this, $it -> ((TypePlatform)$it).addScalarTypeProbe(scalarTypeProbe)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java new file mode 100644 index 000000000..3974c0610 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class TypePlatformListExpression extends SmartListExpression { + public TypePlatformListExpression(Expression> expression){ + super(expression); + } + + public TypePlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public TypePlatformExpression first() { + return new TypePlatformExpression(super.first()); + } + + public TypePlatformExpression get(int index) { + return new TypePlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java new file mode 100644 index 000000000..0ac2f1d18 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -0,0 +1,2099 @@ + +package com.example.scalartypeconformanceservice.typeplatform; + +import com.example.scalartypeconformanceservice.Q; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe; +import com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeRequest; +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 TypePlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public TypePlatformRequest(Class returnType){ + this(returnType, () -> (T) new TypePlatform()); + } + + protected TypePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public TypePlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public TypePlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public TypePlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public TypePlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public TypePlatformRequest 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 TypePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public TypePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public TypePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public TypePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public TypePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (TypePlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public TypePlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ + super.internalMatchAny(typePlatform); + return this; + } + + public TypePlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public TypePlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public TypePlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public TypePlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public TypePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(TypePlatform.ID_PROPERTY); + selectProperty(TypePlatform.NAME_PROPERTY); + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public TypePlatformRequest selectChildren(){ + super.selectAny(); + selectScalarTypeProbeList(); + return selectId().selectName().selectVersion(); + } + + + public TypePlatformRequest selectId(){ + selectProperty(TypePlatform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectId(){ + unselectProperty(TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest selectName(){ + selectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectName(){ + unselectProperty(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest selectVersion(){ + selectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TypePlatformRequest unselectVersion(){ + unselectProperty(TypePlatform.VERSION_PROPERTY); + return this; + } + public TypePlatformRequest selectScalarTypeProbeList(){ + return selectScalarTypeProbeListWith(Q.scalarTypeProbes().selectSelf()); + } + + public TypePlatformRequest selectScalarTypeProbeListWith(ScalarTypeProbeRequest scalarTypeProbeList){ + enhanceRelation(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, scalarTypeProbeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectScalarTypeProbeListWith", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.ID_PROPERTY, operator, values); + } + + public TypePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public TypePlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public TypePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public TypePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public TypePlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public TypePlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.NAME_PROPERTY, operator, values); + } + + public TypePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public TypePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public TypePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public TypePlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public TypePlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public TypePlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public TypePlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public TypePlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public TypePlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public TypePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public TypePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public TypePlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public TypePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public TypePlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public TypePlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public TypePlatformRequest 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 TypePlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public TypePlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public TypePlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TypePlatform.VERSION_PROPERTY, operator, values); + } + + public TypePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public TypePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public TypePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public TypePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public TypePlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public TypePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public TypePlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public TypePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public TypePlatformRequest withScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY)); + } + + public TypePlatformRequest withoutScalarTypeProbeListMatching(ScalarTypeProbeRequest scalarTypeProbeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(TypePlatform.ID_PROPERTY, scalarTypeProbeRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY))); + } + + public TypePlatformRequest haveScalarTypeProbes(){ + return withScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest haveNoScalarTypeProbes(){ + return withoutScalarTypeProbeListMatching(Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public TypePlatformRequest 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 TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ + aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); + return this; + } + + public TypePlatformRequest groupById(){ + groupBy(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdAs(String retName){ + groupBy(retName, TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.ID_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByName(){ + groupBy(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameAs(String retName){ + groupBy(retName, TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.NAME_PROPERTY, function); + return this; + } + + public TypePlatformRequest groupByVersion(){ + groupBy(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionAs(String retName){ + groupBy(retName, TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, TypePlatform.VERSION_PROPERTY, function); + return this; + } + + + + public TypePlatformRequest orderByIdAscending(){ + addOrderByAscending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByIdDescending(){ + addOrderByDescending(TypePlatform.ID_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameAscending(){ + addOrderByAscending(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescending(){ + addOrderByDescending(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + + public TypePlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest orderByVersionAscending(){ + addOrderByAscending(TypePlatform.VERSION_PROPERTY); + return this; + } + + public TypePlatformRequest orderByVersionDescending(){ + addOrderByDescending(TypePlatform.VERSION_PROPERTY); + return this; + } + + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(name, subRequest, false); + } + + public TypePlatformRequest statsFromScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest statsFromScalarTypeProbes(ScalarTypeProbeRequest subRequest){ + return statsFromScalarTypeProbesAs(REFINEMENTS, subRequest); + } + public TypePlatformRequest countScalarTypeProbes(){ + addRelationCount("Count", Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesAs(String name){ + addRelationCount(name, Q.scalarTypeProbes().unlimited(), ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest countScalarTypeProbesWith(String name, ScalarTypeProbeRequest subRequest){ + addRelationCount(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countScalarTypeProbesWith", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name){ + return minRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name){ + return maxRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name){ + return sumRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name){ + return avgRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name){ + return minOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name){ + return maxOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name){ + return sumOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name){ + return avgOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalIntegerOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalIntegerOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name){ + return minRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name){ + return maxRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name){ + return sumRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name){ + return avgRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name){ + return minOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name){ + return maxOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name){ + return sumOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name){ + return avgOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalLongOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalLongOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_LONG_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalLongOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name){ + return minRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name){ + return maxRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name){ + return sumRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name){ + return avgRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name){ + return minOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name){ + return maxOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name){ + return sumOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name){ + return avgOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDecimalOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDecimalOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name){ + return minRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name){ + return maxRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name){ + return sumRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name){ + return avgRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name){ + return minOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name){ + return maxOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name){ + return sumOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name){ + return avgOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalFloatOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalFloatOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name){ + return minRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name){ + return maxRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name){ + return sumRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name){ + return avgRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopRequiredDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceRequiredDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("minOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name){ + return minOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest minOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("maxOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name){ + return maxOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest maxOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("sumOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name){ + return sumOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sumOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("avgOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name){ + return avgOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest avgOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return standardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest standardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("stdDevPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name){ + return squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varSampOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return sampleVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest sampleVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbes(){ + addRelationScalarAggregate("varPopOptionalDoubleOfScalarTypeProbes", Q.scalarTypeProbes().unlimited(), + ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbes", null, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name){ + return samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(name, Q.scalarTypeProbes().unlimited()); + } + + public TypePlatformRequest samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs(String name, ScalarTypeProbeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, + ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceOptionalDoubleOfScalarTypeProbesAs", name, TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public TypePlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public TypePlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public TypePlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public TypePlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public TypePlatformRequest 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 TypePlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..d97c5af41 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.scalartypeconformanceservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/model.xml b/examples/scalar-type-probe/json-profiles/snake_case/model.xml new file mode 100644 index 000000000..21d6fd273 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/model.xml @@ -0,0 +1,39 @@ + + + + + + diff --git a/examples/scalar-type-probe/memory-empty-observations.cjs b/examples/scalar-type-probe/memory-empty-observations.cjs new file mode 100644 index 000000000..de2139298 --- /dev/null +++ b/examples/scalar-type-probe/memory-empty-observations.cjs @@ -0,0 +1,10 @@ +'use strict'; +const assert=require('node:assert/strict'),vectors=require('./empty-vectors.json'); +function observation(r,round){assert.equal(r.schema,'teaql.java-generated-memory-empty-aggregate/v1');assert.equal(r.passed,true);assert.equal(r.round,round);assert.equal(r.rows.length,18);assert.equal(r.scalarIds.length,4);assert.equal(r.bucketIds.length,4);assert.equal(new Set([...r.scalarIds,...r.bucketIds]).size,8);let position=0; + const next=(id,logging)=>{const row=r.rows[position++];assert.equal(row.case,id);assert.equal(row.logging,logging);assert(!Object.hasOwn(row,'sql'));assert.equal(row.provider.length,1);assert(row.provider[0].queryCalls>0);assert.equal(row.provider[0].mutationCalls,0);assert.equal(row.provider[0].sqlCalls,0);return row;}; + for(const logging of [true,false]){for(const vector of vectors.scalarCases){const row=next(vector.id,logging);assert.deepEqual(row.values,{total:vector.sum,rows:vector.countStar,countValue:vector.countValue});} + const empty=next('EA-05',logging);assert.deepEqual(empty.values,{count:0,sum:null});assert(Object.hasOwn(empty.entityJSON,'_total'));assert.equal(empty.entityJSON._total,null);assert.equal(empty.entityJSON._rows,0); + for(const includeAll of [true,false]){const row=next('EA-06',logging);assert.equal(row.includeAll,includeAll);assert.equal(row.visibleRows,1);assert.deepEqual(row.values,includeAll?vectors.bucketCases[1].expected:vectors.bucketCases[1].expected.filter(v=>v.count>0));} + assert.deepEqual(next('EA-07',logging).values,{raw:null,fallback:0,rawRemains:null});assert.deepEqual(next('EA-08',logging).groups,[]); + }return{round,cases:18,emptyVectors:8,loggingModes:2,selectedNullEntityJSON:true,sqlCalls:0};} +module.exports={observation}; diff --git a/examples/scalar-type-probe/memory-empty-provenance.json b/examples/scalar-type-probe/memory-empty-provenance.json new file mode 100644 index 000000000..a6562b8e2 --- /dev/null +++ b/examples/scalar-type-probe/memory-empty-provenance.json @@ -0,0 +1,10 @@ +{ + "schema": "teaql.java-memory-empty-example-provenance/v1", + "applicationSha256": "6f69d9d0ef91dd881919b5ac1b48300b2e62430c5b26171e27e2bea0a1c76e20", + "vectorsSha256": "cfaa8dec196bbfa85e830fd0d67f321b17875b6f7d7c5f7cd28e0f2f6770ced0", + "derivedFromSqlApplicationSha256": "631599a3734e174ad1abb2e42f07c459b94a6b1c59b02107ab36b6388c9052af", + "runtimeProductionCommit": "0afe545b5aa97cfc8b46808e814b7e45018f620e", + "generatedImplementationsChanged": false, + "provider": "existing pure-memory MemoryDataService", + "sqlFaultInjectionRemovedAsInapplicable": true +} diff --git a/examples/scalar-type-probe/model.xml b/examples/scalar-type-probe/model.xml new file mode 100644 index 000000000..6fd6f2bc5 --- /dev/null +++ b/examples/scalar-type-probe/model.xml @@ -0,0 +1,39 @@ + + + + + + diff --git a/examples/scalar-type-probe/verify-json-profiles.cjs b/examples/scalar-type-probe/verify-json-profiles.cjs new file mode 100644 index 000000000..c8f67aa11 --- /dev/null +++ b/examples/scalar-type-probe/verify-json-profiles.cjs @@ -0,0 +1,111 @@ +#!/usr/bin/env node +'use strict'; +const fs = require('node:fs'), path = require('node:path'), os = require('node:os'), cp = require('node:child_process'), crypto = require('node:crypto'), assert = require('node:assert/strict'); +const {createOwnedRunner, ownedBytes} = require('../fix-e-alignment/owned-command.cjs'); +assert(process.argv.length === 2 || (process.argv.length === 3 && ['--lifecycle','--numeric','--temporal','--local-datetime','--rejected','--explicit-null','--loaded-revert','--version-lifecycle'].includes(process.argv[2]))); +const localDatetime = process.argv[2] === '--local-datetime'; +const versionLifecycle = process.argv[2] === '--version-lifecycle'; +const loadedRevert = process.argv[2] === '--loaded-revert'; +const explicitNull = process.argv[2] === '--explicit-null'; +const lifecycle = process.argv[2] === '--lifecycle'; +const numeric = process.argv[2] === '--numeric'; +const temporal = process.argv[2] === '--temporal'; +const rejected = process.argv[2] === '--rejected'; +const testClass = localDatetime ? 'GeneratedJsonLocalDatetimeTest' : versionLifecycle ? 'GeneratedVersionLifecycleTest' : loadedRevert ? 'GeneratedLoadedRevertTest' : explicitNull ? 'GeneratedExplicitNullTest' : rejected ? 'GeneratedRejectedMutationTest' : temporal ? 'GeneratedJsonTemporalTest' : numeric ? 'GeneratedJsonNumericTest' : lifecycle ? 'GeneratedJsonLifecycleTest' : 'GeneratedJsonProfileTest'; +const marker = localDatetime ? 'JAVA_JSON_LOCAL_DATETIME' : versionLifecycle ? 'JAVA_VERSION_LIFECYCLE' : loadedRevert ? 'JAVA_LOADED_REVERT' : explicitNull ? 'JAVA_EXPLICIT_NULL' : rejected ? 'JAVA_REJECTED_MUTATION' : temporal ? 'JAVA_JSON_TEMPORAL' : numeric ? 'JAVA_JSON_NUMERIC' : lifecycle ? 'JAVA_JSON_LIFECYCLE' : 'JAVA_JSON_MODEL_PROFILE'; +const repo = path.resolve(__dirname, '../..'), inputs = path.join(__dirname, 'json-profiles'); +const sha = bytes => crypto.createHash('sha256').update(bytes).digest('hex'); +const requested = process.env.TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR; +const output = requested ? path.resolve(requested) : fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-java-json-evidence-')); +if (requested) { assert(!fs.existsSync(output)); fs.mkdirSync(output, {recursive: true}); } +function files() { return [...new Set(cp.execFileSync('git', ['-C', repo, 'ls-files', '-z', '--cached', '--others', '--exclude-standard']).toString().split('\0').filter(Boolean))].sort(); } +function snapshot() { + const h = crypto.createHash('sha256'); + for (const file of files()) { h.update(file + '\0'); const source = path.join(repo, file); + if (!fs.existsSync(source)) { h.update('deleted\0'); continue; } const stat = fs.lstatSync(source); assert(stat.isFile()); + h.update(String(stat.mode) + '\0'); h.update(fs.readFileSync(source)); h.update('\0'); } + return h.digest('hex'); +} +function fixture() { + const bytes = fs.readFileSync(path.join(inputs, 'provenance.json')), provenance = JSON.parse(bytes); + for (const [file, expected] of Object.entries(provenance.files)) { + assert(!path.isAbsolute(file) && !file.split('/').includes('..')); const source = path.join(inputs, file); + assert.equal(fs.realpathSync(source), source); assert.equal(sha(fs.readFileSync(source)), expected); + } + const manifest = JSON.parse(fs.readFileSync(path.join(inputs, 'manifest.json'))); + assert.equal(manifest.schema, 'teaql.java-json-profile-generated-source/v1'); assert.equal(manifest.localSourceOnly, true); + assert.deepEqual(Object.keys(manifest.profiles).sort(), ['PascalCase', 'camelCase', 'snake_case']); + assert.equal(manifest.baseModelSha256, '8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762'); + for (const item of Object.values(manifest.profiles)) assert.equal(item.evaluation.errors.length, 0); + return {provenance, provenanceSha256: sha(bytes), manifest}; +} +const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-java-json-build-')), runner = createOwnedRunner(); +const report = {schema: localDatetime ? 'teaql.java-model-json-local-datetime-example/v1' : versionLifecycle ? 'teaql.java-version-lifecycle-example/v1' : loadedRevert ? 'teaql.java-loaded-revert-example/v1' : explicitNull ? 'teaql.java-explicit-null-example/v1' : rejected ? 'teaql.java-rejected-mutation-example/v1' : temporal ? 'teaql.java-model-json-temporal-example/v1' : numeric ? 'teaql.java-model-json-numeric-example/v1' : lifecycle ? 'teaql.java-model-json-lifecycle-example/v1' : 'teaql.java-model-json-profiles-example/v1', passed: false, profiles: {}, commands: [], publicPublication: false, internalArtifactAccepted: false}; +async function main() { + try { + const disk = fs.statfsSync(scratch); assert(disk.bavail * disk.bsize > 8 * 1024 ** 3); + const before = snapshot(), input = fixture(); report.sourceSha256 = before; report.sourceHashAlgorithm = 'teaql.source-contents/v1'; report.fixture = input; + report.sourceCommit = cp.execFileSync('git', ['-C', repo, 'rev-parse', 'HEAD']).toString().trim(); + const runtime = path.join(scratch, 'source'); + for (const file of files()) { const source = path.join(repo, file); if (!fs.existsSync(source)) continue; + const target = path.join(runtime, file); fs.mkdirSync(path.dirname(target), {recursive: true}); fs.copyFileSync(source, target); } + const version = fs.readFileSync(path.join(repo, 'pom.xml'), 'utf8').match(/([^<]+)<\/version>/)[1]; + const dependencies = ['teaql-runtime', 'teaql-sqlite', 'teaql-jackson'].map(name => `io.teaql${name}${version}`).join(''); + report.applications = Object.fromEntries(['GeneratedCanonicalNameTest.java', testClass + '.java'].map(name => [name, sha(fs.readFileSync(path.join(__dirname, name)))])); + // Lifecycle rejection is independent of JSON vocabulary; use one small + // model twice rather than recompiling the same Core behavior in all profiles. + for (const profile of rejected || explicitNull || loadedRevert || versionLifecycle ? ['camelCase'] : ['camelCase', 'snake_case', 'PascalCase']) { + const work = path.join(scratch, profile), consumer = path.join(work, 'consumer'), evidence = path.join(output, profile); + fs.mkdirSync(evidence); const tests = path.join(consumer, 'src/test/java/com/example/scalartypeconformanceservice'); fs.mkdirSync(tests, {recursive: true}); + for (const name of Object.keys(report.applications)) fs.copyFileSync(path.join(__dirname, name), path.join(tests, name)); + fs.cpSync(path.join(inputs, profile, 'lib'), path.join(work, 'generated'), {recursive: true}); + report.libraryMetadata??={};report.libraryMetadata[profile]=require('../../scripts/pin-local-example-pom.cjs').pin(path.join(work,'generated/pom.xml'),repo,scratch); + const pom = `4.0.0io.teaqlteaql-java-parent${version}../../source/pom.xmlio.teaql.examplesteaql-model-json-profile-example${version}com.examplescalar-type-conformance-service-core0.0.1-SNAPSHOT${dependencies}com.fasterxml.jackson.datatypejackson-datatype-jsr310junitjunit4.13.2testorg.apache.maven.pluginsmaven-surefire-pluginfalse`; + fs.writeFileSync(path.join(consumer, 'pom.xml'), pom); fs.writeFileSync(path.join(evidence, 'consumer-pom.xml'), pom); + const reactor = path.join(work, 'pom.xml'); fs.writeFileSync(reactor, '4.0.0io.teaql.testmodel-json-profile-reactor0.0.0pom../sourcegeneratedconsumer'); + const rounds = []; + for (const round of [1, 2]) { + const command = ['mvn', '-o', '-B', '-ntp', '-f', reactor, '-pl', ':teaql-model-json-profile-example', '-am', 'test', '-Dtest=' + testClass, '-Dsurefire.failIfNoSpecifiedTests=false', '-Dteaql.version=' + version, '-Dteaql.expected.runtime.root=' + runtime]; + const log = path.join(evidence, 'round-' + round + '.log'), fd = fs.openSync(log, 'wx'); let result; + try { result = await runner.run(command, {cwd: work, timeout: 300000, env: {...process.env, TEAQL_JSON_PROFILE: profile, + TEAQL_NAME_DB: path.join(evidence, 'fixture.sqlite'), TEAQL_NAME_ROUND: String(round)}, stdio: ['ignore', fd, fd]}); } + finally { fs.closeSync(fd); } + const bytes = fs.readFileSync(log); report.commands.push({profile, round, command, exitCode: result.status, signal: result.signal, logSha256: sha(bytes)}); + assert.equal(result.status, 0, bytes.toString().slice(-8000)); assert.equal(result.signal, null); + const markers = [...bytes.toString().matchAll(new RegExp('^' + marker + '=(.+)$', 'gm'))]; assert.equal(markers.length, 1); + const value = JSON.parse(markers[0][1]); assert.equal(value.passed, true); assert.equal(value.profile, profile); assert.equal(value.round, round); + const checks = versionLifecycle ? ['lastUpdateExact','maxUpdateRejectedBeforeChecker','zeroProviderPolicyAudit','pendingIntentRetained','typedQAndE','exactJsonVersion','unchangedMaxNoop','untouchedParent','legalDeleteAtMax','exhaustedRecoveryRejected','lastRecoveryExact'] : loadedRevert ? ['knownValueRestored','knownNullRestored','emptyPlanNoWrite','otherFieldPreserved','typedQAndE','versionUnchangedUntilRealEdit','unrelatedParentUnchanged','managedUpdateTimeRetained'] : explicitNull ? ['typedExplicitNull','genericExplicitNull','unknownBaselineRetained','partialRejectedBeforeProvider','loadedEqualNoop','referenceNullRejected','savedNullReadback'] : rejected ? ['payloadRetained','loadStateRetained','ledgerRetained','referenceNotLoaded','failedCastNotLoaded','zeroProviderOnRejection','completeOwnerSave','unrelatedParentUnchanged'] : temporal ? ['calendarDate','wallTimeNanoseconds','loadedNull','passiveCodec','typedQAndE','decodedSave','localDateTimeUnchanged'] : numeric ? ['exactLong','exactDecimalScale','integerBounds','nativeFloatDouble','passiveCodec','typedQAndE','decodedSave','nonfiniteOutputRejected'] : lifecycle ? ['cleanDecode', 'updateNotInsert', 'independentLedgers', 'staleConflict', 'failedIntentRetained', + 'partialRejectedBeforeProvider', 'untouchedPartialReference', 'deleteRecover', 'zeroProviderCodec'] + : ['nestedIdentity', 'loadedNull', 'notLoaded', 'zeroProviderCodec', 'duplicateKeysRejected']; + for (const key of localDatetime ? ['zoneFreeIso','timezoneIndependent','loadedNull','notLoaded','passiveCodec','typedQAndE','decodedSave','sqliteMillisReadback'] : checks) assert.equal(value[key], true); + if (localDatetime) { + assert.equal(value.finalVersion, 2); assert.equal(value.invalidInputCases, 7); + for (const key of ['generatedInstantAccepted','sqlNanosecondsAccepted','businessClockChanged']) assert.equal(value[key], false); + } + if (testClass === 'GeneratedJsonProfileTest') { + const emitted = [...bytes.toString().matchAll(/^GENERATED_E_MODEL_PROFILE=(.+)$/gm)].map(m => JSON.parse(m[1])); + assert.equal(emitted.length, 1); + const e = emitted[0]; assert.equal(e.language, 'java'); assert.equal(e.profile, profile); assert.equal(e.round, round); + assert.equal(e.passed, true); assert.equal(e.providerEntries, 0); assert.equal(e.mutationLedgerCreated, false); + assert.equal(e.wire.instancePath, {camelCase:'/optionalString',snake_case:'/optional_string',PascalCase:'/OptionalString'}[profile]); + assert.deepEqual(e.wire.location, [{kind:'property',name:'optional_string'}]); + assert.equal(e.wire.breakPoint, 'optional_string'); assert.equal(e.wire.breakPointIndex, 0); + assert.equal(e.wire.expressionWithBrokenPoint, 'E.scalarTypeProbe().getOptionalString().eval()'); + assert(e.human.includes(e.wire.expressionWithBrokenPoint)); + value.generatedExpression = e; + } + rounds.push(value); assert.deepEqual(fixture(), input); assert.equal(snapshot(), before); + } + report.profiles[profile] = {rounds, sameDatabase: true, databaseSha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite')))}; + } + report.passed = true; console.log('PASS ' + (versionLifecycle ? 'generated Java checked optimistic versions' : loadedRevert ? 'generated Java restored-value boundaries' : explicitNull ? 'generated Java explicit-null/no-op boundaries' : rejected ? 'generated Java mutation rejection' : 'three generated Java model JSON ' + (temporal ? 'calendar/time boundaries' : numeric ? 'numeric boundaries' : lifecycle ? 'lifecycles' : 'profiles')) + ' twice with local runtime'); + } catch (error) { report.error = error.stack; console.error(error.stack); process.exitCode ||= 1; } + finally { + report.disposedOwnedBytes = runner.safeToClean ? ownedBytes(scratch) : 0; + if (runner.safeToClean) fs.rmSync(scratch, {recursive: true}); else report.unsafeBuildRetention = scratch; + report.scratchRemoved = !fs.existsSync(scratch); runner.dispose(); + fs.writeFileSync(path.join(output, 'receipt.json'), JSON.stringify(report, null, 2) + '\n'); + console.log('Retained compact JSON-profile evidence: ' + output); + } +} +main().catch(error => { console.error(error.stack); process.exitCode ||= 1; }); diff --git a/examples/scalar-type-probe/verify-local.cjs b/examples/scalar-type-probe/verify-local.cjs new file mode 100644 index 000000000..032d1912d --- /dev/null +++ b/examples/scalar-type-probe/verify-local.cjs @@ -0,0 +1,207 @@ +#!/usr/bin/env node +'use strict'; +const fs = require('node:fs'), path = require('node:path'), os = require('node:os'), cp = require('node:child_process'), crypto = require('node:crypto'), assert = require('node:assert/strict'); +const {createOwnedRunner, ownedBytes} = require('../fix-e-alignment/owned-command.cjs'); +const repo = path.resolve(__dirname, '../..'), sha = bytes => crypto.createHash('sha256').update(bytes).digest('hex'); +assert(process.argv.length === 2 || process.argv.length === 3 && ['--restoration-views','--outer-replay','--finite','--jdbc-exact','--sql-millis','--empty','--memory-empty'].includes(process.argv[2])); +const memoryEmpty = process.argv[2] === '--memory-empty'; +const empty = process.argv[2] === '--empty' || memoryEmpty; +const restorationViews = process.argv[2] === '--restoration-views'; +const outerReplay = process.argv[2] === '--outer-replay'; +const finite = process.argv[2] === '--finite'; +const jdbcExact = process.argv[2] === '--jdbc-exact'; +const sqlMillis = process.argv[2] === '--sql-millis'; +const requested = process.env.TEAQL_JAVA_SCALAR_EVIDENCE_DIR; +const output = requested ? path.resolve(requested) : fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-java-name-evidence-')); +if (requested) { assert(!fs.existsSync(output), 'never overwrite evidence'); fs.mkdirSync(output, {recursive: true}); } +function sourceFiles() { return [...new Set(cp.execFileSync('git', ['-C', repo, 'ls-files', '-z', '--cached', '--others', '--exclude-standard']).toString().split('\0').filter(Boolean))].sort(); } +function sourceHash() { + const hash = crypto.createHash('sha256'); + for (const file of sourceFiles()) { const source = path.join(repo, file); hash.update(file + '\0'); + if (!fs.existsSync(source)) { hash.update('deleted\0'); continue; } + assert(fs.lstatSync(source).isFile()); hash.update(fs.readFileSync(source)); hash.update('\0'); } + return hash.digest('hex'); +} +function fixture() { + const bytes = fs.readFileSync(path.join(__dirname, 'fixture-manifest.json')), manifest = JSON.parse(bytes); + assert.equal(manifest.language, 'java'); assert.equal(manifest.evaluationErrors, 0); + assert.equal(manifest.modelSha256, '8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762'); + assert.equal(sha(fs.readFileSync(path.join(__dirname, 'model.xml'))), manifest.modelSha256); + const actual = []; + function walk(directory, prefix = '') { + for (const item of fs.readdirSync(directory, {withFileTypes: true})) { + assert(!item.isSymbolicLink()); const name = path.join(prefix, item.name), file = path.join(directory, item.name); + if (item.isDirectory()) walk(file, name); else { assert(item.isFile()); actual.push(name); } + } + } + walk(path.join(__dirname, 'generated')); + assert.deepEqual(actual.sort(), Object.keys(manifest.files).sort(), 'unexpected generated source'); + for (const [file, expected] of Object.entries(manifest.files)) { + assert(file.startsWith('lib/') && !file.split('/').includes('..')); + assert.equal(sha(fs.readFileSync(path.join(__dirname, 'generated', file))), expected, file); + } + return {manifest, manifestSha256: sha(bytes)}; +} +const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-java-name-build-')), runner = createOwnedRunner(); +const report = {schema: memoryEmpty ? 'teaql.java-memory-empty-aggregate-example/v1' : empty ? 'teaql.java-empty-aggregate-example/v1' : sqlMillis ? 'teaql.java-sql-millisecond-example/v1' : finite ? 'teaql.java-finite-scalar-example/v1' : jdbcExact ? 'teaql.java-jdbc-exact-read-example/v1' : outerReplay ? 'teaql.java-outer-replay-example/v1' : restorationViews ? 'teaql.java-restoration-views-example/v1' : 'teaql.java-canonical-name-example/v1', passed: false, commands: [], rounds: [], sameDatabase: !memoryEmpty, publicPublication: false, internalArtifactAccepted: false}; +async function main() { + try { + const disk = fs.statfsSync(scratch); assert(disk.bavail * disk.bsize > 8 * 1024 ** 3); + const before = sourceHash(), input = fixture(); report.sourceSha256 = before; + report.sourceCommit = cp.execFileSync('git', ['-C', repo, 'rev-parse', 'HEAD']).toString().trim(); + report.fixture = input; + const source = path.join(scratch, 'source'), generated = path.join(scratch, 'generated'), consumer = path.join(scratch, 'consumer'); + for (const file of sourceFiles()) { + const from = path.join(repo, file); if (!fs.existsSync(from)) continue; + const to = path.join(source, file); fs.mkdirSync(path.dirname(to), {recursive: true}); fs.copyFileSync(from, to); + } + fs.cpSync(path.join(__dirname, 'generated/lib'), generated, {recursive: true}); + report.libraryMetadata = require('../../scripts/pin-local-example-pom.cjs').pin(path.join(generated, 'pom.xml'), repo, scratch); + const tests = path.join(consumer, 'src/test/java/com/example/scalartypeconformanceservice'); fs.mkdirSync(tests, {recursive: true}); + fs.copyFileSync(path.join(__dirname, 'GeneratedCanonicalNameTest.java'), path.join(tests, 'GeneratedCanonicalNameTest.java')); + report.applicationSha256 = sha(fs.readFileSync(path.join(__dirname, 'GeneratedCanonicalNameTest.java'))); + if (empty) { + const provenance = JSON.parse(fs.readFileSync(path.join(__dirname, memoryEmpty ? 'memory-empty-provenance.json' : 'empty-provenance.json'))); + for (const [name, expected] of [[memoryEmpty ? 'JavaMemoryEmptyAggregateTest.java' : 'JavaEmptyAggregateTest.java', provenance.applicationSha256], ['empty-vectors.json', provenance.vectorsSha256]]) { + const body = fs.readFileSync(path.join(__dirname, name)); assert.equal(sha(body), expected); + fs.writeFileSync(path.join(output, name), body); + if (name.endsWith('.java')) fs.writeFileSync(path.join(tests, name), body); + } + report.emptyProvenance = provenance; + } + if (sqlMillis) { + const name = 'GeneratedSqlMillisecondTest.java', body = fs.readFileSync(path.join(__dirname, name)); + fs.writeFileSync(path.join(tests, name), body); report.sqlMillisApplicationSha256 = sha(body); + } + if (finite) for (const name of ['JavaFiniteScalarProbe.java','GeneratedFiniteScalarTest.java']) { + const body = fs.readFileSync(path.join(__dirname,name)); fs.writeFileSync(path.join(tests,name),body); + report.finiteApplicationInputs ||= {}; report.finiteApplicationInputs[name] = sha(body); + } + if (jdbcExact) { + fs.copyFileSync(path.join(__dirname, 'GeneratedJdbcExactReadTest.java'), path.join(tests, 'GeneratedJdbcExactReadTest.java')); + report.jdbcExactApplicationSha256 = sha(fs.readFileSync(path.join(__dirname, 'GeneratedJdbcExactReadTest.java'))); + } + if (restorationViews) { + fs.copyFileSync(path.join(__dirname, 'GeneratedRestorationViewTest.java'), path.join(tests, 'GeneratedRestorationViewTest.java')); + report.restorationViewApplicationSha256 = sha(fs.readFileSync(path.join(__dirname, 'GeneratedRestorationViewTest.java'))); + } + if (outerReplay) { + fs.copyFileSync(path.join(__dirname, 'GeneratedOuterReplayTest.java'), path.join(tests, 'GeneratedOuterReplayTest.java')); + report.outerReplayApplicationSha256 = sha(fs.readFileSync(path.join(__dirname, 'GeneratedOuterReplayTest.java'))); + } + const version = fs.readFileSync(path.join(repo, 'pom.xml'), 'utf8').match(/([^<]+)<\/version>/)[1]; + const dependencies = ['teaql-runtime', 'teaql-sqlite', 'teaql-jackson', ...(restorationViews || outerReplay ? ['teaql-dynamic-fields-jdbc'] : [])].map(name => + `io.teaql${name}${version}`).join('') + + 'com.fasterxml.jackson.datatypejackson-datatype-jsr310'; + const pom = `4.0.0io.teaqlteaql-java-parent${version}../source/pom.xmlio.teaql.examplesteaql-canonical-name-example${version}com.examplescalar-type-conformance-service-core0.0.1-SNAPSHOT${dependencies}junitjunit4.13.2testorg.apache.maven.pluginsmaven-surefire-pluginfalse`; + fs.writeFileSync(path.join(consumer, 'pom.xml'), pom); fs.writeFileSync(path.join(output, 'consumer-pom.xml'), pom); + const reactor = path.join(scratch, 'pom.xml'); fs.writeFileSync(reactor, '4.0.0io.teaql.testcanonical-name-reactor0.0.0pomsourcegeneratedconsumer'); + const expectedCases = ['canonical-create', 'q-e-load-state', 'canonical-update', 'malformed-zero-provider', 'required-zero-provider', 'typed-json-default-profile', 'real-second-update-rollback', 'same-graph-retry']; + for (const round of [1, 2]) { + const command = ['mvn', '-o', '-B', '-ntp', '-f', reactor, '-pl', ':teaql-canonical-name-example', '-am', 'test', memoryEmpty ? '-Dtest=JavaMemoryEmptyAggregateTest' : empty ? '-Dtest=JavaEmptyAggregateTest' : sqlMillis ? '-Dtest=GeneratedSqlMillisecondTest' : finite ? '-Dtest=GeneratedFiniteScalarTest' : jdbcExact ? '-Dtest=GeneratedJdbcExactReadTest' : outerReplay ? '-Dtest=GeneratedOuterReplayTest' : restorationViews ? '-Dtest=GeneratedRestorationViewTest' : '-Dtest=GeneratedCanonicalNameTest', '-Dsurefire.failIfNoSpecifiedTests=false', '-Dteaql.version=' + version, '-Dteaql.expected.runtime.root=' + source]; + const log = path.join(output, 'round-' + round + '.log'), fd = fs.openSync(log, 'wx'); let result; + try { result = await runner.run(command, {cwd: scratch, timeout: 300000, env: {...process.env, + TEAQL_NAME_DB: path.join(output, 'fixture.sqlite'), TEAQL_NAME_ROUND: String(round), + ...(empty ? {TEAQL_EMPTY_DB:path.join(output,'fixture.sqlite'),TEAQL_EMPTY_ROUND:String(round),TEAQL_EMPTY_VECTORS:path.join(output,'empty-vectors.json')} : {})}, stdio: ['ignore', fd, fd]}); } + finally { fs.closeSync(fd); } + const bytes = fs.readFileSync(log), text = bytes.toString(); + report.commands.push({command, exitCode: result.status, signal: result.signal, logSha256: sha(bytes)}); + if (sqlMillis) { + const junit = path.join(consumer, 'target/surefire-reports/TEST-com.example.scalartypeconformanceservice.GeneratedSqlMillisecondTest.xml'); + if (fs.existsSync(junit)) fs.copyFileSync(junit, path.join(output, 'round-'+round+'-junit.xml')); + } + assert.equal(result.status, 0, text.slice(-12000)); assert.equal(result.signal, null); + if (empty) { + const junit = fs.readFileSync(path.join(consumer, 'target/surefire-reports/TEST-com.example.scalartypeconformanceservice.'+(memoryEmpty?'JavaMemoryEmptyAggregateTest':'JavaEmptyAggregateTest')+'.xml')); + assert.match(junit.toString(), /tests="1"/); assert.match(junit.toString(), /failures="0"/); assert.match(junit.toString(), /errors="0"/); assert.match(junit.toString(), /skipped="0"/); + fs.writeFileSync(path.join(output,'round-'+round+'-junit.xml'),junit); + const values = [...text.matchAll(memoryEmpty ? /^JAVA_GENERATED_MEMORY_EMPTY_AGGREGATE=(.+)$/gm : /^JAVA_GENERATED_EMPTY_AGGREGATE=(.+)$/gm)].map(match=>JSON.parse(match[1])); + assert.equal(values.length,1); require(memoryEmpty ? './memory-empty-observations.cjs' : './empty-observations.cjs').observation(values[0],round); + for (const row of values[0].rows.filter(row=>row.case==='EA-05')) { + assert(Object.hasOwn(row.entityJSON,'_total')); assert.equal(row.entityJSON._total,null); assert.equal(row.entityJSON._rows,0); + } + report.rounds.push(values[0]); assert.deepEqual(fixture(),input); assert.equal(sourceHash(),before); continue; + } + if (sqlMillis) { + const values = [...text.matchAll(/^JAVA_SQL_MILLISECOND=(.+)$/gm)].map(match => JSON.parse(match[1])); + assert.equal(values.length, 5); assert(values.every(v => v.passed && v.round === round && !v.legacySqlPrecisionAccepted && !v.businessClockChanged + && v.legacyMigrationRejectionAccepted === (v.case === 'legacy-rejection'))); + assert.deepEqual(values.map(v => [v.case,v.cases]).sort(), [['legacy-rejection',4],['matrix-save-query-e',18],['minimal-projection',1],['native-json',18],['update-equality',3]]); + report.rounds.push({round,cases:values}); assert.deepEqual(fixture(),input); assert.equal(sourceHash(),before); continue; + } + if (finite) { + const frames = marker => text.split(/\r?\n/).filter(v => v.startsWith(marker+'=')).map(v => JSON.parse(v.slice(marker.length+1))); + const rows = frames('JAVA_FINITE_SCALAR_CASE'); assert.equal(rows.length,25); assert(rows.every(v => v.contractPass && v.round===round)); + const summary = frames('JAVA_FINITE_SCALAR_RESULT'); assert.equal(summary.length,1); assert.equal(summary[0].contractFailures,0); + const fix = frames('JAVA_FINITE_CUSTOM_FIX'); assert.deepEqual(fix,[{round,rejected:24,repaired:4,oneFixPerSave:true,passed:true}]); + const legacy = frames('JAVA_FINITE_LEGACY'); assert.deepEqual(legacy,[{round,cases:8,unchangedVersions:true,passed:true}]); + const graph = frames('JAVA_FINITE_GRAPH_RETRY'); assert.deepEqual(graph,[{round,children:2,version:2,sameGraph:true,passed:true}]); + const origins = frames('JAVA_FINITE_OFFICIAL_ORIGINS'); assert.equal(origins.length,1); + assert.equal(Object.keys(origins[0]).length,4); assert(Object.values(origins[0]).every(v => v.startsWith(source+path.sep))); + report.rounds.push({round,cases:rows,summary:summary[0],fix:fix[0],legacy:legacy[0],graph:graph[0],origins:origins[0]}); + assert.deepEqual(fixture(),input); assert.equal(sourceHash(),before); continue; + } + if (jdbcExact) { + const values = [...text.matchAll(/^JAVA_JDBC_EXACT_READ=(.+)$/gm)].map(match => JSON.parse(match[1])); + assert.equal(values.length, 1); const value = values[0]; assert(value.passed && value.round === round); + const names = ['integer-fraction','integer-upper-overflow','integer-lower-overflow','long-fraction','long-rounded-overflow','float-overflow','double-infinity','decimal-private-text']; + assert.deepEqual(value.cases, ['one','stream'].flatMap(mode => names.map(name => mode + '/' + name))); + for (const key of ['generatedQ','loadedE','unselectedNotLoaded','physicalCorruptionConfirmed','queryProducesNoMutation','privateValuesExcluded','sameAdapterRecovers','exactNativeBounds']) assert.equal(value[key], true); + assert.equal(value.boundaryVersion, 2); report.rounds.push(value); assert.deepEqual(fixture(), input); assert.equal(sourceHash(), before); continue; + } + if (outerReplay) { + const values = [...text.matchAll(/^JAVA_OUTER_REPLAY=(.+)$/gm)].map(match => JSON.parse(match[1])); + assert.equal(values.length, 7); assert(values.every(value => value.passed && value.round === round)); + assert.deepEqual(values.map(value => value.case).sort(), ['different-native-fields','dynamic-saved-unsaved','dynamic-then-native','new-then-update','raw-admission','same-native-field','unsaved-native-field']); + report.rounds.push({round, cases: values}); assert.deepEqual(fixture(), input); assert.equal(sourceHash(), before); + continue; + } + if (restorationViews) { + const values = [...text.matchAll(/^JAVA_RESTORATION_VIEW=(.+)$/gm)].map(match => JSON.parse(match[1])); + assert.equal(values.length, 3); assert(values.every(value => value.passed && value.round === round)); + assert.deepEqual(values.map(value => value.case).sort(), ['caller-transaction-rollback-retry-commit', 'persistent-dynamic-noop-and-real-edit', 'readonly-sparse-noop']); + report.rounds.push({round, cases: values}); assert.deepEqual(fixture(), input); assert.equal(sourceHash(), before); + continue; + } + const rows = text.split(/\r?\n/).filter(line => line.startsWith('JAVA_CANONICAL_NAME=')); assert.equal(rows.length, 1); + const value = JSON.parse(rows[0].slice('JAVA_CANONICAL_NAME='.length)); + assert.equal(value.passed, true); assert.equal(value.round, round); assert.deepEqual(value.cases, expectedCases); + assert.equal(value.malformedRejections, 12); assert.equal(value.requiredRejections, 2); + assert.equal(value.rolledBackAfterWrites, 1); assert.equal(value.retryAuditEntities, 2); + report.rounds.push(value); assert.deepEqual(fixture(), input); assert.equal(sourceHash(), before); + } + if (sqlMillis) report.databases = Object.fromEntries(['matrix','update','json','projection','legacy'].map(name => { + const file = 'fixture.sqlite.sql-millis-'+name; return [file,sha(fs.readFileSync(path.join(output,file)))]; + })); + else if (finite) report.databases = Object.fromEntries(['','.finite-fix','.finite-legacy','.finite-retry'].map(suffix => { + const file = 'fixture.sqlite'+suffix; return [file,sha(fs.readFileSync(path.join(output,file)))]; + })); + else if (outerReplay) report.databases = Object.fromEntries(['different-native-fields','dynamic-saved-unsaved','dynamic-then-native','new-then-update','raw-admission','same-native-field','unsaved-native-field'].map(name => { + const file = 'fixture.sqlite.outer-replay-' + name + '.sqlite'; return [file, sha(fs.readFileSync(path.join(output, file)))]; + })); + else if (restorationViews) report.databases = Object.fromEntries(['readonly', 'transaction', 'dynamic'].map(name => { + const file = 'fixture.sqlite.views-' + name + '.sqlite'; return [file, sha(fs.readFileSync(path.join(output, file)))]; + })); + else if (memoryEmpty) { report.memoryOnly=true; report.freshInProcessStorePerRound=true; } + else report.databaseSha256 = sha(fs.readFileSync(path.join(output, 'fixture.sqlite'))); + if (empty) assert.equal(new Set(report.rounds.flatMap(value=>[...value.scalarIds,...value.bucketIds])).size,16); + report.passed = true; + if (sqlMillis) report.legacySqlMigrationRejectionAccepted = true; + console.log(memoryEmpty ? 'PASS generated Java memory EA01–08, selected-null JSON, relation and facet buckets twice without SQL' + : empty ? 'PASS generated Java EA01–08, selected-null JSON and actual SQLite failure/recovery twice' + : sqlMillis ? 'PASS generated Java SQL milliseconds save, typed Q/E, native JSON, projections and legacy rejection twice' + : finite ? 'PASS generated Java finite scalar, customer Fix, legacy reads and graph retry twice' + : jdbcExact ? 'PASS generated Java exact JDBC Q/E corruption boundaries twice' + : outerReplay ? 'PASS generated Java seven outer transaction retry scenarios twice' + : restorationViews ? 'PASS generated Java unchanged view geometry and caller transaction rollback/retry/commit twice' + : 'PASS generated Java canonical naming, Q/E, Checker, default JSON and real graph rollback/retry twice'); + } catch (error) { report.error = error.stack; console.error(error.stack); process.exitCode ||= 1; } + finally { + report.disposedOwnedBytes = runner.safeToClean ? ownedBytes(scratch) : 0; + if (runner.safeToClean) fs.rmSync(scratch, {recursive: true}); else report.unsafeBuildRetention = scratch; + report.scratchRemoved = !fs.existsSync(scratch); runner.dispose(); + fs.writeFileSync(path.join(output, 'receipt.json'), JSON.stringify(report, null, 2) + '\n'); + console.log('Retained compact name-probe evidence: ' + output); + } +} +main().catch(error => { console.error(error.stack); process.exitCode ||= 1; }); diff --git a/examples/school-management/lib/pom.xml b/examples/school-management/lib/pom.xml index b59d0e19d..2e9f4bc97 100644 --- a/examples/school-management/lib/pom.xml +++ b/examples/school-management/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 1.556-RELEASE UTF-8 true diff --git a/examples/school-management/pom.xml b/examples/school-management/pom.xml index df27e5679..d83f373f2 100644 --- a/examples/school-management/pom.xml +++ b/examples/school-management/pom.xml @@ -16,7 +16,7 @@ 0.0.1-SNAPSHOT UTF-8 true - 1.555-RELEASE + 1.556-RELEASE diff --git a/examples/security-foundations/pom.xml b/examples/security-foundations/pom.xml index 76356218c..5c1e5269f 100644 --- a/examples/security-foundations/pom.xml +++ b/examples/security-foundations/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../../pom.xml teaql-security-foundations-example diff --git a/examples/shared-load-state/pom.xml b/examples/shared-load-state/pom.xml index 4044e81d2..fd4751336 100644 --- a/examples/shared-load-state/pom.xml +++ b/examples/shared-load-state/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.teaqlteaql-java-parent1.555-RELEASE + io.teaqlteaql-java-parent1.556-RELEASE ../../pom.xml shared-load-state-example diff --git a/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNativeRollbackAcceptance.java b/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNativeRollbackAcceptance.java index 408fbf176..b11417b16 100644 --- a/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNativeRollbackAcceptance.java +++ b/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNativeRollbackAcceptance.java @@ -66,7 +66,9 @@ private static void verifyMissingColumn(UserContext context,ObservedJdbcExecutor sql.omitNativeDateAfterWrite(); try { var error=assertThrows(RuntimeException.class,()->pending.auditAs("Reject incomplete native readback").save(context)); - assertTrue(error.getMessage().contains("missing mapped field School.establishedDate")); + // Authoritative-readback metadata identifies the KSML property; + // Java display spelling must not replace this model identity. + assertTrue(error.getMessage().contains("missing mapped field School.established_date"), error.getMessage()); } finally {sql.clearNativeOmission();} assertTrue(sql.nativeOmissionObserved(),"omission must happen after successful native DML"); assertEquals(version,pending.getVersion());assertSame(state,pending.__internalLoadState()); diff --git a/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNestedGraphAssertions.java b/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNestedGraphAssertions.java index b2898906c..9f3facda0 100644 --- a/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNestedGraphAssertions.java +++ b/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedNestedGraphAssertions.java @@ -147,8 +147,11 @@ static void verify(UserContext context, Long schoolId, String renamed, var missing = assertThrows(io.teaql.core.value.TeaQLNotLoadedException.class, () -> E.school(filtered).getSchoolType().getCode().eval()); assertEquals("schoolType.code", missing.getAccessPath()); + assertEquals("school_type.code", missing.getLocation().modelPath()); + assertEquals("/schoolType/code", missing.getInstancePath()); assertEquals("code", missing.getBreakPoint()); - assertEquals("School(id=" + schoolId + ")", missing.getRoot()); + assertEquals("School", missing.getRoot()); + assertFalse(missing.getMessage().contains("(id="), "E diagnostics must not expose entity identity"); var filteredJson = mapper.readTree(mapper.writeValueAsString(filtered)); assertFalse(filteredJson.get("schoolType").has("code")); var restoredFiltered = mapper.treeToValue(filteredJson, filtered.getClass()); @@ -157,8 +160,11 @@ static void verify(UserContext context, Long schoolId, String renamed, var restoredMissing = assertThrows(io.teaql.core.value.TeaQLNotLoadedException.class, () -> E.school(restoredFiltered).getSchoolType().getCode().eval()); assertEquals("schoolType.code", restoredMissing.getAccessPath()); + assertEquals("school_type.code", restoredMissing.getLocation().modelPath()); + assertEquals("/schoolType/code", restoredMissing.toWire().instancePath()); assertEquals("code", restoredMissing.getBreakPoint()); - assertEquals("School(id=" + schoolId + ")", restoredMissing.getRoot()); + assertEquals("School", restoredMissing.getRoot()); + assertFalse(restoredMissing.getMessage().contains("(id="), "JSON-restored E diagnostics must also redact identity"); assertFalse(restoredFiltered.__internalHasMutationLedger()); System.out.println("PASS generated Java LF08 exact NotLoaded type and path in Q and typed JSON"); System.out.println("PASS generated Java LF08 loaded FK and excluded forward details stay distinct"); diff --git a/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedPropertyMetadataAcceptance.java b/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedPropertyMetadataAcceptance.java index 130b51a4c..93cc0b2dd 100644 --- a/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedPropertyMetadataAcceptance.java +++ b/examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/GeneratedPropertyMetadataAcceptance.java @@ -9,9 +9,10 @@ final class GeneratedPropertyMetadataAcceptance { static void verify(UserContext context, String first, String second) { var request = Q.schoolsWithMinimalFields().withNameIn(first,second).selectName().orderByIdAscending().limit(2); var metadata = new DynamicPropertyMetadata(Map.of("_missing_count",Long.class,"_count",Number.class,"_null",String.class)); - request.addSimpleDynamicProperty("_count",new io.teaql.core.PropertyReference("studentCapacity")); - String nullableMember=io.teaql.core.FieldLayout.forType(com.example.schoolmanagementservice.school.School.class).memberName("probe_0"); - if(nullableMember!=null) request.addSimpleDynamicProperty("_null",new io.teaql.core.PropertyReference(nullableMember)); + // AST field references use model names, not language-native member names. + request.addSimpleDynamicProperty("_count",new io.teaql.core.PropertyReference("student_capacity")); + boolean hasNullableProbe=io.teaql.core.FieldLayout.forType(com.example.schoolmanagementservice.school.School.class).findIndex("probe_0")!=null; + if(hasNullableProbe) request.addSimpleDynamicProperty("_null",new io.teaql.core.PropertyReference("probe_0")); request.setDynamicPropertyMetadata(metadata); var rows = request.comment("what: load generated School with a readonly schema") .purpose("why: keep schema sharing distinct from value presence").executeForList(context); @@ -28,7 +29,7 @@ static void verify(UserContext context, String first, String second) { assertEquals(0,((Number)row.getDynamicProperty("_count")).intValue()); assertTrue(row.hasDynamicProperty("_count")); assertNull(row.getDynamicProperty("_null")); - assertEquals(nullableMember!=null,row.hasDynamicProperty("_null")); + assertEquals(hasNullableProbe,row.hasDynamicProperty("_null")); } try(var stream=request.comment("what: stream generated School readonly schema") .purpose("why: retain schema after cursor cleanup").executeForStream(context)) { diff --git a/examples/shared-load-state/verify.sh b/examples/shared-load-state/verify.sh index 9382d9b32..14c0866bd 100644 --- a/examples/shared-load-state/verify.sh +++ b/examples/shared-load-state/verify.sh @@ -17,7 +17,7 @@ if [[ "$generate" == true ]]; then : "${TEAQL_CODEGEN_DIR:?Set TEAQL_CODEGEN_DIR to the local generator checkout}" mvn -q -f "$TEAQL_CODEGEN_DIR/pom.xml" -pl generator -am \ '-Dtest=JavaGeneratedMysqlSqliteIntegrationTest#generatedJavaSharedLoadStateRuntimeExample' \ - -Dsurefire.failIfNoSpecifiedTests=false -Dteaql.loadState.generateOnly=true "-Dteaql.loadState.wide=$wide" "-Dteaql.loadState.inheritance=$inheritance" \ + -Dexec.skip=true -Dsurefire.failIfNoSpecifiedTests=false -Dteaql.loadState.generateOnly=true "-Dteaql.loadState.wide=$wide" "-Dteaql.loadState.inheritance=$inheritance" \ "-Dteaql.java.dir=$runtime_dir" test fi fixture_mode=narrow diff --git a/examples/standard-order/generated/lib/pom.xml b/examples/standard-order/generated/lib/pom.xml index 3696cf80f..21b5c8cec 100644 --- a/examples/standard-order/generated/lib/pom.xml +++ b/examples/standard-order/generated/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 1.556-RELEASE UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.555-RELEASE + 1.556-RELEASE io.teaql diff --git a/examples/standard-order/pom.xml b/examples/standard-order/pom.xml index 76ccc9981..c76a630e3 100644 --- a/examples/standard-order/pom.xml +++ b/examples/standard-order/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 io.teaqlteaql-java-parent - 1.555-RELEASE../../pom.xml + 1.556-RELEASE../../pom.xml teaql-standard-order-example 21 diff --git a/examples/trace-chain/lib/pom.xml b/examples/trace-chain/lib/pom.xml index fb678b177..6883f029f 100644 --- a/examples/trace-chain/lib/pom.xml +++ b/examples/trace-chain/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 1.556-RELEASE UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.555-RELEASE + 1.556-RELEASE io.teaql diff --git a/examples/trace-chain/pom.xml b/examples/trace-chain/pom.xml index d7b2f1c79..19fa45ec4 100644 --- a/examples/trace-chain/pom.xml +++ b/examples/trace-chain/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../../pom.xml teaql-trace-chain-example diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java index dece0c3d3..8aa8879f9 100644 --- a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java +++ b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java @@ -251,7 +251,15 @@ static final class Fixture { var previous = Q.customerOrders().orderByIdDescending().limit(1) .comment("what: select the previous fixture identity") .purpose("why: replay without deleting the database").executeForOne(context); - base = previous == null ? 100 : E.customerOrder(previous).getId().eval() + 1000; + long persistedFloor = previous == null ? 100 : E.customerOrder(previous).getId().eval() + 1000; + // Failed/abandoned creations now retain real reserved IDs. Advance + // beyond every fixture type's allocation state, not just persisted + // orders. These reservations create no domain rows. Keep the exact + // cross-type ID controls below, including order == payment. + long reservedFloor = 100; + for (String type : List.of("CustomerOrder", "Payment", "OrderItem", "PaymentAttempt", "Shipment")) + reservedFloor = Math.max(reservedFloor, Math.addExact(ids.nextId(type), 1)); + base = Math.max(persistedFloor, reservedFloor); ids.ensureFloor("CustomerOrder", base - 1); ids.ensureFloor("Payment", base - 1); ids.ensureFloor("OrderItem", base + 100); @@ -371,6 +379,9 @@ private static Throwable saveFailure(CustomerOrder order, UserContext context, S .purpose("why: require an independent Checker rejection").newEntity(fixture.context); invalid.updatePlatform(platform); invalid.updateDescription("Invalid overlapping request"); + var invalidId = invalid.getId(); + assertNotNull("creation reserves identity before validation", invalidId); + assertTrue(invalidId > 0); assertNotSame(valid.getEntityMutationLedger(), invalid.getEntityMutationLedger()); var validThread = new AtomicReference(); var validEntered = new CountDownLatch(1); @@ -413,7 +424,10 @@ private static Throwable saveFailure(CustomerOrder order, UserContext context, S assertEquals(lineage, fixture.commands.get(0).getTraceChain()); assertEquals(lineage, fixture.audit.get(0).traceChain()); assertTrue(fixture.sql.stream().allMatch(entry -> entry.getMutationLineage().equals(lineage))); - assertNull("Checker rejects before allocation", invalid.getId()); + assertEquals("Checker rejection preserves the factory-reserved identity", invalidId, invalid.getId()); + assertNull("Checker rejects before a persisted version exists", invalid.getVersion()); + assertTrue("failed creation keeps its pending-new intent", invalid.newItem()); + assertEquals(Set.of(new EntityKey("CustomerOrder", invalidId)), invalid.getEntityMutationLedger().newKeys()); } finally { validEntered.countDown(); invalidFinishing.countDown(); validFinished.countDown(); workers.shutdownNow(); diff --git a/examples/verify-runtime-examples.sh b/examples/verify-runtime-examples.sh index 2e072eabf..821c4a6e3 100755 --- a/examples/verify-runtime-examples.sh +++ b/examples/verify-runtime-examples.sh @@ -87,7 +87,9 @@ done bash "$repo_dir/examples/trace-chain/verify.sh" if [[ -n "${TEAQL_CODEGEN_DIR:-}" ]]; then bash "$repo_dir/examples/shared-load-state/verify.sh" --generate + bash "$repo_dir/examples/exact-decimal/verify.sh" + printf 'PASS Java runtime examples: 5/5 (including generated exact Decimal)\n' else bash "$repo_dir/examples/shared-load-state/verify.sh" + printf 'PASS Java runtime examples: 4/4; generated exact Decimal requires TEAQL_CODEGEN_DIR\n' fi -printf 'PASS Java runtime examples: 4/4\n' diff --git a/pom.xml b/pom.xml index 9a3262bde..94577e340 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE pom teaql-java-parent diff --git a/scripts/pin-local-example-pom.cjs b/scripts/pin-local-example-pom.cjs new file mode 100644 index 000000000..8e9fbcb14 --- /dev/null +++ b/scripts/pin-local-example-pom.cjs @@ -0,0 +1,30 @@ +'use strict'; +// Rebind only build metadata in a disposable consumer, after fixture validation. +// The evaluated model and frozen generated implementation are never edited. +const fs = require('node:fs'), path = require('node:path'), assert = require('node:assert/strict'); +const crypto = require('node:crypto'), sha = value => crypto.createHash('sha256').update(value).digest('hex'); +function pin(file, runtime, ownedRoot) { + for (const target of [file, runtime, ownedRoot]) assert.equal(fs.realpathSync(target), target); + assert(file.startsWith(ownedRoot + path.sep) && !file.startsWith(runtime + path.sep), 'Only an owned disposable POM may be adapted'); + assert.equal(path.basename(file), 'pom.xml'); + const root = fs.readFileSync(path.join(runtime, 'pom.xml'), 'utf8'); + const version = root.match(/([^<]+)<\/version>/)[1]; + const modules = new Set([...root.matchAll(/(teaql-[^<]+)<\/module>/g)].map(match => match[1])); + assert(modules.size > 0); + const before = fs.readFileSync(file, 'utf8'), changes = []; + let after = before.replace(/([^<]+)<\/teaql\.version>/g, (_, from) => { + changes.push({property: 'teaql.version', from, to: version}); return '' + version + ''; + }); + after = after.replace(/[\s\S]*?<\/dependency>/g, block => { + if (!/io\.teaql<\/groupId>/.test(block)) return block; + const name = block.match(/([^<]+)<\/artifactId>/)?.[1]; + if (!modules.has(name)) return block; + return block.replace(/(\d[^<]*)<\/version>/, (_, from) => { + changes.push({artifact: name, from, to: version}); return '' + version + ''; + }); + }); + assert(changes.length > 0, 'No declared runtime coordinates to bind'); + fs.writeFileSync(file, after); + return {version, changes, originalPomSha256: sha(before), consumerPomSha256: sha(after), sourceFixtureEdited: false, generatedImplementationEdited: false}; +} +module.exports = {pin}; diff --git a/scripts/pin-local-example-pom.test.cjs b/scripts/pin-local-example-pom.test.cjs new file mode 100644 index 000000000..5bb389e7a --- /dev/null +++ b/scripts/pin-local-example-pom.test.cjs @@ -0,0 +1,38 @@ +'use strict'; +const {test} = require('node:test'), assert = require('node:assert/strict'); +const fs = require('node:fs'), path = require('node:path'), os = require('node:os'); +const {pin} = require('./pin-local-example-pom.cjs'); +function fixture(run) { + const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-local-pom-test-')); + try { + const runtime = path.join(scratch, 'runtime'), owned = path.join(scratch, 'consumer'); + fs.mkdirSync(runtime); fs.mkdirSync(owned); + fs.writeFileSync(path.join(runtime, 'pom.xml'), '1.556-RELEASEteaql-coreteaql-sqlite'); + const file = path.join(owned, 'pom.xml'); + const original = '1.555-RELEASE' + + 'io.teaqlteaql-core${teaql.version}' + + 'io.teaqlteaql-sqlite1.555-RELEASE' + + 'otherteaql-sqlite1.555-RELEASE'; + fs.writeFileSync(file, original); run({runtime, owned, file, original}); + } finally {fs.rmSync(scratch, {recursive: true});} +} +test('binds explicit provider versions and property without changing other dependencies', () => fixture(({runtime, owned, file}) => { + const r = pin(file, runtime, owned), text = fs.readFileSync(file, 'utf8'); + assert.equal(r.changes.length, 2); assert.equal(r.version, '1.556-RELEASE'); + assert.equal(r.generatedImplementationEdited, false); assert.equal(r.sourceFixtureEdited, false); + assert(text.includes('1.556-RELEASE')); + assert(text.includes('teaql-core${teaql.version}')); + assert(text.includes('otherteaql-sqlite1.555-RELEASE')); +})); +test('rejects a source POM even if a caller labels its parent as owned', () => fixture(({runtime, file, original}) => { + const source = path.join(runtime, 'pom-under-test'); fs.mkdirSync(source); + const target = path.join(source, 'pom.xml'); fs.copyFileSync(file, target); + assert.throws(() => pin(target, runtime, source), /disposable/); + assert.equal(fs.readFileSync(target, 'utf8'), original); +})); +test('rejects a symlink and undeclared ownership before writing', () => fixture(({runtime, owned, file, original}) => { + assert.throws(() => pin(file, runtime, runtime), /disposable/); + const link = path.join(owned, 'linked.xml'); fs.symlinkSync(file, link); + assert.throws(() => pin(link, runtime, owned)); + assert.equal(fs.readFileSync(file, 'utf8'), original); +})); diff --git a/scripts/prepare-example-isolation.cjs b/scripts/prepare-example-isolation.cjs new file mode 100644 index 000000000..71c3e5257 --- /dev/null +++ b/scripts/prepare-example-isolation.cjs @@ -0,0 +1,43 @@ +#!/usr/bin/env node +"use strict"; +const fs = require('node:fs'), path = require('node:path'), os = require('node:os'); +const cp = require('node:child_process'), crypto = require('node:crypto'), assert = require('node:assert/strict'); +const [buildRoot, generatorSource, evidence] = process.argv.slice(2); +assert(buildRoot && generatorSource && evidence && process.argv.length === 5); +const build = fs.realpathSync(buildRoot), source = fs.realpathSync(generatorSource); +const git = (...args) => cp.execFileSync('git', ['-C', source, ...args], {maxBuffer: 32 * 1024 * 1024}); +assert.equal(fs.realpathSync(git('rev-parse', '--show-toplevel').toString().trim()), source); +const maven = path.join(build, 'maven'), generator = path.join(build, 'generator'); +assert(!fs.existsSync(maven) && !fs.existsSync(generator)); +const cache = path.resolve(process.env.TEAQL_MAVEN_DEPENDENCY_CACHE || path.join(os.homedir(), '.m2/repository')); +assert(cache !== maven && !maven.startsWith(cache + path.sep)); +let dependencyFiles = 0; +if (fs.existsSync(cache)) fs.cpSync(cache, maven, {recursive: true, filter: file => { + const relative = path.relative(cache, file), parts = relative.split(path.sep); + const stat = fs.lstatSync(file); + // Reuse third-party downloads only. No TeaQL/group/model artifact may leak + // from another local build, and symlinks or in-flight cache files are ignored. + if (stat.isSymbolicLink() || parts.some(part => /^teaql(?:$|-)/.test(part)) + || /(?:\.lastUpdated|\.part|\.lock)$/.test(file)) return false; + if (stat.isFile()) dependencyFiles++; + return true; +}}); +fs.mkdirSync(maven, {recursive: true}); +const hash = crypto.createHash('sha256'); +const files = [...new Set(git('ls-files', '-z', '--cached', '--others', '--exclude-standard').toString().split('\0').filter(Boolean))].sort(); +for (const relative of files) { + assert(!path.isAbsolute(relative) && !relative.split(/[\\/]/).includes('..')); + const original = path.join(source, relative); + if (!fs.existsSync(original)) continue; + assert(fs.lstatSync(original).isFile(), 'generator source requires regular files'); + const destination = path.join(generator, relative), bytes = fs.readFileSync(original); + fs.mkdirSync(path.dirname(destination), {recursive: true}); fs.writeFileSync(destination, bytes); + hash.update(relative + '\0').update(bytes).update('\0'); +} +fs.mkdirSync(evidence, {recursive: true}); +fs.writeFileSync(path.join(evidence, 'isolation.json'), JSON.stringify({ + schema: 'teaql.java-example-isolation/v1', sourceGenerator: source, + generatorCommit: git('rev-parse', 'HEAD').toString().trim(), generatorSourceSha256: hash.digest('hex'), + copiedGeneratorSourceFiles: files.length, reusedThirdPartyDependencyFiles: dependencyFiles, + cachedTeaqlArtifactsCopied: false, isolatedMavenRepository: true, sharedRepositoryWrites: false, +}, null, 2) + '\n', {flag: 'wx'}); diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 204f99899..e222486c6 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -2,9 +2,17 @@ set -euo pipefail repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -verification_dir="$(mktemp -d)" -trap 'rm -rf -- "$verification_dir"' EXIT -expected=(business-id-runtime conformance http-resilience object-storage order-management round-trip-reference-runtime school-management security-foundations shared-load-state standard-order trace-chain) +evidence_dir="${TEAQL_EXAMPLES_EVIDENCE_DIR:-$(mktemp -d -t teaql-java-examples-evidence.XXXXXXXX)}" +verification_dir="$evidence_dir/runtime" +mkdir -p "$verification_dir" +build_dir="$(mktemp -d -t teaql-java-examples-build.XXXXXXXX)" +cleanup() { result=$?; trap - EXIT; wait; rm -rf -- "$build_dir"; exit "$result"; } +trap cleanup EXIT +: "${TEAQL_CODEGEN_DIR:?Set TEAQL_CODEGEN_DIR to the local generator checkout}" +node "$repo/scripts/prepare-example-isolation.cjs" "$build_dir" "$TEAQL_CODEGEN_DIR" "$evidence_dir" +export MAVEN_OPTS="${MAVEN_OPTS:-} -Dmaven.repo.local=$build_dir/maven" +echo "Native example artifacts use an isolated disposable Maven repository; compact evidence: $evidence_dir" +expected=(business-id-runtime conformance exact-decimal fix-e-alignment http-resilience object-storage order-management round-trip-reference-runtime scalar-type-probe school-management security-foundations shared-load-state standard-order trace-chain) mapfile -t actual < <(find "$repo/examples" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort) if [[ "${actual[*]}" != "${expected[*]}" ]]; then echo "example inventory changed; update scripts/verify-examples.sh: ${actual[*]}" >&2 @@ -12,6 +20,9 @@ if [[ "${actual[*]}" != "${expected[*]}" ]]; then fi cd "$repo" +# This verifier needs original Git provenance and already creates its own +# disposable source-paired reactor. It never builds in the source repository. +node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/fix-e-alignment/verify-local.cjs" bash examples/object-storage/verify.sh bash examples/http-resilience/verify.sh mvn -q -DskipTests install @@ -26,6 +37,8 @@ mvn -q -pl examples/round-trip-reference-runtime \ mvn -q -f examples/conformance/lib/pom.xml install -DskipTests mvn -q -f examples/conformance/pom.xml spring-boot:run \ -Dspring-boot.run.arguments="--spring.main.web-application-type=none --spring.datasource.url=jdbc:sqlite:$verification_dir/conformance.db" +TEAQL_JAVA_SPRING_EVIDENCE_DIR="$evidence_dir/spring-transactions" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/conformance/spring-transactions/verify-local.cjs" mvn -q -f examples/school-management/lib/pom.xml install -DskipTests mvn -q -f examples/school-management/pom.xml spring-boot:run \ -Dspring-boot.run.arguments="--spring.main.web-application-type=none --spring.datasource.url=jdbc:sqlite:$verification_dir/school-management.db" @@ -36,4 +49,41 @@ mvn -q -f examples/order-management/pom.xml install -DskipTests bash examples/trace-chain/verify.sh bash examples/trace-chain/verify-standard-telemetry.sh bash examples/standard-order/verify.sh -echo "PASS: standard Java examples; shared-load-state has its own generator-backed verify.sh gate" +TEAQL_CODEGEN_DIR="$build_dir/generator" bash examples/shared-load-state/verify.sh --generate +TEAQL_JAVA_EXACT_EVIDENCE_DIR="$evidence_dir/exact-decimal" \ + bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/exact-decimal/verify.sh" +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/scalar-type-probe" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/scalar-finite" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --finite +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/restoration-views" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --restoration-views +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/outer-replay" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --outer-replay +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/jdbc-exact" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --jdbc-exact +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/sql-millisecond" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --sql-millis +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/empty-aggregates" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --empty +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/memory-empty-aggregates" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --memory-empty +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-profiles" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-lifecycle" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --lifecycle +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-numeric" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --numeric +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-temporal" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --temporal +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-local-datetime" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --local-datetime +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/rejected-mutation" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --rejected +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/explicit-null" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --explicit-null +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/loaded-revert" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --loaded-revert +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/version-lifecycle" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --version-lifecycle +echo "PASS: all Java examples" diff --git a/teaql-android/pom.xml b/teaql-android/pom.xml index ae06ce6fb..0a9b27a77 100644 --- a/teaql-android/pom.xml +++ b/teaql-android/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-android diff --git a/teaql-business-id-jdbc/pom.xml b/teaql-business-id-jdbc/pom.xml index 63bd27ffd..510f40fc6 100644 --- a/teaql-business-id-jdbc/pom.xml +++ b/teaql-business-id-jdbc/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-cloud/pom.xml b/teaql-cloud/pom.xml index 09c694225..eb52757f1 100644 --- a/teaql-cloud/pom.xml +++ b/teaql-cloud/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-cloud teaql-cloud diff --git a/teaql-context-runtime-tools/pom.xml b/teaql-context-runtime-tools/pom.xml index ea0f45a83..c343e5349 100644 --- a/teaql-context-runtime-tools/pom.xml +++ b/teaql-context-runtime-tools/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-context-runtime-tools diff --git a/teaql-core/pom.xml b/teaql-core/pom.xml index 161317bc4..2e230b3e9 100644 --- a/teaql-core/pom.xml +++ b/teaql-core/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-core/src/main/java/io/teaql/core/BaseEntity.java b/teaql-core/src/main/java/io/teaql/core/BaseEntity.java index d2fa2f4fe..19d5290b2 100644 --- a/teaql-core/src/main/java/io/teaql/core/BaseEntity.java +++ b/teaql-core/src/main/java/io/teaql/core/BaseEntity.java @@ -105,8 +105,9 @@ public Long getId() { } public BaseEntity updateId(Long id) { - markPropertyLoaded(ID_PROPERTY); - if (ObjectUtil.equals(this.id, id)) return this; + if (isPropertyLoaded(ID_PROPERTY) && ObjectUtil.equals(this.id, id)) { + return this; + } handleUpdate(ID_PROPERTY, getId(), id); this.id = id; return this; @@ -131,8 +132,9 @@ public Long getVersion() { } public BaseEntity updateVersion(Long version) { - markPropertyLoaded(VERSION_PROPERTY); - if (ObjectUtil.equals(this.version, version)) return this; + if (isPropertyLoaded(VERSION_PROPERTY) && ObjectUtil.equals(this.version, version)) { + return this; + } handleUpdate(VERSION_PROPERTY, getVersion(), version); this.version = version; return this; @@ -208,7 +210,7 @@ public void setRuntimeType(String runtimeType) { @Override public boolean newItem() { - return $status == EntityStatus.NEW; + return $status == EntityStatus.NEW || $status == EntityStatus.NEW_DELETED; } @Override @@ -218,7 +220,7 @@ public boolean updateItem() { @Override public boolean deleteItem() { - return $status == EntityStatus.UPDATED_DELETED; + return $status == EntityStatus.UPDATED_DELETED || $status == EntityStatus.NEW_DELETED; } @Override @@ -374,6 +376,38 @@ public void clearUpdatedProperties() { if (!updatedProperties.isEmpty()) updatedProperties.clear(); } + @FrameworkInternal("Physical transaction rollback; native values are captured by runtime metadata") + public Runnable __internalCaptureMutationRollback() { + var savedUpdates = new HashMap<>(updatedProperties); + var savedAdditional = new HashMap<>(additionalInfo); + var savedDynamic = new HashMap<>(dynamicMutations); + var savedOriginal = new HashMap<>(dynamicOriginalValues); + var savedDynamicValues = dynamicFieldValues; + var savedState = loadState; var savedVersion = version; var savedStatus = $status; + var savedBaseline = hydratedOriginalVersion; + var savedLedger = entityMutationLedger; + return () -> { + updatedProperties = savedUpdates.isEmpty() ? NO_UPDATES : new ConcurrentHashMap<>(savedUpdates); + additionalInfo = savedAdditional.isEmpty() ? Map.of() : new HashMap<>(savedAdditional); + dynamicMutations = savedDynamic.isEmpty() ? Map.of() : new HashMap<>(savedDynamic); + dynamicOriginalValues = savedOriginal.isEmpty() ? Map.of() : new HashMap<>(savedOriginal); + dynamicFieldValues = savedDynamicValues; loadState = savedState; + version = savedVersion; $status = savedStatus; hydratedOriginalVersion = savedBaseline; + entityMutationLedger = savedLedger; + }; + } + + @FrameworkInternal("Physical rollback replay of already tracked native input; never raw-ledger admission") + public void __internalReplayRetryNative(String property, Object value) { + handleUpdate(property, __internalGet(property), value); + __internalSet(property, value); + } + + @FrameworkInternal("Physical rollback replay of already tracked extension input") + public void __internalReplayRetryDynamic(io.teaql.data.dynamic.DynamicFieldMutation mutation) { + stageDynamicMutation(mutation); + } + public void addAction(Object action) { synchronized (this) { if (actionList == null) { @@ -448,6 +482,7 @@ public Set dirtyFields() { } public boolean isMarkedAsDelete() { + if ($status == EntityStatus.NEW_DELETED) return true; if (entityMutationLedger == null || id == null) { return deleteItem(); } @@ -455,6 +490,7 @@ public boolean isMarkedAsDelete() { } public boolean isNew() { + if ($status == EntityStatus.NEW_DELETED) return true; if (entityMutationLedger == null || id == null) { return newItem(); } @@ -471,8 +507,17 @@ public Long getOriginalVersion() { @Override public void setProperty(String propertyName, Object value) { - markPropertyLoaded(propertyName); - this.__internalSet(propertyName, value); + // Generated internal setters cast the value before assignment, but may + // mark it loaded first. Publish availability only after the assignment + // succeeds; this is not hydration and must not replace the version baseline. + boolean previousHydrating = hydratingProperty; + hydratingProperty = true; + try { + this.__internalSet(propertyName, value); + } finally { + hydratingProperty = previousHydrating; + } + if (!previousHydrating) markPropertyLoaded(propertyName); } @FrameworkInternal("Expression and hydration infrastructure only") @@ -537,9 +582,14 @@ private void restorePropertyLoaded(String propertyName, boolean loaded) { @Override public Entity updateProperty(String propertyName, Object value) { + // Validate a forbidden lifecycle before a generic assignment can change + // either the payload or its loaded state. This lookup has no side effects. + get$status().next(EntityAction.UPDATE); + boolean wasLoaded = isPropertyLoaded(propertyName); Object oldValue = getProperty(propertyName); + if (wasLoaded && ObjectUtil.equals(oldValue, value)) return this; setProperty(propertyName, value); - handleUpdate(propertyName, oldValue, value); + handleUpdate(propertyName, oldValue, value, wasLoaded); return this; } @@ -557,17 +607,44 @@ public

P getProperty(String propertyName) { } public void handleUpdate(String propertyName, Object oldValue, Object newValue) { - markPropertyLoaded(propertyName); + handleUpdate(propertyName, oldValue, newValue, isPropertyLoaded(propertyName)); + } + + private void handleUpdate(String propertyName, Object oldValue, Object newValue, boolean wasLoaded) { + // Check before publishing state, including the equal-null case on an + // ID-only reference. Null backing storage is not proof of loaded Null. + get$status().next(EntityAction.UPDATE); + if (wasLoaded && ObjectUtil.equals(oldValue, newValue)) return; gotoNextStatus(EntityAction.UPDATE); + markPropertyLoaded(propertyName); PropertyChange propertyChange = updatedProperties.get(propertyName); + // A NEW object has no hidden persisted value to preserve. Its initial + // null can still be restored; only a persisted unselected baseline is + // unknown across later edits. + boolean originalWasLoaded = wasLoaded || newItem(); if (propertyChange != null) { oldValue = propertyChange.getOldValue(); + originalWasLoaded = propertyChange.wasOldValueLoaded(); } - if (ObjectUtil.equals(oldValue, newValue)) { + if (originalWasLoaded && ObjectUtil.equals(oldValue, newValue)) { if (!updatedProperties.isEmpty()) updatedProperties.remove(propertyName); + EntityKey key = id == null ? null : new EntityKey(typeName(), id); + if (entityMutationLedger != null && key != null) { + entityMutationLedger.clearField(key, propertyName); + } + // Reverting one fixed property cannot cancel another fixed/dynamic + // edit, creation, deletion or recovery, nor another entity's intent. + boolean hasPendingIntent = entityMutationLedger != null && key != null && ( + !entityMutationLedger.changedFieldNames(key).isEmpty() + || entityMutationLedger.isNew(key) + || entityMutationLedger.isMarkedAsDelete(key) + || entityMutationLedger.recoveredKeys().contains(key)); + if (get$status() == EntityStatus.UPDATED && updatedProperties.isEmpty() && !hasPendingIntent) { + set$status(EntityStatus.PERSISTED); + } return; } - mutableUpdatedProperties().put(propertyName, new PropertyChange(propertyName, oldValue, newValue)); + mutableUpdatedProperties().put(propertyName, new PropertyChange(propertyName, oldValue, newValue, originalWasLoaded)); if (id != null) { EntityMutationLedger entityMutationLedger = getEntityMutationLedger(); @@ -589,6 +666,9 @@ public void gotoNextStatus(EntityAction action) { } public void cacheRelation(String relationName, Entity relation) { + // Preserve the existing cache contract for allowed states, but do not + // attach/replace anything before a read-only lifecycle has been rejected. + get$status().next(EntityAction.UPDATE); markPropertyLoaded(relationName); if (relationCache.isEmpty()) relationCache = new HashMap<>(); relationCache.put(relationName, relation); @@ -602,6 +682,12 @@ public Object getOldValue(String propertyName) { return propertyChange.getOldValue(); } + /** Immutable first-change provenance; no ledger allocation or change publication. */ + @FrameworkInternal("Generated Checker original-value admission only; canonical model keys required") + public PropertyChange __internalPropertyChange(String propertyName) { + return updatedProperties.get(propertyName); + } + public Object getNewValue(String propertyName) { PropertyChange propertyChange = updatedProperties.get(propertyName); if (propertyChange == null) return null; diff --git a/teaql-core/src/main/java/io/teaql/core/ChangeSetStack.java b/teaql-core/src/main/java/io/teaql/core/ChangeSetStack.java index f6c27c284..e0ffac448 100644 --- a/teaql-core/src/main/java/io/teaql/core/ChangeSetStack.java +++ b/teaql-core/src/main/java/io/teaql/core/ChangeSetStack.java @@ -25,6 +25,17 @@ public void push() { stack.add(new EntityChangeSet()); } + Runnable captureRollback() { + var saved = new ArrayList(); + for (var current : stack) { + var copy = new EntityChangeSet(); + current.changes().forEach((key, fields) -> fields.forEach((field, value) -> copy.set(key, field, value))); + current.dynamicChanges().forEach((key, fields) -> fields.values().forEach(value -> copy.setDynamic(key, value))); + saved.add(copy); + } + return () -> { stack.clear(); stack.addAll(saved); }; + } + public EntityChangeSet pop() { return stack.isEmpty() ? null : stack.remove(stack.size() - 1); } @@ -39,6 +50,13 @@ public Object get(EntityKey key, String field) { return null; } + boolean contains(EntityKey key, String field) { + for (int i = stack.size() - 1; i >= 0; i--) { + if (stack.get(i).contains(key, field)) return true; + } + return false; + } + public void set(EntityKey key, String field, Object value) { currentMut().set(key, field, value); } @@ -55,6 +73,13 @@ public void clearEntity(EntityKey key) { } } + // Like clearEntity, this is an explicit cancellation against the entity's + // persistent baseline, not a scope pop/rollback. No older intermediate value + // of this one field may reappear; other fields, keys and frames remain. + void clearField(EntityKey key, String field) { + for (EntityChangeSet changeSet : stack) changeSet.clearField(key, field); + } + public Set changedFieldNames(EntityKey key) { Set fields = new TreeSet<>(); for (EntityChangeSet changeSet : stack) { diff --git a/teaql-core/src/main/java/io/teaql/core/ContextRootException.java b/teaql-core/src/main/java/io/teaql/core/ContextRootException.java index a5e0efe64..f0f9f5a13 100644 --- a/teaql-core/src/main/java/io/teaql/core/ContextRootException.java +++ b/teaql-core/src/main/java/io/teaql/core/ContextRootException.java @@ -2,7 +2,7 @@ /** Structured failure for a missing or mismatched trusted active root. */ public class ContextRootException extends TeaQLRuntimeException { - public enum Reason { MISSING, TYPE_MISMATCH, VALUE_MISMATCH } + public enum Reason { MISSING, TYPE_MISMATCH, VALUE_MISMATCH, INVALID_ID } private final Reason reason; private final String expectedType; diff --git a/teaql-core/src/main/java/io/teaql/core/EntityChangeSet.java b/teaql-core/src/main/java/io/teaql/core/EntityChangeSet.java index 13d22dbde..9fd7fec6c 100644 --- a/teaql-core/src/main/java/io/teaql/core/EntityChangeSet.java +++ b/teaql-core/src/main/java/io/teaql/core/EntityChangeSet.java @@ -49,6 +49,13 @@ public void clearEntity(EntityKey key) { if (dynamicChanges != null) dynamicChanges.remove(key); } + void clearField(EntityKey key, String field) { + Map record = changes.get(key); + if (record == null) return; + record.remove(field); + if (record.isEmpty()) changes.remove(key); + } + public Set fieldNames(EntityKey key) { Map record = changes.get(key); var dynamic = dynamicChanges == null ? null : dynamicChanges.get(key); diff --git a/teaql-core/src/main/java/io/teaql/core/EntityMutationLedger.java b/teaql-core/src/main/java/io/teaql/core/EntityMutationLedger.java index d1cdd4cd0..e74f8cea4 100644 --- a/teaql-core/src/main/java/io/teaql/core/EntityMutationLedger.java +++ b/teaql-core/src/main/java/io/teaql/core/EntityMutationLedger.java @@ -41,10 +41,30 @@ public void clearCurrentChangeSet() { traceChains.clear(); } + @FrameworkInternal("Physical transaction rollback only") + public Runnable __internalCaptureRollback() { + Runnable changes = changeSets.captureRollback(); + var deleted = new TreeSet<>(deletedKeys); var recovered = new TreeSet<>(recoveredKeys); + var created = new TreeSet<>(newKeys); var traces = new TreeMap<>(traceChains); + var versions = new TreeMap<>(originalVersions); String reason = comment; + return () -> { + changes.run(); + deletedKeys.clear(); deletedKeys.addAll(deleted); + recoveredKeys.clear(); recoveredKeys.addAll(recovered); + newKeys.clear(); newKeys.addAll(created); + traceChains.clear(); traceChains.putAll(traces); + originalVersions.clear(); originalVersions.putAll(versions); comment = reason; + }; + } + public void set(EntityKey key, String field, Object value) { changeSets.set(key, field, value); } + void clearField(EntityKey key, String field) { + changeSets.clearField(key, field); + } + public void setDynamic(EntityKey key, io.teaql.data.dynamic.DynamicFieldMutation mutation) { changeSets.currentMut().setDynamic(key, mutation); } @@ -53,6 +73,12 @@ public Object get(EntityKey key, String field) { return changeSets.get(key, field); } + /** Read-only presence test, including explicit null, without copying field sets. */ + @FrameworkInternal("Generated Checker pending-field admission only") + public boolean containsField(EntityKey key, String field) { + return changeSets.contains(key, field); + } + public EntityChangeSet currentChangeSet() { EntityChangeSet cs = changeSets.current(); return cs != null ? cs : new EntityChangeSet(); diff --git a/teaql-core/src/main/java/io/teaql/core/EntityStatus.java b/teaql-core/src/main/java/io/teaql/core/EntityStatus.java index 1201043e2..cdaf482ab 100644 --- a/teaql-core/src/main/java/io/teaql/core/EntityStatus.java +++ b/teaql-core/src/main/java/io/teaql/core/EntityStatus.java @@ -29,7 +29,11 @@ public enum EntityStatus { UPDATED_RECOVER, // refer only, cannot change it, and will not persist it - REFER; + REFER, + + // A reserved but never-persisted identity whose creation was cancelled. + // Keep this distinct from a durable tombstone and preserve existing ordinals. + NEW_DELETED; private static final RowKeyTable statusTransaction = new RowKeyTable<>(); @@ -37,6 +41,9 @@ public enum EntityStatus { static { statusTransaction.put(NEW, UPDATE, NEW); statusTransaction.put(NEW, PERSIST, PERSISTED); + statusTransaction.put(NEW, DELETE, NEW_DELETED); + statusTransaction.put(NEW_DELETED, DELETE, NEW_DELETED); + statusTransaction.put(NEW_DELETED, UPDATE, NEW_DELETED); statusTransaction.put(PERSISTED, UPDATE, UPDATED); statusTransaction.put(PERSISTED, DELETE, UPDATED_DELETED); statusTransaction.put(PERSISTED_DELETED, RECOVER, UPDATED_RECOVER); diff --git a/teaql-core/src/main/java/io/teaql/core/ExecutableRequest.java b/teaql-core/src/main/java/io/teaql/core/ExecutableRequest.java index cdcce7252..a2ddc12ee 100644 --- a/teaql-core/src/main/java/io/teaql/core/ExecutableRequest.java +++ b/teaql-core/src/main/java/io/teaql/core/ExecutableRequest.java @@ -26,12 +26,15 @@ public class ExecutableRequest { this.request = request; } - /** Creates a generated entity only after Comment and Purpose are declared. */ + /** Creates a generated entity with its real ID after Comment and Purpose are declared. */ public T newEntity(UserContext context) { if (context == null) { throw new IllegalArgumentException("UserContext is required for entity creation"); } - return context.initializeEntity(request.getTypeName(), request.internalNewEntity()); + T initialized = context.initializeEntity(request.getTypeName(), request.internalNewEntity()); + // A trusted defaults override may omit super.initializeEntity(). Keep + // the public factory's identity/lifecycle contract at its return edge. + return NewEntityLifecycle.initialize(context, request.getTypeName(), initialized); } public SmartList executeForList(UserContext context) { diff --git a/teaql-core/src/main/java/io/teaql/core/FieldLayout.java b/teaql-core/src/main/java/io/teaql/core/FieldLayout.java index 1f30b3b24..d9012e5a7 100644 --- a/teaql-core/src/main/java/io/teaql/core/FieldLayout.java +++ b/teaql-core/src/main/java/io/teaql/core/FieldLayout.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import io.teaql.core.checker.JsonFieldNamingProfile; /** Immutable, type-local fixed positions supplied by the generated library. */ public final class FieldLayout { @@ -22,7 +23,8 @@ FieldLayout resolve(Class type) { FieldLayout current = layout; if (current != null) return current; synchronized (this) { - if (layout == null) layout = new FieldLayout(type, "unindexed", Map.of(), Map.of(), Set.of(), false); + if (layout == null) layout = new FieldLayout(type, "unindexed", Map.of(), Map.of(), Set.of(), false, + JsonFieldNamingProfile.CAMEL_CASE, Map.of()); return layout; } } @@ -33,7 +35,9 @@ synchronized FieldLayout install(FieldLayout candidate) { } else if (!layout.generated || !layout.revision.equals(candidate.revision) || !layout.indexes.equals(candidate.indexes) || !layout.aliases.equals(candidate.aliases) || !layout.members.equals(candidate.members) - || !layout.relations.equals(candidate.relations)) { + || !layout.relations.equals(candidate.relations) + || !layout.jsonNames.equals(candidate.jsonNames) + || !layout.jsonAcceptedNames.equals(candidate.jsonAcceptedNames)) { throw new IllegalArgumentException("Incompatible or late generated field-layout installation: " + candidate.entityType.getName()); } return layout; @@ -46,11 +50,15 @@ synchronized FieldLayout install(FieldLayout candidate) { private final Map aliases; private final Map members; private final Set relations; + private final Map relationAliases; + private final Map jsonNames; + private final Map jsonAcceptedNames; private final boolean generated; private final LoadState empty; private FieldLayout(Class entityType, String revision, Map indexes, - Map> mappings, Set relations, boolean generated) { + Map> mappings, Set relations, boolean generated, + JsonFieldNamingProfile jsonProfile, Map jsonAliases) { this.entityType = java.util.Objects.requireNonNull(entityType, "entityType"); if (revision == null || revision.isBlank()) throw new IllegalArgumentException("Missing field-layout revision"); this.revision = revision; @@ -85,13 +93,51 @@ private FieldLayout(Class entityType, String revision, Map i throw new IllegalArgumentException("Generated layout must include id and version: " + entityType.getName()); } this.aliases = Map.copyOf(aliases); + Map relationAliases = new HashMap<>(); + for (String relation : this.relations) { + if (aliases.containsKey(relation)) continue; + bindRelationAlias(relationAliases, relation, relation); + String member = io.teaql.core.utils.NamingCase.toCamelCase(relation); + members.put(relation, member); + if (!aliases.containsKey(member)) bindRelationAlias(relationAliases, member, relation); + } this.members = Map.copyOf(members); + this.relationAliases = Map.copyOf(relationAliases); + java.util.Objects.requireNonNull(jsonProfile, "jsonProfile"); + Map wireNames = new HashMap<>(), accepted = new HashMap<>(); + Set jsonFields = new HashSet<>(indexes.keySet()); jsonFields.addAll(this.relations); + for (String field : jsonFields) { + String wire = jsonProfile.render(field); + wireNames.put(field, wire); + bindRelationAlias(accepted, field, field); + bindRelationAlias(accepted, wire, field); + } + java.util.Objects.requireNonNull(jsonAliases, "jsonAliases").forEach((alias, canonical) -> { + if (alias == null || alias.isBlank() || alias.startsWith("_") || alias.startsWith("#") + || !jsonFields.contains(canonical)) throw new IllegalArgumentException("Invalid declared JSON field alias"); + bindRelationAlias(accepted, alias, canonical); + }); + this.jsonNames = Map.copyOf(wireNames); + this.jsonAcceptedNames = Map.copyOf(accepted); empty = LoadState.empty(this); } public static FieldLayout generated(Class entityType, String revision, Map indexes, Map> mappings, Set relations) { - return new FieldLayout(entityType, revision, indexes, mappings, relations, true); + return generated(entityType, revision, indexes, mappings, relations, JsonFieldNamingProfile.CAMEL_CASE); + } + + /** Model-owned JSON vocabulary, independent of native/member/storage load aliases. */ + public static FieldLayout generated(Class entityType, String revision, Map indexes, + Map> mappings, Set relations, + JsonFieldNamingProfile jsonProfile) { + return generated(entityType, revision, indexes, mappings, relations, jsonProfile, Map.of()); + } + + public static FieldLayout generated(Class entityType, String revision, Map indexes, + Map> mappings, Set relations, + JsonFieldNamingProfile jsonProfile, Map declaredJsonAliases) { + return new FieldLayout(entityType, revision, indexes, mappings, relations, true, jsonProfile, declaredJsonAliases); } @FrameworkInternal("Generated metadata and hydration infrastructure only") @@ -114,9 +160,17 @@ public static FieldLayout installGenerated(FieldLayout layout) { public Integer findIndex(String fieldOrAlias) { return aliases.get(fieldOrAlias); } /** Generated language-native accessor key, not a SQL column or reflected bean property. */ public String memberName(String canonicalField) { return members.get(canonicalField); } + /** Selected model wire spelling; never inferred from a database column. */ + public String jsonFieldName(String canonicalField) { return jsonNames.get(canonicalField); } + /** Only canonical/model-selected names and explicitly declared input aliases. */ + public String canonicalJsonField(String name) { return jsonAcceptedNames.get(name); } /** Shared named relation metadata; these members do not consume fixed-field positions. */ @FrameworkInternal("Typed graph hydration and presentation only") public Set relationNames() { return relations; } + /** Shared alias mapping for named relations; null for fixed or unknown fields. */ + @FrameworkInternal("Typed graph hydration and presentation only") + public String canonicalRelationName(String name) { return relationAliases.get(name); } + String selectionName(String fieldOrAlias) { return relationAliases.getOrDefault(fieldOrAlias, fieldOrAlias); } public LoadState emptyState() { return empty; } int indexForLoad(String name) { @@ -142,6 +196,13 @@ public void validateExpectedMembers(Set members) { } } + private static void bindRelationAlias(Map aliases, String alias, String canonical) { + String previous = aliases.putIfAbsent(alias, canonical); + if (previous != null && !previous.equals(canonical)) { + throw new IllegalArgumentException("Ambiguous named relation alias: " + alias); + } + } + private static void addAlias(Map aliases, String alias, int index) { if (alias == null || alias.isBlank()) throw new IllegalArgumentException("Blank field alias"); Integer previous = aliases.putIfAbsent(alias, index); diff --git a/teaql-core/src/main/java/io/teaql/core/LoadState.java b/teaql-core/src/main/java/io/teaql/core/LoadState.java index ba72722c2..b92ac15fc 100644 --- a/teaql-core/src/main/java/io/teaql/core/LoadState.java +++ b/teaql-core/src/main/java/io/teaql/core/LoadState.java @@ -51,6 +51,7 @@ public static LoadState projection(FieldLayout layout, Iterable fields) Set overflow = null; Set names = null; for (String field : fields) { + field = layout.selectionName(field); int index = layout.indexForLoad(field); if (index >= 0 && index < Long.SIZE) bits |= 1L << index; else if (index >= Long.SIZE) { @@ -119,12 +120,13 @@ private String[] dynamicCodes() { public boolean isLoaded(String fieldOrAlias) { if (fieldOrAlias == null) return false; Integer index = layout.findIndex(fieldOrAlias); - if (index == null) return selectedNames.contains(fieldOrAlias); + if (index == null) return selectedNames.contains(layout.selectionName(fieldOrAlias)); return index < Long.SIZE ? (bits & (1L << index)) != 0 : overflow.contains(index); } /** Value-only updates keep this exact reference; availability changes create a private snapshot. */ public LoadState withLoaded(String field, boolean loaded) { + field = layout.selectionName(field); int index = layout.indexForLoad(field); if (isLoaded(field) == loaded) return this; if (index >= 0 && index < Long.SIZE) { diff --git a/teaql-core/src/main/java/io/teaql/core/MutationVersionException.java b/teaql-core/src/main/java/io/teaql/core/MutationVersionException.java new file mode 100644 index 000000000..148ec79b2 --- /dev/null +++ b/teaql-core/src/main/java/io/teaql/core/MutationVersionException.java @@ -0,0 +1,23 @@ +package io.teaql.core; + +/** A persistence lifecycle error, distinct from a concurrent database change. */ +public final class MutationVersionException extends TeaQLRuntimeException { + public enum Code { INVALID_VERSION_STATE, VERSION_EXHAUSTED } + + private final Code code; + private final MutationOperationKind operation; + private final Long originalVersion; + + MutationVersionException(Code code, MutationOperationKind operation, Long originalVersion) { + super("Cannot " + operation.name().toLowerCase(java.util.Locale.ROOT) + ": " + + (code == Code.VERSION_EXHAUSTED ? "optimistic version is exhausted" + : "optimistic version has an invalid lifecycle state")); + this.code = code; + this.operation = operation; + this.originalVersion = originalVersion; + } + + public Code code() { return code; } + public MutationOperationKind operation() { return operation; } + public Long originalVersion() { return originalVersion; } +} diff --git a/teaql-core/src/main/java/io/teaql/core/MutationVersions.java b/teaql-core/src/main/java/io/teaql/core/MutationVersions.java new file mode 100644 index 000000000..466bd20b8 --- /dev/null +++ b/teaql-core/src/main/java/io/teaql/core/MutationVersions.java @@ -0,0 +1,35 @@ +package io.teaql.core; + +import java.util.Objects; + +/** Checked signed-64-bit versions shared by planning, providers and readback. */ +public final class MutationVersions { + private MutationVersions() {} + + public static long next(MutationOperationKind operation, Long originalVersion) { + Objects.requireNonNull(operation, "operation"); + if (operation == MutationOperationKind.CREATE) return 1L; + if (originalVersion == null || (operation == MutationOperationKind.RECOVER + ? originalVersion >= 0 : originalVersion <= 0)) { + throw new MutationVersionException(MutationVersionException.Code.INVALID_VERSION_STATE, operation, originalVersion); + } + long version = originalVersion; + return switch (operation) { + case UPDATE -> { + if (version == Long.MAX_VALUE) throw exhausted(operation, version); + yield version + 1; + } + // Avoid even an intermediate MAX+1 overflow. Deleting MAX is legal. + case DELETE -> -version - 1; + case RECOVER -> { + if (version < Long.MIN_VALUE + 2) throw exhausted(operation, version); + yield -version + 1; + } + case CREATE -> 1L; + }; + } + + private static MutationVersionException exhausted(MutationOperationKind operation, long version) { + return new MutationVersionException(MutationVersionException.Code.VERSION_EXHAUSTED, operation, version); + } +} diff --git a/teaql-core/src/main/java/io/teaql/core/NewEntityLifecycle.java b/teaql-core/src/main/java/io/teaql/core/NewEntityLifecycle.java new file mode 100644 index 000000000..9e4add425 --- /dev/null +++ b/teaql-core/src/main/java/io/teaql/core/NewEntityLifecycle.java @@ -0,0 +1,34 @@ +package io.teaql.core; + +/** Runtime-owned admission for the public, Context-bearing creation boundary. */ +final class NewEntityLifecycle { + private NewEntityLifecycle() {} + + static T initialize(UserContext context, String entityName, T entity) { + if (entityName == null || entityName.trim().isEmpty()) + throw new IllegalArgumentException("entityName must not be empty"); + if (entity == null) throw new IllegalArgumentException("entity must not be null"); + if (!entity.newItem()) + throw new TeaQLRuntimeException("Entity creation must return a new entity, not a persisted entity or reference"); + + Long id = entity.getId(); + if (id == null) { + InternalIdGenerationService generator = context.capability(InternalIdGenerationService.class); + if (generator == null) + throw new TeaQLRuntimeException("InternalIdGenerationService capability is required for entity creation"); + id = generator.generateId(context, entity); + if (id == null || id <= 0) + throw new TeaQLRuntimeException("InternalIdGenerationService must return a positive entity ID"); + // Identity initialization is not a user edit and has no persisted + // baseline. Do not manufacture an ID update or original version. + entity.setProperty(BaseEntity.ID_PROPERTY, id); + } + if (id <= 0 || !id.equals(entity.getId())) + throw new TeaQLRuntimeException("Entity creation requires an assigned positive entity ID"); + if (entity instanceof BaseEntity base) { + base.markPropertyLoaded(BaseEntity.ID_PROPERTY); + base.getEntityMutationLedger().markAsNew(new EntityKey(entity.typeName(), id)); + } + return entity; + } +} diff --git a/teaql-core/src/main/java/io/teaql/core/PropertyChange.java b/teaql-core/src/main/java/io/teaql/core/PropertyChange.java index 2f6007ae1..541019963 100644 --- a/teaql-core/src/main/java/io/teaql/core/PropertyChange.java +++ b/teaql-core/src/main/java/io/teaql/core/PropertyChange.java @@ -4,11 +4,17 @@ public final class PropertyChange { private final String propertyName; private final Object oldValue; private final Object newValue; + private final boolean oldValueLoaded; public PropertyChange(String propertyName, Object oldValue, Object newValue) { + this(propertyName, oldValue, newValue, true); + } + + public PropertyChange(String propertyName, Object oldValue, Object newValue, boolean oldValueLoaded) { this.propertyName = propertyName; this.oldValue = oldValue; this.newValue = newValue; + this.oldValueLoaded = oldValueLoaded; } public String getPropertyName() { @@ -22,4 +28,8 @@ public Object getOldValue() { public Object getNewValue() { return newValue; } + + public boolean wasOldValueLoaded() { + return oldValueLoaded; + } } diff --git a/teaql-core/src/main/java/io/teaql/core/TransactionExecutor.java b/teaql-core/src/main/java/io/teaql/core/TransactionExecutor.java index 6f831c900..cbb5158ad 100644 --- a/teaql-core/src/main/java/io/teaql/core/TransactionExecutor.java +++ b/teaql-core/src/main/java/io/teaql/core/TransactionExecutor.java @@ -3,5 +3,9 @@ public interface TransactionExecutor extends DataServiceExecutor { @FrameworkInternal("Atomic graph participant identity; not a workspace API") default Object transactionResource() { return null; } + /** Returns true only when callbacks belong to the currently active physical transaction. */ + @FrameworkInternal("Runtime commit audit and rollback intent; not a workspace API") + default boolean registerTransactionSynchronization( + UserContext context, Runnable committed, Runnable rolledBack) { return false; } T executeInTransaction(UserContext context, TransactionCallback action); } diff --git a/teaql-core/src/main/java/io/teaql/core/UserContext.java b/teaql-core/src/main/java/io/teaql/core/UserContext.java index b51bb1c28..44c613f91 100644 --- a/teaql-core/src/main/java/io/teaql/core/UserContext.java +++ b/teaql-core/src/main/java/io/teaql/core/UserContext.java @@ -108,6 +108,9 @@ default ContextEntityRef requireActiveRoot(String expectedType) { if (!root.entityType().equals(expectedType)) { throw new ContextRootException(ContextRootException.Reason.TYPE_MISMATCH, expectedType, root); } + if (root.id() <= 0) { + throw new ContextRootException(ContextRootException.Reason.INVALID_ID, expectedType, root); + } return root; } @@ -145,12 +148,12 @@ default I18nCatalog i18nCatalog() { } default CheckResult translateCheckResult(CheckResult result) { - result.setNaturalLanguageStatement(i18nCatalog().render(result, locale())); + io.teaql.core.checker.internal.CheckerDiagnostics.translate(this, List.of(result)); return result; } default List translateCheckResults(List results) { - results.forEach(this::translateCheckResult); + io.teaql.core.checker.internal.CheckerDiagnostics.translateBatch(this, results); return results; } @@ -158,15 +161,11 @@ default List translateCheckResults(List results) { * Applies trusted, context-owned defaults to a newly generated entity. * Business input must not supply tenant, actor, policy, provider, or audit * infrastructure values directly. + * The default path reserves a real ID through this Context's ID service; + * abandoning the object may leave a gap, but does not persist the object. */ default T initializeEntity(String entityName, T entity) { - if (entityName == null || entityName.trim().isEmpty()) { - throw new IllegalArgumentException("entityName must not be empty"); - } - if (entity == null) { - throw new IllegalArgumentException("entity must not be null"); - } - return entity; + return NewEntityLifecycle.initialize(this, entityName, entity); } void pushTrace(String comment); diff --git a/teaql-core/src/main/java/io/teaql/core/checker/CheckResult.java b/teaql-core/src/main/java/io/teaql/core/checker/CheckResult.java index f9a2c7eec..0514d1ab0 100644 --- a/teaql-core/src/main/java/io/teaql/core/checker/CheckResult.java +++ b/teaql-core/src/main/java/io/teaql/core/checker/CheckResult.java @@ -30,6 +30,13 @@ public static CheckResult invalidType(ObjectLocation location, String message) { return checkResult; } + public static CheckResult unknownField(ObjectLocation location) { + CheckResult result = new CheckResult(); + result.setLocation(location); + result.setRuleId(RuleId.UNKNOWN_FIELD); + return result; + } + public static CheckResult min(ObjectLocation location, Number minNumber, Number current) { CheckResult checkResult = new CheckResult(); checkResult.setLocation(location); @@ -175,6 +182,9 @@ public enum RuleId { MIN_DATE, MAX_DATE, REQUIRED, - INVALID_TYPE + INVALID_TYPE, + UNKNOWN_FIELD, + INVALID_VERSION_STATE, + VERSION_EXHAUSTED } } diff --git a/teaql-core/src/main/java/io/teaql/core/checker/Checker.java b/teaql-core/src/main/java/io/teaql/core/checker/Checker.java index e92d23a1c..f976ba7fc 100644 --- a/teaql-core/src/main/java/io/teaql/core/checker/Checker.java +++ b/teaql-core/src/main/java/io/teaql/core/checker/Checker.java @@ -49,6 +49,10 @@ default boolean needCheck(UserContext context, T entity) { return false; } CheckerInvocation invocation = CheckerInvocation.current(context); + if (invocation != null && invocation.mutationOnly() + && entity.isNew() && entity.isMarkedAsDelete()) { + return false; + } if (invocation != null && invocation.mutationOnly() && (entity.get$status() == EntityStatus.PERSISTED || entity.get$status() == EntityStatus.PERSISTED_DELETED)) { @@ -77,11 +81,90 @@ default void requiredCheck(UserContext context, ObjectLocation location, Object default void invalidTypeCheck(UserContext context, ObjectLocation location, String message) { CheckResult result = CheckResult.invalidType(location, message); appendResult(context, result); - result.setNaturalLanguageStatement(message); + } + + /** Model-derived ownership admission, before any Fix or provider activity. */ + default void verifyContextRoot(UserContext context, T entity, String property, + String expectedType, ObjectLocation location) { + var root = context.requireActiveRoot(expectedType); + Object current = entity.getProperty(property); + if (!entity.newItem()) { + var change = entity.__internalPropertyChange(property); + boolean loaded = change == null ? entity.isPropertyLoaded(property) : change.wasOldValueLoaded(); + Object original = change == null ? current : change.getOldValue(); + Long originalId = contextRootId(context, original, expectedType); + if (!loaded || originalId == null) { + invalidTypeCheck(context, location, "Mutation requires a loaded context-bound root"); + return; + } + if (!root.id().equals(originalId)) { + throw new io.teaql.core.ContextRootException( + io.teaql.core.ContextRootException.Reason.VALUE_MISMATCH, expectedType, root); + } + } + if (current != null || !entity.newItem()) { + verifySuppliedContextRoot(context, current, root, expectedType, location); + } + // The raw ledger can carry a canonical relation ID independently of + // the generated getter. Validate it too; never overwrite a conflict. + if (entity.__internalHasMutationLedger() && entity.getId() != null) { + var ledger = entity.getEntityMutationLedger(); + var key = new io.teaql.core.EntityKey(entity.typeName(), entity.getId()); + if (ledger.containsField(key, property)) { + Object supplied = ledger.get(key, property); + if (supplied != null || !entity.newItem()) { + verifySuppliedContextRoot(context, supplied, root, expectedType, location); + } + } + } + } + + private void verifySuppliedContextRoot(UserContext context, Object value, + io.teaql.core.ContextEntityRef root, String expectedType, ObjectLocation location) { + Long id = contextRootId(context, value, expectedType); + if (id == null) { + invalidTypeCheck(context, location, "Mutation requires a loaded context-bound root"); + } else if (!root.id().equals(id)) { + throw new io.teaql.core.ContextRootException( + io.teaql.core.ContextRootException.Reason.VALUE_MISMATCH, expectedType, root); + } + } + + private static Long contextRootId(UserContext context, Object value, String expectedType) { + if (value instanceof io.teaql.core.Entity reference) { + Long id = reference.getId(); + if (id == null || id <= 0) return null; + if (expectedType.equals(reference.typeName())) return id; + // References may carry a model-declared subtype. Resolve only from + // this context; neither a process-global registry nor SQL is valid + // evidence that a different model type belongs to this root family. + var metadata = context.capability(io.teaql.core.meta.EntityMetaFactory.class); + if (metadata == null) return null; + io.teaql.core.meta.EntityDescriptor declared, actual; + try { + declared = metadata.resolveEntityDescriptor(expectedType); + actual = metadata.resolveEntityDescriptor(reference.typeName()); + } catch (io.teaql.core.TeaQLRuntimeException unknownType) { + return null; + } + if (declared == null || actual == null + || declared.getTargetType() == null || actual.getTargetType() == null + || !declared.getTargetType().isInstance(reference) + || !actual.getTargetType().isInstance(reference)) return null; + var visited = java.util.Collections.newSetFromMap( + new java.util.IdentityHashMap()); + for (var descriptor = actual; descriptor != null && visited.add(descriptor); + descriptor = descriptor.getParent()) { + if (descriptor == declared) return id; + } + return null; + } + return value instanceof Long id && id > 0 ? id : null; } default void minNumberCheck( UserContext context, ObjectLocation location, Number minNumber, Number current) { + if (deferNonFiniteNumber(context, location, current)) return; if (NumberUtil.isLess(NumberUtil.toBigDecimal(current), NumberUtil.toBigDecimal(minNumber))) { appendResult(context, CheckResult.min(location, minNumber, current)); } @@ -89,12 +172,22 @@ default void minNumberCheck( default void maxNumberCheck( UserContext context, ObjectLocation location, Number maxNumber, Number current) { + if (deferNonFiniteNumber(context, location, current)) return; if (NumberUtil.isGreater( NumberUtil.toBigDecimal(current), NumberUtil.toBigDecimal(maxNumber))) { appendResult(context, CheckResult.max(location, maxNumber, current)); } } + private boolean deferNonFiniteNumber(UserContext context, ObjectLocation location, Number current) { + if (!io.teaql.core.checker.internal.FiniteScalarAdmission.nonFinite(current)) return false; + // A later customer Fix may repair this value. The invocation owner + // validates the final graph rather than throwing BigDecimal's parse error. + if (CheckerInvocation.current(context) == null) + invalidTypeCheck(context, location, "Expected a finite floating-point number"); + return true; + } + default void minStringCheck( UserContext context, ObjectLocation location, int minLen, CharSequence value) { if (StrUtil.length(value) < minLen) { @@ -124,6 +217,12 @@ default void maxDateTimeCheck( } default void appendResult(UserContext context, CheckResult result) { + // Rule factories do not know the declaring entity. Bind that identity + // before localization/wire rendering, without replacing a more precise + // identity already supplied by a custom or specialized checker. + if (result.getRootType() == null || result.getRootType().isBlank()) { + result.setRootType(type()); + } context.translateCheckResult(result); java.util.List list = (java.util.List) CheckerInvocation.attribute(context, TEAQL_DATA_CHECK_RESULT); if (list == null) { @@ -133,7 +232,33 @@ default void appendResult(UserContext context, CheckResult result) { list.add(result); } + /** + * Standalone entry point. Recursive checks inside an existing graph/check + * share that invocation; a top-level check owns and releases its clock, + * traversal guard and detached evidence receipt just like graph save. + * A standalone owner throws collected violations before releasing them; + * joined callbacks leave that decision to the existing graph/check owner. + * The three-argument method is the implementation/traversal callback. + */ + @SuppressWarnings("unchecked") default void checkAndFix(UserContext context, T entity) { - checkAndFix(context, entity, null); + if (CheckerInvocation.current(context) != null) { + checkAndFix(context, entity, null); + return; + } + try (var invocation = CheckerInvocation.open(context)) { + checkAndFix(context, entity, null); + java.util.List violations = (java.util.List) + invocation.attribute(TEAQL_DATA_CHECK_RESULT); + var numeric = io.teaql.core.checker.internal.FiniteScalarAdmission.collect(entity); + if (!numeric.isEmpty()) { + if (violations == null) violations = new java.util.ArrayList<>(); + violations.addAll(numeric); + } + if (violations != null && !violations.isEmpty()) { + context.translateCheckResults(violations); + throw new CheckException(new java.util.ArrayList<>(violations)); + } + } } } diff --git a/teaql-core/src/main/java/io/teaql/core/checker/WireLocationSegment.java b/teaql-core/src/main/java/io/teaql/core/checker/WireLocationSegment.java index 46d7f2c48..76dd62c52 100644 --- a/teaql-core/src/main/java/io/teaql/core/checker/WireLocationSegment.java +++ b/teaql-core/src/main/java/io/teaql/core/checker/WireLocationSegment.java @@ -1,6 +1,7 @@ package io.teaql.core.checker; /** Canonical KSML property or array-index segment used by wire violations. */ +@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) public record WireLocationSegment(String kind, String name, Integer index) { public static WireLocationSegment property(String name) { return new WireLocationSegment("property", name, null); diff --git a/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerDiagnostics.java b/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerDiagnostics.java new file mode 100644 index 000000000..1c7cd95e0 --- /dev/null +++ b/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerDiagnostics.java @@ -0,0 +1,96 @@ +package io.teaql.core.checker.internal; + +import io.teaql.core.UserContext; +import io.teaql.core.checker.*; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.utils.NamingCase; +import io.teaql.core.utils.SensitiveLogNames; +import io.teaql.core.utils.SensitiveValueProjection; +import java.util.*; + +/** Framework output projection. Never modifies an entity or stores raw input in an error. */ +public final class CheckerDiagnostics { + private CheckerDiagnostics() {} + + public static void translate(UserContext context, List results) { + translate(context,results,false); + } + + /** Keep the existing per-result customer localization hook in the batch API. */ + public static void translateBatch(UserContext context, List results) { + translate(context,results,true); + } + + private static void translate(UserContext context, List results, boolean invokeHook) { + var scope=CheckerInvocation.current(context); + List secrets=scope == null ? new ArrayList<>() : scope.diagnosticSecrets(); + boolean allow=SensitiveValueProjection.plaintextEnabled(); + int[] lengths=new int[results.size()]; + boolean[] automatic=new boolean[results.size()]; + for (int i=0;i previous) + for (Object value : previous) if (value instanceof CheckResult result && !CheckerPresentationCache.isAutomatic(result)) + result.setNaturalLanguageStatement(SensitiveValueProjection.scrub(result.getNaturalLanguageStatement(),secrets)); + if (invokeHook) for (var result : results) { + String before=result.getNaturalLanguageStatement(); + context.translateCheckResult(result); + if (!Objects.equals(before,result.getNaturalLanguageStatement())) { + CheckerPresentationCache.forget(result); + result.setNaturalLanguageStatement(SensitiveValueProjection.scrub(result.getNaturalLanguageStatement(),secrets)); + } + // Customer hooks may replace values too. Apply the output boundary + // once more without recursively invoking the customer hook. + translate(context,List.of(result),false); + } + } + + private static Object project(Object value, boolean credential, boolean masked, List secrets) { + if (value == null || (!credential && !masked)) return value; + Object safe=credential ? SensitiveValueProjection.REDACTED : SensitiveValueProjection.maskBusinessValue(value); + if (!Objects.equals(value,safe)) SensitiveValueProjection.collectStrings(value,secrets); + return safe; + } + private static boolean modelMasked(UserContext context, CheckResult result) { + ObjectLocation location=result.getLocation(); + while (location != null && !(location instanceof HashLocation)) location=location.getParent(); + if (!(location instanceof HashLocation hash)) return false; + String field=hash.getMember(); if (field.startsWith("#")) return true; + if (result.getInputValue() == null || result.getRootType() == null) return false; + EntityMetaFactory factory=context.capability(EntityMetaFactory.class); if (factory == null) return false; + // Do not consult the process-global factory or derive entity identity from a display path. + var descriptor=factory.allEntityDescriptors().stream() + .filter(d -> result.getRootType().equals(d.getType())).findFirst().orElse(null); + for (var current=descriptor;current!=null;current=current.getParent()) + for (String masked : current.getAuditMaskFields()) + if (field.equals(masked) || field.equals(NamingCase.toUnderlineCase(masked))) return true; + return false; + } +} diff --git a/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerInvocation.java b/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerInvocation.java index cf37f3944..61619bea0 100644 --- a/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerInvocation.java +++ b/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerInvocation.java @@ -31,6 +31,13 @@ private record Completed(WeakReference context, List e private final boolean mutationOnly; private final Map attributes = new HashMap<>(); private boolean closed; + private List diagnosticSecrets; + + /** Transient synchronous diagnostics only; never retained on UserContext or returned errors. */ + List diagnosticSecrets() { + if (diagnosticSecrets == null) diagnosticSecrets = new ArrayList<>(); + return diagnosticSecrets; + } private CheckerInvocation(UserContext context, boolean mutationOnly) { this.context = java.util.Objects.requireNonNull(context, "context"); @@ -118,6 +125,7 @@ public void close() { if (parent == null) ACTIVE.remove(); else ACTIVE.set(parent); attributes.clear(); + if (diagnosticSecrets != null) diagnosticSecrets.clear(); closed = true; } } diff --git a/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerPresentationCache.java b/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerPresentationCache.java new file mode 100644 index 000000000..46878d72a --- /dev/null +++ b/teaql-core/src/main/java/io/teaql/core/checker/internal/CheckerPresentationCache.java @@ -0,0 +1,47 @@ +package io.teaql.core.checker.internal; + +import io.teaql.core.checker.CheckResult; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; +import java.util.WeakHashMap; + +/** Safe presentation provenance only: no raw message, input, entity or Context. */ +final class CheckerPresentationCache { + private record Entry(int length, byte[] messageDigest, byte[] inputDigest) {} + private static final Map GENERATED=Collections.synchronizedMap(new WeakHashMap<>()); + private CheckerPresentationCache() {} + + static Integer validationLength(CheckResult result) { + Entry entry=automaticEntry(result); + if (entry == null) return null; + if (Arrays.equals(entry.inputDigest(),inputDigest(result.getInputValue()))) return entry.length(); + // A caller explicitly replaced the input. Do not reuse a stale length. + return result.getInputValue() instanceof CharSequence text ? text.length() : 0; + } + + static boolean isAutomatic(CheckResult result) { return automaticEntry(result) != null; } + + static void remember(CheckResult result,int validationLength) { + GENERATED.put(result,new Entry(validationLength,digest(result.getNaturalLanguageStatement()),inputDigest(result.getInputValue()))); + } + + static void forget(CheckResult result) { GENERATED.remove(result); } + + private static Entry automaticEntry(CheckResult result) { + Entry entry=GENERATED.get(result);String message=result.getNaturalLanguageStatement(); + return entry != null && message != null && MessageDigest.isEqual(entry.messageDigest(),digest(message)) ? entry : null; + } + + private static byte[] inputDigest(Object value) { + return value instanceof CharSequence text ? digest(text.toString()) : null; + } + + private static byte[] digest(String text) { + try { return MessageDigest.getInstance("SHA-256").digest(text.getBytes(StandardCharsets.UTF_8)); } + catch (NoSuchAlgorithmException error) { throw new IllegalStateException("SHA-256 is required for safe Checker presentation",error); } + } +} diff --git a/teaql-core/src/main/java/io/teaql/core/checker/internal/FiniteScalarAdmission.java b/teaql-core/src/main/java/io/teaql/core/checker/internal/FiniteScalarAdmission.java new file mode 100644 index 000000000..5328d20ac --- /dev/null +++ b/teaql-core/src/main/java/io/teaql/core/checker/internal/FiniteScalarAdmission.java @@ -0,0 +1,142 @@ +package io.teaql.core.checker.internal; + +import io.teaql.core.BaseEntity; +import io.teaql.core.Entity; +import io.teaql.core.EntityKey; +import io.teaql.core.EntityMutationLedger; +import io.teaql.core.checker.CheckResult; +import io.teaql.core.checker.ObjectLocation; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.Relation; +import java.util.*; + +/** Framework-owned final-value checks, after customer Fix and before any provider call. */ +public final class FiniteScalarAdmission { + private FiniteScalarAdmission() {} + + public static boolean nonFinite(Object value) { + return value instanceof Double doubleValue && !Double.isFinite(doubleValue) + || value instanceof Float floatValue && !Float.isFinite(floatValue); + } + + /** Standalone Checkers use entity-owned geometry, never a context/provider lookup. */ + public static List collect(Entity root) { + return collect(null, root, false); + } + + public static List collect(EntityMetaFactory metadata, Entity root, boolean modifiedOnly) { + var validation = new Validation(metadata, modifiedOnly); + validation.visit(root, null); + for (var ledger : validation.ledgers) { + for (var entry : ledger.currentChangeSet().changes().entrySet()) { + if (modifiedOnly && ledger.isNew(entry.getKey()) && ledger.isMarkedAsDelete(entry.getKey())) continue; + if (!validation.represented.contains(entry.getKey())) + validation.values(entry.getKey().entity(), entry.getValue(), null); + } + } + return validation.violations == null ? List.of() : validation.violations; + } + + /** Detached plan channels get the same final-value policy, without allocating a graph. */ + public static List collect(String type, Map values) { + var validation = new Validation(null, true); + validation.values(type, values, null); + return validation.violations == null ? List.of() : validation.violations; + } + + private static final class Validation { + final EntityMetaFactory metadata; + final boolean modifiedOnly; + final Set visited = Collections.newSetFromMap(new IdentityHashMap<>()); + final Set ledgers = Collections.newSetFromMap(new IdentityHashMap<>()); + final Set represented = new HashSet<>(); + List violations; + + Validation(EntityMetaFactory metadata, boolean modifiedOnly) { + this.metadata = metadata; this.modifiedOnly = modifiedOnly; + } + void value(String type, String field, Object value, ObjectLocation parent) { + if (!nonFinite(value)) return; + var location = parent == null ? ObjectLocation.hashRoot(field) : parent.member(field); + var result = CheckResult.invalidType(location, "Expected a finite floating-point number"); + result.setRootType(type); + // NaN/Infinity have no portable JSON number representation. + // Leave the optional diagnostic input absent; never stringify it. + if (violations == null) violations = new ArrayList<>(); + violations.add(result); + } + void values(String type, Map values, ObjectLocation location) { + values.forEach((field, value) -> value(type, field, value, location)); + } + void visit(Entity entity, ObjectLocation location) { + if (!(entity instanceof BaseEntity base) || !visited.add(entity)) return; + if (modifiedOnly && base.isNew() && base.isMarkedAsDelete()) return; + var key = new EntityKey(entity.typeName(), entity.getId()); + represented.add(key); + Map pending = Map.of(); + if (base.__internalHasMutationLedger()) { + var ledger = base.getEntityMutationLedger(); ledgers.add(ledger); + var raw = ledger.currentChangeSet().changes().get(key); + if (raw != null) pending = raw; + } + boolean inspect = !modifiedOnly || base.needPersist() || !pending.isEmpty(); + var descriptor = metadata == null ? null : metadata.resolveEntityDescriptor(entity.typeName()); + if (descriptor == null) { + // The generated layout and availability snapshot are already + // attached to the row. Reuse them for standalone checks and + // unindexed adapters; do not introduce a runtime dependency. + var state = base.__internalLoadState(); + var layout = state.layout(); + for (String field : layout.indexes().keySet()) + if (state.isLoaded(field)) available(base, field, pending, inspect, location); + for (String field : layout.relationNames()) + if (!layout.indexes().containsKey(field) && state.isLoaded(field)) + available(base, field, pending, inspect, location); + for (String field : state.selectedNames()) + if (!field.startsWith("_") && !field.startsWith("#") + && !layout.indexes().containsKey(field) && !layout.relationNames().contains(field)) + available(base, field, pending, inspect, location); + if (inspect) values(entity.typeName(), pending, location); + return; + } + // Geometry belongs to metadata. No per-record field-name HashSet + // or merged copy of all values is required for scalar admission. + if (inspect) { + for (var current = descriptor; current != null; current = current.getParent()) { + for (var property : current.getProperties()) { + if (property instanceof Relation) continue; + String field = property.getName(); + if (!pending.containsKey(field)) value(entity.typeName(), field, entity.getProperty(field), location); + } + } + values(entity.typeName(), pending, location); + } + for (var current = descriptor; current != null; current = current.getParent()) { + for (var property : current.getProperties()) { + if (!(property instanceof Relation)) continue; + String field = property.getName(); + related(entity.getProperty(field), field, location); + } + } + } + + void available(BaseEntity entity, String field, Map pending, + boolean inspect, ObjectLocation location) { + Object current = entity.getProperty(field); + related(current, field, location); + if (inspect && !pending.containsKey(field)) value(entity.typeName(), field, current, location); + } + + void related(Object value, String field, ObjectLocation location) { + var childLocation = location == null ? ObjectLocation.hashRoot(field) : location.member(field); + if (value instanceof Entity child) visit(child, childLocation); + else if (value instanceof Iterable children) { + int index = 0; + for (Object child : children) { + if (child instanceof Entity item) visit(item, childLocation.element(index)); + index++; + } + } + } + } +} diff --git a/teaql-core/src/main/java/io/teaql/core/i18n/I18nCatalog.java b/teaql-core/src/main/java/io/teaql/core/i18n/I18nCatalog.java index f5ae9c30d..92b6a9ca9 100644 --- a/teaql-core/src/main/java/io/teaql/core/i18n/I18nCatalog.java +++ b/teaql-core/src/main/java/io/teaql/core/i18n/I18nCatalog.java @@ -47,6 +47,11 @@ public String message(Locale locale, String key) { } public String render(CheckResult result, Locale locale) { + return render(result, locale, result.getInputValue() instanceof CharSequence cs ? cs.length() : 0); + } + + /** Render projected input while retaining the unit used by the actual validation. */ + public String render(CheckResult result, Locale locale, int originalInputLength) { String key = switch (result.getRuleId()) { case REQUIRED -> "checker.required"; case MIN -> "checker.min"; case MAX -> "checker.max"; case MIN_STR_LEN -> "checker.minLength"; case MAX_STR_LEN -> "checker.maxLength"; @@ -57,7 +62,7 @@ public String render(CheckResult result, Locale locale) { .replace("{location}", String.valueOf(result.getLocation())) .replace("{system}", String.valueOf(result.getSystemValue())) .replace("{input}", input) - .replace("{input_len}", result.getInputValue() instanceof CharSequence cs ? String.valueOf(cs.length()) : "0"); + .replace("{input_len}", String.valueOf(originalInputLength)); } private static I18nCatalog loadBuiltin() { diff --git a/teaql-core/src/main/java/io/teaql/core/value/BaseEntityExpression.java b/teaql-core/src/main/java/io/teaql/core/value/BaseEntityExpression.java index cbec4bd6e..f20b2a6c3 100644 --- a/teaql-core/src/main/java/io/teaql/core/value/BaseEntityExpression.java +++ b/teaql-core/src/main/java/io/teaql/core/value/BaseEntityExpression.java @@ -17,6 +17,10 @@ default Expression loaded(String property, Function getter) { return new LoadedPropertyExpression<>(this, property, getter); } + default Expression loaded(String property, String method, Function getter) { + return new LoadedPropertyExpression<>(this, property, method, getter); + } + default Expression save(UserContext userContext) { return apply(entity -> { entity.auditAs("save via expression").save(userContext); diff --git a/teaql-core/src/main/java/io/teaql/core/value/Expression.java b/teaql-core/src/main/java/io/teaql/core/value/Expression.java index c6278110b..a4c02b154 100644 --- a/teaql-core/src/main/java/io/teaql/core/value/Expression.java +++ b/teaql-core/src/main/java/io/teaql/core/value/Expression.java @@ -1,5 +1,7 @@ package io.teaql.core.value; +import io.teaql.core.checker.ObjectLocation; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.NoSuchElementException; import java.util.function.Consumer; import java.util.function.Function; @@ -17,24 +19,37 @@ default Expression apply(Function function) { } default T eval() { - return eval($getRoot()); + return $evaluate("eval()"); } default T resolve() { - return eval(); + return $evaluate("resolve()"); } + /** Resolves only already-loaded values; diagnostic rendering performs no I/O. */ + default T $evaluate(String terminal) { + try { return eval($getRoot()); } + catch (TeaQLNotLoadedException error) { throw error.withAttempt($trace().operation(terminal)); } + } + + default ExpressionTrace $trace() { return ExpressionTrace.root("E.entity()"); } + default String $path() { return ""; } + /** Canonical model location; null denotes the entity root. */ + default ObjectLocation $location() { return null; } + + default JsonFieldNamingProfile $jsonFieldNaming() { return JsonFieldNamingProfile.CAMEL_CASE; } + default T orIfNull(T defaultValue) { - T value = resolve(); + T value = $evaluate("orIfNull()"); if(value == null){ return defaultValue; } return value; } default T orElseThrow() { - T value = resolve(); + T value = $evaluate("orElseThrow()"); if (value == null) { throw new NoSuchElementException("No value present"); } @@ -44,7 +59,7 @@ default T orElseThrow() { default T orElseThrow(Supplier exceptionSupplier) throws Throwable{ - T value = resolve(); + T value = $evaluate("orElseThrow()"); if(value == null){ throw exceptionSupplier.get(); } @@ -53,53 +68,59 @@ default T orElseThrow(Supplier exceptionSupplier) } default boolean isNull() { - return null == resolve(); + return null == $evaluate("isNull()"); } default boolean isNotNull() { - return null != resolve(); + return null != $evaluate("isNotNull()"); } default boolean isEmpty() { - return io.teaql.core.utils.ObjectUtil.isEmpty(resolve()); + return io.teaql.core.utils.ObjectUtil.isEmpty($evaluate("isEmpty()")); } default boolean isNotEmpty() { - return io.teaql.core.utils.ObjectUtil.isNotEmpty(resolve()); + return io.teaql.core.utils.ObjectUtil.isNotEmpty($evaluate("isNotEmpty()")); } default void whenIsNull(Runnable function) { - if (isNull() && function != null) { + T value = $evaluate("whenIsNull()"); + if (value == null && function != null) { function.run(); } } default void whenIsNotNull(Runnable function) { - if (isNotNull() && function != null) { + T value = $evaluate("whenIsNotNull()"); + if (value != null && function != null) { function.run(); } } default void whenIsNotNull(Consumer consumer) { - if (isNotNull() && consumer != null) { - consumer.accept(resolve()); + T value = $evaluate("whenIsNotNull()"); + if (value != null && consumer != null) { + consumer.accept(value); } } default void whenIsEmpty(Runnable function) { - if (isEmpty() && function != null) { + T value = $evaluate("whenIsEmpty()"); + if (io.teaql.core.utils.ObjectUtil.isEmpty(value) && function != null) { function.run(); } } default void whenNotEmpty(Consumer consumer) { - if (isNotEmpty() && consumer != null) { - consumer.accept(resolve()); + T value = $evaluate("whenNotEmpty()"); + if (io.teaql.core.utils.ObjectUtil.isNotEmpty(value) && consumer != null) { + consumer.accept(value); } } default void whenNotEmpty(Runnable function) { - if (isNotEmpty() && function != null) { + T value = $evaluate("whenNotEmpty()"); + if (io.teaql.core.utils.ObjectUtil.isNotEmpty(value) && function != null) { function.run(); } } diff --git a/teaql-core/src/main/java/io/teaql/core/value/ExpressionAdaptor.java b/teaql-core/src/main/java/io/teaql/core/value/ExpressionAdaptor.java index e243f7980..213c255bb 100644 --- a/teaql-core/src/main/java/io/teaql/core/value/ExpressionAdaptor.java +++ b/teaql-core/src/main/java/io/teaql/core/value/ExpressionAdaptor.java @@ -1,5 +1,7 @@ package io.teaql.core.value; +import io.teaql.core.checker.ObjectLocation; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.function.Function; public class ExpressionAdaptor implements Expression { @@ -17,7 +19,9 @@ public ExpressionAdaptor(Expression pExpression) { @Override public U eval(T pT) { - Object eval = expression.eval(pT); + Object eval; + try { eval = expression.eval(pT); } + catch (TeaQLNotLoadedException error) { throw error.withAttempt($trace().operation("eval()")); } if (eval == null) { return null; } @@ -36,4 +40,8 @@ public U eval(T pT) { @Override public String $path() { return expression.$path(); } + + @Override public ObjectLocation $location() { return expression.$location(); } + @Override public JsonFieldNamingProfile $jsonFieldNaming() { return expression.$jsonFieldNaming(); } + @Override public ExpressionTrace $trace() { return expression.$trace(); } } diff --git a/teaql-core/src/main/java/io/teaql/core/value/ExpressionTrace.java b/teaql-core/src/main/java/io/teaql/core/value/ExpressionTrace.java new file mode 100644 index 000000000..01d757b95 --- /dev/null +++ b/teaql-core/src/main/java/io/teaql/core/value/ExpressionTrace.java @@ -0,0 +1,57 @@ +package io.teaql.core.value; + +import io.teaql.core.checker.ObjectLocation; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Value-free native E call trace. Canonical identity never comes from parsing display text. */ +public final class ExpressionTrace { + private record Step(String call, ObjectLocation location, boolean traverses) { } + private final String root; + private final List steps; + private final ObjectLocation location; + + private ExpressionTrace(String root, List steps, ObjectLocation location) { + this.root = Objects.requireNonNull(root); + this.steps = List.copyOf(steps); + this.location = location; + } + + public static ExpressionTrace root(String expression) { + return new ExpressionTrace(expression, List.of(), null); + } + + public ExpressionTrace member(String property, String method) { + return append(method + "()", location == null ? ObjectLocation.hashRoot(property) : location.member(property), true); + } + + public ExpressionTrace element(int index, boolean first) { + return append(first ? "first()" : "get(" + index + ")", + location == null ? ObjectLocation.arrayRoot(index) : location.element(index), true); + } + + public ExpressionTrace operation(String call) { return append(call, location, false); } + + private ExpressionTrace append(String call, ObjectLocation target, boolean traverses) { + List next = new ArrayList<>(steps); + next.add(new Step(call, target, traverses)); + return new ExpressionTrace(root, next, target); + } + + public ObjectLocation location() { return location; } + + public String render(ObjectLocation missing) { + StringBuilder result = new StringBuilder(root); + boolean marked = false; + for (Step step : steps) { + result.append('.').append(step.call()); + if (!marked && missing != null && step.traverses() + && step.location().segments().equals(missing.segments())) { + result.append(""); + marked = true; + } + } + return result.toString(); + } +} diff --git a/teaql-core/src/main/java/io/teaql/core/value/LoadedPropertyExpression.java b/teaql-core/src/main/java/io/teaql/core/value/LoadedPropertyExpression.java index 8e4ac30ce..ba295fc45 100644 --- a/teaql-core/src/main/java/io/teaql/core/value/LoadedPropertyExpression.java +++ b/teaql-core/src/main/java/io/teaql/core/value/LoadedPropertyExpression.java @@ -1,34 +1,53 @@ package io.teaql.core.value; import io.teaql.core.BaseEntity; +import io.teaql.core.checker.ObjectLocation; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.function.Function; final class LoadedPropertyExpression implements Expression { private final Expression parent; private final String property; private final Function getter; + private final String method; LoadedPropertyExpression(Expression parent, String property, Function getter) { - this.parent = parent; this.property = property; this.getter = getter; + this(parent, property, "get" + capitalize(JsonFieldNamingProfile.CAMEL_CASE.render(property)), getter); + } + + LoadedPropertyExpression(Expression parent, String property, String method, Function getter) { + this.parent = parent; this.property = property; this.method = method; this.getter = getter; } @Override public V eval(T root) { - E entity = parent.eval(root); + E entity; + try { entity = parent.eval(root); } + catch (TeaQLNotLoadedException error) { throw error.withAttempt($trace().operation("eval()")); } if (entity == null) return null; if (!entity.isPropertyLoaded(property)) { - throw new TeaQLNotLoadedException(describeRoot(), $path(), property); + throw new TeaQLNotLoadedException(describeRoot(), $location(), property, $jsonFieldNaming()).withAttempt($trace().operation("eval()")); } return getter.apply(entity); } @Override public T $getRoot() { return parent.$getRoot(); } @Override public String $path() { - return parent.$path().isEmpty() ? property : parent.$path() + "." + property; + return $location().modelPath(); + } + @Override public ObjectLocation $location() { + ObjectLocation base = parent.$location(); + return base == null ? ObjectLocation.hashRoot(property) : base.member(property); + } + @Override public JsonFieldNamingProfile $jsonFieldNaming() { return parent.$jsonFieldNaming(); } + @Override public ExpressionTrace $trace() { return parent.$trace().member(property, method); } + private static String capitalize(String value) { + return value.isEmpty() ? value : Character.toUpperCase(value.charAt(0)) + value.substring(1); } private String describeRoot() { Object root = $getRoot(); - if (root instanceof BaseEntity entity) return entity.typeName() + "(id=" + entity.getId() + ")"; - return String.valueOf(root); + // Diagnostic context identifies a type, never an entity identity or payload. + if (root instanceof BaseEntity entity) return entity.typeName(); + return root == null ? "null" : root.getClass().getSimpleName(); } } diff --git a/teaql-core/src/main/java/io/teaql/core/value/SmartListExpression.java b/teaql-core/src/main/java/io/teaql/core/value/SmartListExpression.java index 14f900eff..be57e6fe3 100644 --- a/teaql-core/src/main/java/io/teaql/core/value/SmartListExpression.java +++ b/teaql-core/src/main/java/io/teaql/core/value/SmartListExpression.java @@ -4,6 +4,7 @@ import io.teaql.core.BaseEntity; import io.teaql.core.SmartList; +import io.teaql.core.checker.ObjectLocation; public class SmartListExpression extends ExpressionAdaptor> { @@ -16,20 +17,33 @@ public SmartListExpression(Expression> pExpression) { } public Expression size() { - return apply(list -> list.size()); + return new ExpressionAdaptor, Integer>(this, SmartList::size) { + @Override public ExpressionTrace $trace() { return SmartListExpression.this.$trace().operation("size()"); } + }; } public Expression first() { - return apply(list -> list.isEmpty() ? null : list.getData().get(0)); + return element(0, true); } public Expression get(int index) { - return apply( + return element(index, false); + } + + private Expression element(int index, boolean first) { + return new ExpressionAdaptor, U>(this, list -> { if (index < 0 || index > list.size() - 1) { return null; } return list.get(index); - }); + }) { + @Override public ObjectLocation $location() { + ObjectLocation parent = SmartListExpression.this.$location(); + return parent == null ? ObjectLocation.arrayRoot(index) : parent.element(index); + } + @Override public String $path() { return $location().modelPath(); } + @Override public ExpressionTrace $trace() { return SmartListExpression.this.$trace().element(index, first); } + }; } } diff --git a/teaql-core/src/main/java/io/teaql/core/value/TeaQLNotLoadedException.java b/teaql-core/src/main/java/io/teaql/core/value/TeaQLNotLoadedException.java index 88c479d05..264cdcc59 100644 --- a/teaql-core/src/main/java/io/teaql/core/value/TeaQLNotLoadedException.java +++ b/teaql-core/src/main/java/io/teaql/core/value/TeaQLNotLoadedException.java @@ -1,16 +1,63 @@ package io.teaql.core.value; +import io.teaql.core.checker.ObjectLocation; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.checker.WireLocationSegment; +import java.util.List; +import java.util.Objects; + public class TeaQLNotLoadedException extends IllegalStateException { private final String root; - private final String accessPath; + private final ObjectLocation location; private final String breakPoint; + private final JsonFieldNamingProfile profile; + private final ExpressionTrace trace; + + public TeaQLNotLoadedException(String root, ObjectLocation location, String breakPoint, + JsonFieldNamingProfile profile) { + this(root, location, breakPoint, profile, null); + } - public TeaQLNotLoadedException(String root, String accessPath, String breakPoint) { - super("TeaQLNotLoadedError: root=" + root + " access_path=" + accessPath + private TeaQLNotLoadedException(String root, ObjectLocation location, String breakPoint, + JsonFieldNamingProfile profile, ExpressionTrace trace) { + super("TeaQLNotLoadedError: root=" + root + " access_path=" + Objects.requireNonNull(location).nativePath() + " break_point=" + breakPoint + " — select the missing field or relation"); - this.root = root; this.accessPath = accessPath; this.breakPoint = breakPoint; + this.root = root; + this.location = location; + this.breakPoint = breakPoint; + this.profile = Objects.requireNonNull(profile); + this.trace = trace; + } + + /** Preserve the first failure while outer lazy expressions supply the complete attempt. */ + public TeaQLNotLoadedException withAttempt(ExpressionTrace attempt) { + return new TeaQLNotLoadedException(root, location, breakPoint, profile, Objects.requireNonNull(attempt)); } public String getRoot() { return root; } - public String getAccessPath() { return accessPath; } + /** Language-native display only, never a canonical field identity. */ + public String getAccessPath() { return location.nativePath(); } + public ObjectLocation getLocation() { return location; } + public String getModelPath() { return location.modelPath(); } + public String getInstancePath() { return location.instancePath(profile); } public String getBreakPoint() { return breakPoint; } + public String getOriginalExpression() { return trace == null ? null : trace.render(null); } + public String getExpressionWithBrokenPoint() { return trace == null ? null : trace.render(location); } + @Override public String getMessage() { + return super.getMessage() + (trace == null ? "" : " expression=" + getExpressionWithBrokenPoint()); + } + + /** Explicit JSON-boundary projection: do not serialize the exception/root object. */ + public WireError toWire() { return toWire(profile); } + public WireError toWire(JsonFieldNamingProfile naming) { + ObjectLocation attempted = trace == null || trace.location() == null ? location : trace.location(); + return new WireError("NOT_LOADED", location.segments(), location.instancePath(naming), breakPoint, + attempted.segments(), attempted.instancePath(naming), location.segments().size() - 1, + getOriginalExpression(), getExpressionWithBrokenPoint(), + new PreloadGuidance("preload", location.segments())); + } + public record WireError(String code, List location, String instancePath, + String breakPoint, List attemptedLocation, String attemptedInstancePath, + int breakPointIndex, String originalExpression, String expressionWithBrokenPoint, + PreloadGuidance suggestedFix) { } + public record PreloadGuidance(String action, List location) { } } diff --git a/teaql-core/src/main/java/io/teaql/core/value/ValueExpression.java b/teaql-core/src/main/java/io/teaql/core/value/ValueExpression.java index 3f9255823..3a693ba5b 100644 --- a/teaql-core/src/main/java/io/teaql/core/value/ValueExpression.java +++ b/teaql-core/src/main/java/io/teaql/core/value/ValueExpression.java @@ -1,11 +1,26 @@ package io.teaql.core.value; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + public class ValueExpression implements Expression { private final T value; + private final JsonFieldNamingProfile profile; + private final ExpressionTrace trace; public ValueExpression(T value) { + this(value, JsonFieldNamingProfile.CAMEL_CASE); + } + + public ValueExpression(T value, JsonFieldNamingProfile profile) { + this(value, profile, "E.entity()"); + } + + public ValueExpression(T value, JsonFieldNamingProfile profile, String rootExpression) { this.value = value; + this.profile = Objects.requireNonNull(profile); + this.trace = ExpressionTrace.root(rootExpression); } @Override @@ -17,4 +32,7 @@ public T eval(T pT) { public T $getRoot() { return value; } + + @Override public JsonFieldNamingProfile $jsonFieldNaming() { return profile; } + @Override public ExpressionTrace $trace() { return trace; } } diff --git a/teaql-core/src/main/resources/io/teaql/core/i18n/builtin-messages-v1.json b/teaql-core/src/main/resources/io/teaql/core/i18n/builtin-messages-v1.json index f51e5343f..c1e22776d 100644 --- a/teaql-core/src/main/resources/io/teaql/core/i18n/builtin-messages-v1.json +++ b/teaql-core/src/main/resources/io/teaql/core/i18n/builtin-messages-v1.json @@ -5,6 +5,9 @@ "en": { "messages": { "checker.required": "The {location} is required", + "checker.unknown_field": "Unknown model field at {location}; expected a canonical field name", + "checker.invalid_version_state": "The optimistic version at {location} has an invalid lifecycle state", + "checker.version_exhausted": "The optimistic version at {location} is exhausted", "checker.min": "The {location} should be equal or greater than {system}, but input is {input}", "checker.max": "The {location} should be equal or less than {system}, but input is {input}", "checker.minLength": "The length of {location} should be equal or greater than {system}, but the length of {input} is {input_len}", @@ -15,6 +18,9 @@ "zh-CN": { "messages": { "checker.required": "{location} 是必填项", + "checker.unknown_field": "{location} 不是已声明的模型字段,请使用规范字段名", + "checker.invalid_version_state": "{location} 的乐观锁版本不符合当前生命周期状态", + "checker.version_exhausted": "{location} 的乐观锁版本空间已耗尽", "checker.min": "{location} 应该大于等于 {system},但输入值为 {input}", "checker.max": "{location} 应该小于等于 {system},但输入值为 {input}", "checker.minLength": "{location} 的长度应大于等于 {system},但实际长度为 {input_len}", @@ -25,6 +31,7 @@ "zh-TW": { "messages": { "checker.required": "{location} 是必填的", + "checker.unknown_field": "{location} 不是已宣告的模型欄位,請使用規範欄位名", "checker.min": "{location} 應該等於或大於 {system},但輸入為 {input}", "checker.max": "{location} 應該等於或小於 {system},但輸入為 {input}", "checker.minLength": "{location} 的長度應該等於或大於 {system},但 {input} 的長度是 {input_len}", diff --git a/teaql-core/src/test/java/io/teaql/core/BaseRequestTest.java b/teaql-core/src/test/java/io/teaql/core/BaseRequestTest.java index 429a79d3c..7a6ba35ed 100644 --- a/teaql-core/src/test/java/io/teaql/core/BaseRequestTest.java +++ b/teaql-core/src/test/java/io/teaql/core/BaseRequestTest.java @@ -314,6 +314,8 @@ public void testExecutableRequestCreatesEntityThroughTrustedContext() { new Class[] { UserContext.class }, (proxy, method, args) -> { if (method.getName().equals("initializeEntity")) return args[1]; + if (method.getName().equals("capability") && args[0] == InternalIdGenerationService.class) + return (InternalIdGenerationService) (caller, entity) -> 501L; throw new UnsupportedOperationException(method.getName()); }); BaseEntity entity = (BaseEntity) new BaseRequest.TempRequest( @@ -323,6 +325,8 @@ public void testExecutableRequestCreatesEntityThroughTrustedContext() { .newEntity(context); assertNotNull(entity); assertEquals(EntityStatus.NEW, entity.get$status()); + assertEquals(Long.valueOf(501), entity.getId()); + assertTrue(entity.isPropertyLoaded("id")); } @Test diff --git a/teaql-core/src/test/java/io/teaql/core/ContextRootIdentityTest.java b/teaql-core/src/test/java/io/teaql/core/ContextRootIdentityTest.java new file mode 100644 index 000000000..689530655 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/ContextRootIdentityTest.java @@ -0,0 +1,61 @@ +package io.teaql.core; + +import java.util.HashMap; +import java.util.Map; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Typed context-root admission; no provider, metadata lookup or ID allocation. */ +public class ContextRootIdentityTest { + private UserContext context() { + Map values = new HashMap<>(); + return new UserContextTest.DummyUserContext() { + @Override public void putAttribute(String key, Object value) { values.put(key, value); } + @Override public Object getAttribute(String key) { return values.get(key); } + @Override public T getAttribute(String key, Class type) { return type.cast(values.get(key)); } + }; + } + + private void invalid(long id, boolean directAttribute) { + UserContext context = context(); + var root = new ContextEntityRef("Tenant", id); + if (directAttribute) context.putAttribute(UserContext.TEAQL_ACTIVE_ROOT, root); + else context.withActiveRoot(root); + var error = assertThrows(ContextRootException.class, () -> context.requireActiveRoot("Tenant")); + assertEquals("INVALID_ID", error.getReason().name()); + assertEquals("Tenant", error.getExpectedType()); + assertEquals(root, error.getActiveRoot()); + System.out.println("JAVA_CONTEXT_ROOT_IDENTITY={\"id\":\"" + id + + "\",\"directAttribute\":" + directAttribute + ",\"reason\":\"INVALID_ID\",\"passed\":true}"); + } + + @Test public void zeroViaFluentApiIsNotAPersistentRoot() { invalid(0, false); } + @Test public void zeroViaContextAttributeCannotBypassAdmission() { invalid(0, true); } + @Test public void negativeRootIsNotAPersistentIdentity() { invalid(-1, false); } + @Test public void minimumSignedRootIsRejectedWithoutAbsoluteValueOverflow() { invalid(Long.MIN_VALUE, true); } + + @Test public void fullPositiveLongDomainIsPreservedExactly() { + for (long id : new long[] {1L, 42L, Long.MAX_VALUE}) { + UserContext context = context(); + context.withActiveRoot(new ContextEntityRef("Tenant", id)); + assertEquals(Long.valueOf(id), context.requireActiveRoot("Tenant").id()); + context.verifyActiveRoot("Tenant", id); + } + } + + @Test public void missingAndWrongTypeRemainDistinct() { + UserContext context = context(); + assertEquals(ContextRootException.Reason.MISSING, + assertThrows(ContextRootException.class, () -> context.requireActiveRoot("Tenant")).getReason()); + context.withActiveRoot(new ContextEntityRef("Organization", 0L)); + assertEquals(ContextRootException.Reason.TYPE_MISMATCH, + assertThrows(ContextRootException.class, () -> context.requireActiveRoot("Tenant")).getReason()); + } + + @Test public void suppliedRootVerificationCannotAcceptZeroContext() { + UserContext context = context(); + context.withActiveRoot(new ContextEntityRef("Tenant", 0L)); + assertEquals("INVALID_ID", assertThrows(ContextRootException.class, + () -> context.verifyActiveRoot("Tenant", 0L)).getReason().name()); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/ContextRootOwnershipTest.java b/teaql-core/src/test/java/io/teaql/core/ContextRootOwnershipTest.java new file mode 100644 index 000000000..cd6d75aae --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/ContextRootOwnershipTest.java @@ -0,0 +1,149 @@ +package io.teaql.core; + +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.CheckResult; +import io.teaql.core.checker.ObjectLocation; +import java.util.*; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Pure canonical-root admission using real loaded state and mutation ledger semantics. */ +public class ContextRootOwnershipTest { + static final class Row extends BaseEntity { + Entity root; + @Override public String typeName() { return "PurchaseOrder"; } + @Override public Object __internalGet(String field) { return field.equals("domain_root") ? root : super.__internalGet(field); } + @Override public void __internalSet(String field,Object value) { + if(field.equals("domain_root")) { root=(Entity)value; markPropertyLoaded(field); } + else super.__internalSet(field,value); + } + } + static class Ref extends BaseEntity { + @Override public String typeName() { return "Tenant"; } + Ref(long id) { setProperty("id",id); set$status(EntityStatus.REFER); } + } + static final class SpecializedRef extends Ref { + SpecializedRef(long id) { super(id); } + @Override public String typeName() { return "SpecializedTenant"; } + } + static class UnrelatedRef extends BaseEntity { + UnrelatedRef(long id) { setProperty("id",id); set$status(EntityStatus.REFER); } + @Override public String typeName() { return "OtherTenant"; } + } + static final Checker CHECKER = new Checker<>() { + public String type() { return "PurchaseOrder"; } + public void checkAndFix(UserContext context,Row row,ObjectLocation location) {} + }; + static UserContext context(long root) { + Map values=new HashMap<>(); + UserContext context=new UserContextTest.DummyUserContext() { + public void putAttribute(String key,Object value) { values.put(key,value); } + public Object getAttribute(String key) { return values.get(key); } + public T getAttribute(String key,Class type) { return type.cast(values.get(key)); } + }; + return context.withActiveRoot(new ContextEntityRef("Tenant",root)); + } + static Row loaded() { + var row=new Row();row.setProperty("id",41L);row.setProperty("version",1L); + row.setProperty("domain_root",new Ref(1));row.set$status(EntityStatus.PERSISTED);return row; + } + static void verify(UserContext context,Row row) { + CHECKER.verifyContextRoot(context,row,"domain_root","Tenant",ObjectLocation.hashRoot("domain_root")); + } + @Test public void changingContextAndPayloadCannotReplaceTheOriginalOwner() { + var row=loaded();row.updateProperty("domain_root",new Ref(2)); + assertEquals(ContextRootException.Reason.VALUE_MISMATCH, + assertThrows(ContextRootException.class,()->verify(context(2),row)).getReason()); + assertEquals(Long.valueOf(1),((Entity)row.__internalPropertyChange("domain_root").getOldValue()).getId()); + } + @Test public void repeatedChangesKeepTheFirstLoadedOwner() { + var row=loaded();row.updateProperty("domain_root",new Ref(2));row.updateProperty("domain_root",new Ref(3)); + assertThrows(ContextRootException.class,()->verify(context(3),row)); + assertEquals(Long.valueOf(1),((Entity)row.getOldValue("domain_root")).getId()); + } + @Test public void rawLedgerCannotMoveAnUnchangedGetter() { + var row=loaded();row.getEntityMutationLedger().set(new EntityKey(row.typeName(),row.getId()),"domain_root",2L); + assertThrows(ContextRootException.class,()->verify(context(1),row));assertEquals(Long.valueOf(1),row.root.getId()); + } + @Test public void equalRawLedgerRootIsAllowedWithoutRewritingIntent() { + var row=loaded();var key=new EntityKey(row.typeName(),row.getId());var ledger=row.getEntityMutationLedger();ledger.set(key,"domain_root",1L); + verify(context(1),row);assertTrue(ledger.containsField(key,"domain_root"));assertEquals(1L,ledger.get(key,"domain_root")); + } + @Test public void explicitRawNullIsNotConfusedWithNoChange() { + var row=loaded();var key=new EntityKey(row.typeName(),row.getId());var ledger=row.getEntityMutationLedger();ledger.set(key,"domain_root",null); + var context=context(1);verify(context,row);assertTrue(ledger.containsField(key,"domain_root"));assertInvalid(context); + } + @Test public void aPreviouslyUnloadedRootCannotBeMadeAuthoritativeByAnUpdate() { + var row=new Row();row.setProperty("id",41L);row.setProperty("version",1L);row.set$status(EntityStatus.PERSISTED); + row.updateProperty("domain_root",new Ref(1));var context=context(1);verify(context,row);assertInvalid(context); + } + @Test public void readingOriginalOwnershipAllocatesNoLedgerAndChangesNoLoadState() { + var row=loaded();var state=row.__internalLoadState();assertFalse(row.__internalHasMutationLedger());verify(context(1),row); + assertFalse(row.__internalHasMutationLedger());assertSame(state,row.__internalLoadState());assertNull(row.__internalPropertyChange("domain_root")); + } + @Test public void deleteAndRecoveryKeepTheLoadedOwner() { + for(boolean recovery:List.of(false,true)) { + var row=loaded();if(recovery) {row.set$status(EntityStatus.PERSISTED_DELETED);row.markAsRecover();}else row.markForDeletion(); + assertTrue(row.needPersist());assertThrows(ContextRootException.class,()->verify(context(2),row)); + } + } + @Test public void containsFieldReadsAllChangeFramesWithoutAllocatingOne() { + var ledger=new EntityMutationLedger();var key=new EntityKey("PurchaseOrder",41L); + assertFalse(ledger.containsField(key,"domain_root"));ledger.set(key,"domain_root",null);ledger.pushChangeSet(); + assertTrue(ledger.containsField(key,"domain_root"));assertNull(ledger.get(key,"domain_root"));ledger.set(key,"domain_root",1L); + assertEquals(1L,ledger.get(key,"domain_root"));ledger.popChangeSet();assertTrue(ledger.containsField(key,"domain_root"));assertNull(ledger.get(key,"domain_root")); + } + static UserContext modelContext(boolean related) { + var metadata=new io.teaql.core.meta.SimpleEntityMetaFactory(); + var root=new io.teaql.core.meta.EntityDescriptor();root.setType("Tenant");root.setTargetType(Ref.class);metadata.register(root); + var specialized=new io.teaql.core.meta.EntityDescriptor();specialized.setType("SpecializedTenant");specialized.setTargetType(SpecializedRef.class); + if(related) specialized.setParent(root);metadata.register(specialized); + var other=new io.teaql.core.meta.EntityDescriptor();other.setType("OtherTenant");other.setTargetType(UnrelatedRef.class);metadata.register(other); + Map values=new HashMap<>(); + var context=new UserContextTest.DummyUserContext() { + @Override public T capability(Class type) { return type==io.teaql.core.meta.EntityMetaFactory.class?type.cast(metadata):null; } + @Override public void putAttribute(String key,Object value) { values.put(key,value); } + @Override public Object getAttribute(String key) { return values.get(key); } + @Override public T getAttribute(String key,Class type) { return type.cast(values.get(key)); } + }; + return context.withActiveRoot(new ContextEntityRef("Tenant",1L)); + } + @Test public void aModelDeclaredRootSubtypeIsAcceptedWithoutCreatingMutationState() { + var row=loaded();row.setProperty("domain_root",new SpecializedRef(1)); + var state=row.__internalLoadState();var context=modelContext(true);verify(context,row); + assertNull(context.getAttribute(Checker.TEAQL_DATA_CHECK_RESULT)); + assertFalse(row.__internalHasMutationLedger());assertSame(state,row.__internalLoadState()); + } + @Test public void rootSubtypeProvenanceDoesNotPermitTransferToAnotherRoot() { + var row=loaded();row.setProperty("domain_root",new SpecializedRef(1));row.updateProperty("domain_root",new SpecializedRef(2)); + var context=modelContext(true);context.withActiveRoot(new ContextEntityRef("Tenant",2L)); + assertThrows(ContextRootException.class,()->verify(context,row)); + } + @Test public void subtypeAcceptanceUsesOnlyThisContextsDeclaredModel() { + var row=loaded();row.setProperty("domain_root",new SpecializedRef(1)); + var unrelated=modelContext(false);verify(unrelated,row);assertInvalid(unrelated); + var related=modelContext(true);verify(related,row);assertNull(related.getAttribute(Checker.TEAQL_DATA_CHECK_RESULT)); + var absent=context(1);verify(absent,row);assertInvalid(absent); + } + @Test public void sameIdOnAnUnrelatedRootTypeIsStillRejected() { + var row=loaded();row.setProperty("domain_root",new UnrelatedRef(1)); + var context=modelContext(true);verify(context,row);assertInvalid(context); + } + @Test public void aSubtypeNameNotRegisteredInThisContextFailsAsAFieldViolation() { + var row=loaded();row.setProperty("domain_root",new Ref(1) { + @Override public String typeName() { return "UnregisteredTenant"; } + }); + var context=modelContext(true);verify(context,row);assertInvalid(context); + } + @Test public void declaredInheritanceCannotSubstituteAnIncompatibleJavaReference() { + var row=loaded();row.setProperty("domain_root",new UnrelatedRef(1) { + @Override public String typeName() { return "SpecializedTenant"; } + }); + var context=modelContext(true);verify(context,row);assertInvalid(context); + } + @SuppressWarnings("unchecked") static void assertInvalid(UserContext context) { + var results=(List)context.getAttribute(Checker.TEAQL_DATA_CHECK_RESULT);assertNotNull(results);assertEquals(1,results.size()); + var result=results.get(0);assertEquals("PurchaseOrder",result.getRootType());assertEquals("domain_root",result.getLocation().modelPath()); + assertEquals("invalid_type",result.toWire(io.teaql.core.checker.JsonFieldNamingProfile.CAMEL_CASE).ruleId()); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/EntityCreationLifecycleTest.java b/teaql-core/src/test/java/io/teaql/core/EntityCreationLifecycleTest.java new file mode 100644 index 000000000..49e6bd2bd --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/EntityCreationLifecycleTest.java @@ -0,0 +1,177 @@ +package io.teaql.core; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.UnaryOperator; +import org.junit.Test; +import static org.junit.Assert.*; + +/** The public creation boundary, not a save-time allocation test. */ +public class EntityCreationLifecycleTest { + private static final class Fixture { + final AtomicLong sequence = new AtomicLong(100); + final AtomicInteger allocations = new AtomicInteger(); + InternalIdGenerationService generator = (context, entity) -> { + allocations.incrementAndGet(); + return sequence.incrementAndGet(); + }; + UnaryOperator initializer; + final UserContext context = (UserContext) Proxy.newProxyInstance( + UserContext.class.getClassLoader(), new Class[] {UserContext.class}, + (proxy, method, args) -> { + if (method.getName().equals("capability")) { + assertSame(InternalIdGenerationService.class, args[0]); + return generator; + } + if (method.getName().equals("initializeEntity") && initializer != null) + return initializer.apply((BaseEntity) args[1]); + if (method.isDefault()) return InvocationHandler.invokeDefault(proxy, method, args); + throw new AssertionError("Creation must not call a provider, save, clock or query: " + method.getName()); + }); + } + + private static BaseEntity create(Fixture f) { + return (BaseEntity) new BaseRequest.TempRequest( + BaseEntity.class, "BaseEntity", BaseEntity::new) + .internalComment("Create a native lifecycle control") + .purpose("Verify identity before the creation call returns") + .newEntity(f.context); + } + + private static void assignedNew(BaseEntity entity, long id) { + assertEquals(Long.valueOf(id), entity.getId()); + assertTrue(entity.isPropertyLoaded("id")); + assertTrue(entity.newItem()); + assertNull(entity.getVersion()); + assertTrue(entity.getEntityMutationLedger().isNew(new EntityKey(entity.typeName(), id))); + } + + @Test public void publicFactoryReturnsAnAssignedNewEntity() { + var f = new Fixture(); var entity = create(f); + assignedNew(entity, 101); assertEquals(1, f.allocations.get()); + assertTrue(entity.getUpdatedProperties().isEmpty()); + assertNull(entity.getOriginalVersion()); + } + + @Test public void directContextInitializationAlsoAssignsAnIdentity() { + var f = new Fixture(); var entity = new BaseEntity(); + assertSame(entity, f.context.initializeEntity("BaseEntity", entity)); + assignedNew(entity, 101); assertEquals(1, f.allocations.get()); + } + + @Test public void repeatingInitializationDoesNotReallocateOrReplaceTheLedger() { + var f = new Fixture(); var entity = create(f); var ledger = entity.getEntityMutationLedger(); + assertSame(entity, f.context.initializeEntity("BaseEntity", entity)); + assignedNew(entity, 101); assertSame(ledger, entity.getEntityMutationLedger()); + assertEquals(1, f.allocations.get()); + } + + @Test public void independentCreationsInOneContextHaveIndependentLedgers() { + var f = new Fixture(); var first = create(f); var abandoned = create(f); var last = create(f); + assignedNew(first, 101); assignedNew(abandoned, 102); assignedNew(last, 103); + assertNotSame(first.getEntityMutationLedger(), last.getEntityMutationLedger()); + assertNotSame(first.getEntityMutationLedger(), abandoned.getEntityMutationLedger()); + assertEquals(Set.of(new EntityKey("BaseEntity", 101L)), first.getEntityMutationLedger().newKeys()); + assertEquals(Set.of(new EntityKey("BaseEntity", 103L)), last.getEntityMutationLedger().newKeys()); + assertEquals(3, f.allocations.get()); + } + + @Test public void trustedContextDefaultsRunBeforeFallbackAllocation() { + var f = new Fixture(); f.initializer = entity -> { entity.setComment("Trusted default is ready"); return entity; }; + f.generator = (context, entity) -> { + f.allocations.incrementAndGet(); assertSame(f.context, context); + assertEquals("Trusted default is ready", entity.getComment()); return 501L; + }; + assignedNew(create(f), 501); assertEquals(1, f.allocations.get()); + } + + @Test public void customInitializerCannotAccidentallyReturnAnUnassignedEntity() { + var f = new Fixture(); f.initializer = entity -> entity; + assignedNew(create(f), 101); assertEquals(1, f.allocations.get()); + } + + @Test public void trustedPreassignedIdentityIsPreservedWithoutAllocation() { + var f = new Fixture(); f.initializer = entity -> { entity.setProperty("id", 777L); return entity; }; + assignedNew(create(f), 777); assertEquals(0, f.allocations.get()); + } + + @Test public void preassignedDefaultContextIdentityIsMarkedAsNew() { + var f = new Fixture(); var entity = new BaseEntity(); entity.setProperty("id", 888L); + assertSame(entity, f.context.initializeEntity("BaseEntity", entity)); + assignedNew(entity, 888); assertEquals(0, f.allocations.get()); + } + + @Test public void missingGeneratorFailsAtCreationRatherThanReturningATemporaryIdentity() { + var f = new Fixture(); f.generator = null; + var error = assertThrows(TeaQLRuntimeException.class, () -> create(f)); + assertTrue(error.getMessage().contains("InternalIdGenerationService")); + assertEquals(0, f.allocations.get()); + } + + private static void invalidAllocatedId(Long id) { + var f = new Fixture(); var original = new AtomicReference(); + f.initializer = entity -> { original.set(entity); return entity; }; + f.generator = (context, entity) -> { f.allocations.incrementAndGet(); return id; }; + assertThrows(TeaQLRuntimeException.class, () -> create(f)); + assertNull(original.get().getId()); assertFalse(original.get().isPropertyLoaded("id")); + assertFalse(original.get().__internalHasMutationLedger()); assertEquals(1, f.allocations.get()); + } + + @Test public void nullAllocatedIdIsRejected() { invalidAllocatedId(null); } + @Test public void zeroAllocatedIdIsRejected() { invalidAllocatedId(0L); } + @Test public void negativeAllocatedIdIsRejected() { invalidAllocatedId(-1L); } + + @Test public void allocationFailurePropagatesAndAnotherCreationCanStillSucceed() { + var f = new Fixture(); var failure = new IllegalStateException("Controlled ID service failure"); + f.generator = (context, entity) -> { throw failure; }; + assertSame(failure, assertThrows(IllegalStateException.class, () -> create(f))); + f.generator = (context, entity) -> 909L; + assignedNew(create(f), 909); + } + + @Test public void initializerCannotReturnNull() { + var f = new Fixture(); f.initializer = entity -> null; + assertThrows(IllegalArgumentException.class, () -> create(f)); assertEquals(0, f.allocations.get()); + } + + @Test public void initializerCannotReturnAPersistedObjectAsNew() { + var f = new Fixture(); f.initializer = entity -> { entity.set$status(EntityStatus.PERSISTED); return entity; }; + assertThrows(TeaQLRuntimeException.class, () -> create(f)); assertEquals(0, f.allocations.get()); + } + + @Test public void initializerCannotSupplyANonpositiveIdentity() { + var f = new Fixture(); f.initializer = entity -> { entity.setProperty("id", -3L); return entity; }; + assertThrows(TeaQLRuntimeException.class, () -> create(f)); assertEquals(0, f.allocations.get()); + } + + @Test public void invalidArgumentsRejectBeforeAllocation() { + var f = new Fixture(); + assertThrows(IllegalArgumentException.class, () -> f.context.initializeEntity(" ", new BaseEntity())); + assertThrows(IllegalArgumentException.class, () -> f.context.initializeEntity("BaseEntity", null)); + assertEquals(0, f.allocations.get()); + } + + @Test public void concurrentFactoriesReturnUniqueIdentitiesAndPrivateLedgers() throws Exception { + var f = new Fixture(); var executor = Executors.newFixedThreadPool(4); + try { + var jobs = new ArrayList>(); for (int i = 0; i < 24; i++) jobs.add(() -> create(f)); + var ids = new HashSet(); var ledgers = java.util.Collections.newSetFromMap( + new java.util.IdentityHashMap()); + for (var result : executor.invokeAll(jobs)) { + var entity = result.get(); assertNotNull(entity.getId()); assertTrue(entity.getId() > 0); + assertTrue(ids.add(entity.getId())); assertTrue(ledgers.add(entity.getEntityMutationLedger())); + assertEquals(Set.of(new EntityKey("BaseEntity", entity.getId())), entity.getEntityMutationLedger().newKeys()); + } + assertEquals(24, f.allocations.get()); + } finally { executor.shutdownNow(); assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS)); } + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/ExplicitNullMutationTest.java b/teaql-core/src/test/java/io/teaql/core/ExplicitNullMutationTest.java new file mode 100644 index 000000000..2ae36b6cb --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/ExplicitNullMutationTest.java @@ -0,0 +1,56 @@ +package io.teaql.core; + +import java.util.List; +import java.util.Set; +import org.junit.Test; +import static io.teaql.core.RejectedMutationStateTest.*; +import static org.junit.Assert.*; + +public class ExplicitNullMutationTest { + @Test public void missingNullViaHookIsAnExplicitMutation(){ + var row=row(EntityStatus.PERSISTED,Availability.NOT_LOADED);row.handleUpdate("name",null,null); + assertTrue(row.isPropertyLoaded("name"));assertEquals(EntityStatus.UPDATED,row.get$status()); + assertEquals(List.of("name"),row.getUpdatedProperties()); + var key=new EntityKey(row.typeName(),row.getId()); + assertTrue(row.getEntityMutationLedger().currentChangeSet().changes().get(key).containsKey("name")); + assertNull(row.getEntityMutationLedger().get(key,"name"));assertEquals(Long.valueOf(7),row.getOriginalVersion()); + } + @Test public void genericMissingNullRetainsIntent(){ + var row=row(EntityStatus.PERSISTED,Availability.NOT_LOADED);row.updateProperty("name",null); + assertTrue(row.isPropertyLoaded("name"));assertEquals(List.of("name"),row.getUpdatedProperties()); + assertEquals(EntityStatus.UPDATED,row.get$status()); + } + @Test public void nullIntentWithUnknownBaselineSurvivesLaterChanges(){ + var row=row(EntityStatus.PERSISTED,Availability.NOT_LOADED); + row.updateProperty("name",null);row.updateProperty("name","later");row.updateProperty("name",null);row.updateProperty("name",null); + assertEquals(List.of("name"),row.getUpdatedProperties());assertTrue(row.isPropertyLoaded("name"));assertNull(row.name); + var key=new EntityKey(row.typeName(),row.getId());assertTrue(row.getEntityMutationLedger().changedFieldNames(key).contains("name")); + assertNull(row.getEntityMutationLedger().currentChangeSet().get(key,"name")); + } + @Test public void loadedNullGenericMutationIsANoop(){ + var row=row(EntityStatus.PERSISTED,Availability.NULL);var snapshot=new Snapshot(row);row.updateProperty("name",null);snapshot.unchanged(row); + } + @Test public void loadedEqualGenericMutationIsANoop(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var snapshot=new Snapshot(row);row.updateProperty("name","kept");snapshot.unchanged(row); + } + @Test public void loadedEqualHookIsANoop(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var snapshot=new Snapshot(row);row.handleUpdate("name","kept","kept");snapshot.unchanged(row); + } + @Test public void equalLoadedValueCannotEraseAnotherPendingIntent(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.updateProperty("count",3);var snapshot=new Snapshot(row);row.updateProperty("name","kept");snapshot.unchanged(row); + assertEquals(Set.of("count"),Set.copyOf(row.getUpdatedProperties())); + } + @Test public void referenceNullVersionIsRejectedWithoutSelectingIt(){ + var row=row(EntityStatus.REFER,Availability.NOT_LOADED);var snapshot=new Snapshot(row); + assertThrows(TeaQLRuntimeException.class,()->row.updateVersion(null));snapshot.unchanged(row); + } + @Test public void referenceGenericNullStillRejectsWithoutAnyChange(){ + var row=row(EntityStatus.REFER,Availability.NOT_LOADED);var snapshot=new Snapshot(row); + assertThrows(TeaQLRuntimeException.class,()->row.updateProperty("name",null));snapshot.unchanged(row); + } + @Test public void knownValueToNullIsStillAnEdit(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.updateProperty("name",null); + assertEquals(EntityStatus.UPDATED,row.get$status());assertTrue(row.isPropertyLoaded("name"));assertNull(row.name); + assertEquals(List.of("name"),row.getUpdatedProperties());assertEquals("kept",row.getOldValue("name")); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/LoadedRevertMutationTest.java b/teaql-core/src/test/java/io/teaql/core/LoadedRevertMutationTest.java new file mode 100644 index 000000000..473df9f97 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/LoadedRevertMutationTest.java @@ -0,0 +1,72 @@ +package io.teaql.core; + +import java.util.Set; +import org.junit.Test; +import io.teaql.data.dynamic.DynamicDataType; +import io.teaql.data.dynamic.DynamicFieldMutation; +import static io.teaql.core.RejectedMutationStateTest.*; +import static org.junit.Assert.*; + +/** Returning to a known persisted baseline must not retain an intermediate write. */ +public class LoadedRevertMutationTest { + static EntityKey key(Row row){return new EntityKey(row.typeName(),row.getId());} + static void assertNoNameIntent(Row row){ + assertFalse(row.getUpdatedProperties().contains("name")); + assertFalse(row.getEntityMutationLedger().changedFieldNames(key(row)).contains("name")); + assertNull(row.getEntityMutationLedger().get(key(row),"name")); + } + @Test public void typedKnownValueRevertRemovesTheIntermediateLedgerValue(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.updateName("intermediate");row.updateName("kept"); + assertEquals("kept",row.name);assertNoNameIntent(row);assertTrue(row.getEntityMutationLedger().currentChangeSet().isEmpty()); + } + @Test public void genericKnownNullRevertRemovesTheIntermediateLedgerValue(){ + var row=row(EntityStatus.PERSISTED,Availability.NULL);row.updateProperty("name","intermediate");row.updateProperty("name",null); + assertNull(row.name);assertNoNameIntent(row); + } + @Test public void restoringTheOnlyFieldRestoresTheCleanLifecycle(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.updateName("intermediate");row.updateName("kept"); + assertEquals(EntityStatus.PERSISTED,row.get$status());assertFalse(row.needPersist()); + } + @Test public void restoringOneFieldRetainsAnotherFieldsIntent(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.updateProperty("count",3);row.updateName("intermediate");row.updateName("kept"); + assertNoNameIntent(row);assertEquals(Set.of("count"),Set.copyOf(row.getUpdatedProperties())); + assertEquals(Integer.valueOf(3),row.getEntityMutationLedger().get(key(row),"count"));assertEquals(EntityStatus.UPDATED,row.get$status()); + } + @Test public void restoringOneEntityCannotEraseAnotherTypeWithTheSameId(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var ledger=row.getEntityMutationLedger();var other=new EntityKey("Other",row.getId()); + ledger.set(other,"name","unrelated pending value");ledger.setOriginalVersion(other,19L); + row.updateName("intermediate");row.updateName("kept");assertNoNameIntent(row); + assertEquals("unrelated pending value",ledger.get(other,"name"));assertEquals(Long.valueOf(19),ledger.getOriginalVersion(other)); + assertEquals(Set.of("name"),ledger.changedFieldNames(other)); + } + @Test public void restoringAFieldDoesNotCancelPendingDeletion(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.markForDeletion();row.updateName("intermediate");row.updateName("kept"); + assertNoNameIntent(row);assertEquals(EntityStatus.UPDATED_DELETED,row.get$status());assertTrue(row.isMarkedAsDelete()); + assertTrue(row.getEntityMutationLedger().deletedKeys().contains(key(row))); + } + @Test public void restoringRetainsTheLoadSnapshotVersionAndLineage(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var state=row.__internalLoadState();var trace=row.getTraceChain();var comment=row.getComment(); + row.updateName("intermediate");var ledger=row.getEntityMutationLedger();row.updateName("kept"); + assertSame(state,row.__internalLoadState());assertSame(ledger,row.getEntityMutationLedger()); + assertEquals(Long.valueOf(7),row.getOriginalVersion());assertEquals(Long.valueOf(7),ledger.getOriginalVersion(key(row))); + assertEquals(trace,row.getTraceChain());assertEquals(trace,ledger.getTraceChain(key(row)));assertEquals(comment,row.getComment()); + } + @Test public void restoringThePersistentBaselineDiscardsOlderStagedValuesOfOnlyThatField(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.updateProperty("count",3);row.updateName("outer"); + var ledger=row.getEntityMutationLedger();ledger.pushChangeSet();row.updateName("inner");row.updateName("kept"); + assertNoNameIntent(row);ledger.popChangeSet();assertNoNameIntent(row); + assertEquals(Integer.valueOf(3),ledger.get(key(row),"count"));assertEquals(EntityStatus.UPDATED,row.get$status()); + } + @Test public void restoringANativeFieldCannotEraseDynamicIntent(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.updateName("intermediate");var ledger=row.getEntityMutationLedger(); + var mutation=DynamicFieldMutation.set("note",DynamicDataType.STRING,"pending dynamic value");ledger.setDynamic(key(row),mutation); + row.updateName("kept");assertNoNameIntent(row);assertEquals(EntityStatus.UPDATED,row.get$status()); + assertEquals(mutation,ledger.currentChangeSet().dynamicChanges().get(key(row)).get("note"));assertTrue(row.needPersist()); + } + @Test public void anUnknownOriginalNullMustNotBeTreatedAsAKnownBaseline(){ + var row=row(EntityStatus.PERSISTED,Availability.NOT_LOADED);row.updateProperty("name","intermediate");row.updateProperty("name",null); + assertEquals(EntityStatus.UPDATED,row.get$status());assertTrue(row.getUpdatedProperties().contains("name")); + assertTrue(row.getEntityMutationLedger().currentChangeSet().changes().get(key(row)).containsKey("name")); + assertNull(row.getEntityMutationLedger().get(key(row),"name")); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/MutationRollbackReplayTest.java b/teaql-core/src/test/java/io/teaql/core/MutationRollbackReplayTest.java new file mode 100644 index 000000000..2e2e36ef6 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/MutationRollbackReplayTest.java @@ -0,0 +1,74 @@ +package io.teaql.core; + +import io.teaql.data.dynamic.*; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.junit.Test; +import static org.junit.Assert.*; + +public class MutationRollbackReplayTest { + static final class Row extends BaseEntity { + static final FieldLayout LAYOUT = FieldLayout.installGenerated(FieldLayout.generated(Row.class, "rollback-replay-v1", + Map.of("id",0,"version",1,"name",2,"note",3), + Map.of("id",List.of("id","id"),"version",List.of("version","version"), + "name",List.of("name","name"),"note",List.of("note","note")),Set.of())); + String name, note; + @Override public Object __internalGet(String field) { + return switch(field) { case "name" -> name; case "note" -> note; default -> super.__internalGet(field); }; + } + @Override public void __internalSet(String field, Object value) { + if(field.equals("name")) { name=(String)value; markPropertyLoaded(field); } + else if(field.equals("note")) { note=(String)value; markPropertyLoaded(field); } + else super.__internalSet(field,value); + } + void updateName(String value) { handleUpdate("name",name,value); __internalSet("name",value); } + } + private Row row(boolean selectedNote) { + var row=new Row(); row.__internalHydrate("id",10L,0); row.__internalHydrate("version",1L,1); + row.__internalHydrate("name","original",2); if(selectedNote) row.__internalHydrate("note",null,3); + row.set$status(EntityStatus.PERSISTED); return row; + } + + @Test public void replayKeepsTheFirstKnownNativeBaseline() { + var row=row(true); row.updateName("first"); + var restore=row.__internalCaptureMutationRollback();var ledger=row.getEntityMutationLedger().__internalCaptureRollback(); + row.__internalSet("name","later");row.__internalSet("version",2L);row.clearUpdatedProperties();row.getEntityMutationLedger().clearCurrentChangeSet(); + row.__internalSet("name","first");row.__internalSet("note",null);restore.run();ledger.run(); + row.__internalReplayRetryNative("name","later");row.__internalReplayRetryNative("note","later note"); + assertEquals("original",row.getOldValue("name"));assertNull(row.getOldValue("note")); + assertEquals(Set.of("name","note"),Set.copyOf(row.getUpdatedProperties()));assertEquals(Long.valueOf(1),row.getVersion()); + row.updateName("original");assertFalse(row.getUpdatedProperties().contains("name")); + assertTrue(row.getUpdatedProperties().contains("note")); + } + + @Test public void replayOfAnUnknownOriginalNullDoesNotCancelExplicitInput() { + var row=row(false);assertFalse(row.isPropertyLoaded("note")); + row.__internalReplayRetryNative("note",null); + assertTrue(row.isPropertyLoaded("note"));assertTrue(row.getUpdatedProperties().contains("note")); + assertFalse(row.__internalPropertyChange("note").wasOldValueLoaded()); + assertTrue(row.getEntityMutationLedger().containsField(new EntityKey(row.typeName(),10L),"note")); + } + + @Test public void dynamicReplayKeepsOriginalNullAndUnselectedDefinition() { + var row=row(true);var metadata=new DynamicFieldMetadata(Map.of("edited",DynamicDataType.STRING,"hidden",DynamicDataType.STRING)); + var original=new DynamicFieldValues(metadata,Map.of("edited",DynamicFieldValue.ofNull("edited",DynamicDataType.STRING))); + row.__internalHydrateDynamicFields(original,row.__internalLoadState().withDynamicSelection(original.selectedCodes())); + row.updateDynamicField("edited","first");var restore=row.__internalCaptureMutationRollback(); + var ledger=row.getEntityMutationLedger().__internalCaptureRollback(); + row.updateDynamicField("edited","later");var latest=row.__internalDynamicMutations().get("edited"); + restore.run();ledger.run();row.__internalReplayRetryDynamic(latest); + assertEquals("later",row.dynamicFields().field("edited").value()); + assertEquals(DynamicFieldValue.State.NULL,row.__internalDynamicOriginalValues().get("edited").state()); + assertEquals(DynamicFieldValue.State.NOT_LOADED,row.dynamicFields().field("hidden").state()); + assertSame(metadata,row.dynamicFields().metadata());assertNull(Row.LAYOUT.findIndex("#edited")); + } + + @Test public void restoringOwnershipCannotClearAnotherLedger() { + var row=row(true);var original=row.getEntityMutationLedger();var restore=row.__internalCaptureMutationRollback(); + var other=new EntityMutationLedger();var unrelated=new EntityKey("Other",99L);other.set(unrelated,"note","pending"); + row.setEntityMutationLedger(other);restore.run(); + assertSame(original,row.getEntityMutationLedger());assertEquals("pending",other.get(unrelated,"note")); + assertFalse(original.containsField(unrelated,"note")); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/NamedRelationLoadStateAliasTest.java b/teaql-core/src/test/java/io/teaql/core/NamedRelationLoadStateAliasTest.java new file mode 100644 index 000000000..101cf5065 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/NamedRelationLoadStateAliasTest.java @@ -0,0 +1,62 @@ +package io.teaql.core; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.junit.Test; +import static org.junit.Assert.*; + +public class NamedRelationLoadStateAliasTest { + private static final class Row extends BaseEntity {} + private static FieldLayout layout(Set relations) { + return FieldLayout.generated(Row.class, "named-alias-v1", + Map.of("id", 0, "version", 1, "base_url", 2), + Map.of("id", List.of("id", "id"), "version", List.of("version", "version"), + "base_url", List.of("baseUrl", "legacy_url")), relations); + } + + @Test public void modelAndNativeProjectionNamesProduceOneCanonicalShape() { + var layout = layout(Set.of("school_list")); + var canonical = LoadState.projection(layout, List.of("id", "base_url", "school_list")); + var nativeNames = LoadState.projection(layout, List.of("id", "legacy_url", "schoolList")); + assertEquals(canonical, nativeNames); + assertEquals(canonical.hashCode(), nativeNames.hashCode()); + assertEquals(Set.of("school_list"), nativeNames.selectedNames()); + assertEquals(5L, nativeNames.bits()); + } + + @Test public void nativeLookupAndCopyOnWriteKeepOneSharedMarker() { + var state = LoadState.projection(layout(Set.of("school_list")), List.of("school_list")); + assertTrue(state.isLoaded("school_list")); + assertTrue(state.isLoaded("schoolList")); + assertSame(state, state.withLoaded("schoolList", true)); + var detached = state.withLoaded("schoolList", false); + assertFalse(detached.isLoaded("school_list")); + assertFalse(detached.isLoaded("schoolList")); + assertTrue(state.isLoaded("schoolList")); + } + + @Test public void persistentDynamicCodesRemainLiteralAndSeparate() { + var state = layout(Set.of("school_list")).emptyState().withLoaded("schoolList", true) + .withDynamicSelection(Set.of("schoolList")); + assertEquals(Set.of("school_list", "#schoolList"), state.selectedNames()); + assertTrue(state.isLoaded("#schoolList")); + assertFalse(state.isLoaded("#school_list")); + assertTrue(state.isLoaded("school_list")); + } + + @Test public void ambiguousNamedRelationAliasesAreRejectedLikeFixedAliases() { + assertThrows(IllegalArgumentException.class, () -> layout(Set.of("school_list", "schoolList"))); + } + + @Test public void presentationNamesAndCanonicalRelationLookupShareTypeLocalMetadata() { + var layout = layout(Set.of("school_list")); + assertEquals("schoolList", layout.memberName("school_list")); + assertSame(layout.memberName("school_list"), layout.memberName("school_list")); + assertEquals("school_list", layout.canonicalRelationName("schoolList")); + assertEquals("school_list", layout.canonicalRelationName("school_list")); + assertNull(layout.canonicalRelationName("missing")); + assertNull(layout.findIndex("school_list")); + assertEquals(3, layout.indexes().size()); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/RejectedMutationControlsTest.java b/teaql-core/src/test/java/io/teaql/core/RejectedMutationControlsTest.java new file mode 100644 index 000000000..d0babec05 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/RejectedMutationControlsTest.java @@ -0,0 +1,45 @@ +package io.teaql.core; + +import java.util.Set; +import org.junit.Test; +import static io.teaql.core.RejectedMutationStateTest.*; +import static org.junit.Assert.*; + +public class RejectedMutationControlsTest { + @Test public void newTypedMutationStillRecordsTheSelectedValue(){ + var row=row(EntityStatus.NEW,Availability.NOT_LOADED);row.updateName("new value"); + assertEquals(EntityStatus.NEW,row.get$status());assertTrue(row.isPropertyLoaded("name"));assertEquals("new value",row.name);assertTrue(row.getUpdatedProperties().contains("name")); + } + @Test public void persistedTypedMutationRetainsItsOriginalVersion(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var state=row.__internalLoadState();row.updateName("updated value"); + assertEquals(EntityStatus.UPDATED,row.get$status());assertSame(state,row.__internalLoadState());assertEquals(Long.valueOf(7),row.getOriginalVersion());assertEquals(Set.of("name"),Set.copyOf(row.getUpdatedProperties())); + } + @Test public void pendingDeletionSurvivesAnAllowedTypedUpdate(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);row.markForDeletion();row.updateName("final value"); + assertEquals(EntityStatus.UPDATED_DELETED,row.get$status());assertTrue(row.isMarkedAsDelete());assertEquals("final value",row.name); + } + @Test public void validGenericMutationStillUsesTheTypedStorage(){ + var row=row(EntityStatus.PERSISTED,Availability.NOT_LOADED);row.updateProperty("count",3); + assertEquals(EntityStatus.UPDATED,row.get$status());assertEquals(Integer.valueOf(3),row.count);assertTrue(row.isPropertyLoaded("count"));assertEquals(Long.valueOf(7),row.getOriginalVersion()); + } + @Test public void failedGenericCastDoesNotSelectAnUnloadedField(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var before=new Snapshot(row); + assertThrows(ClassCastException.class,()->row.updateProperty("count","wrong type"));before.unchanged(row); + } + @Test public void unknownGenericFieldAlreadyFailsWithoutChangingTheEntity(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var before=new Snapshot(row); + assertThrows(IllegalArgumentException.class,()->row.updateProperty("unknown_field","wrong value"));before.unchanged(row); + } + @Test public void allowedLegacyCacheAttachmentKeepsItsExistingReadContract(){ + var row=row(EntityStatus.NEW,Availability.NOT_LOADED);var owner=foreign(200);row.cacheRelation("owner",owner); + assertSame(owner,row.getProperty("owner"));assertTrue(row.isPropertyLoaded("owner"));assertEquals(EntityStatus.NEW,row.get$status()); + } + @Test public void rejectedConversionCannotAlterAnExistingUnrelatedLedgerIntent(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var ledger=row.getEntityMutationLedger();ledger.set(new EntityKey("Other",100L),"name","keep unrelated pending value"); + var before=new Snapshot(row);assertThrows(ClassCastException.class,()->row.updateProperty("count","wrong type"));before.unchanged(row); + } + @Test public void rejectedFrameworkAssignmentDoesNotPublishAvailability(){ + var row=row(EntityStatus.PERSISTED,Availability.VALUE);var before=new Snapshot(row); + assertThrows(ClassCastException.class,()->row.setProperty("count","wrong type"));before.unchanged(row); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/RejectedMutationStateTest.java b/teaql-core/src/test/java/io/teaql/core/RejectedMutationStateTest.java new file mode 100644 index 000000000..02564f3d8 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/RejectedMutationStateTest.java @@ -0,0 +1,79 @@ +package io.teaql.core; + +import java.util.*; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import static org.junit.Assert.*; + +/** Rejected operations cannot rewrite payload, availability, lifecycle or intent. */ +@RunWith(Parameterized.class) +public class RejectedMutationStateTest { + enum Availability {NOT_LOADED, NULL, VALUE} + @Parameterized.Parameters(name="{0}-{1}") public static Collection cases(){ + var result=new ArrayList(); + for(var state:List.of(EntityStatus.REFER,EntityStatus.PERSISTED_DELETED,EntityStatus.UPDATED_RECOVER)) + for(var availability:Availability.values())result.add(new Object[]{state,availability}); + return result; + } + static class Row extends BaseEntity { + static final FieldLayout LAYOUT=FieldLayout.installGenerated(FieldLayout.generated(Row.class,"rejected-mutation-v1", + Map.of("id",0,"version",1,"name",2,"count",3), + Map.of("id",List.of("id","id"),"version",List.of("version","version"),"name",List.of("name","name"),"count",List.of("count","count")),Set.of("owner"))); + String name;Integer count;Row owner; + @Override public String typeName(){return "GuardedRow";} + @Override public Object __internalGet(String field){return switch(field){case "name"->name;case "count"->count;case "owner"->owner;default->super.__internalGet(field);};} + @Override public void __internalSet(String field,Object value){ + markPropertyLoaded(field); + switch(field){case "name"->name=(String)value;case "count"->count=(Integer)value;case "owner"->owner=(Row)value;default->super.__internalSet(field,value);} + } + Row updateName(String value){ + // Same ordering as the current generated typed updater. + if(Objects.equals(name,value))return this; + handleUpdate("name",name,value);name=value;return this; + } + } + static Row row(EntityStatus status,Availability availability){ + assertNotNull(Row.LAYOUT);var row=new Row();row.__internalHydrate("id",100L,0); + if(status!=EntityStatus.REFER&&status!=EntityStatus.NEW)row.__internalHydrate("version",status==EntityStatus.PERSISTED_DELETED||status==EntityStatus.UPDATED_RECOVER?-7L:7L,1); + if(availability!=Availability.NOT_LOADED)row.__internalHydrate("name",availability==Availability.VALUE?"kept":null,2); + row.setComment("keep existing reason");row.setTraceChain(List.of(new TraceNode(TraceKind.AUDIT_REASON,row.typeName(),row.getId(),"keep existing lineage"))); + if(status==EntityStatus.UPDATED_RECOVER){row.set$status(EntityStatus.PERSISTED_DELETED);row.markAsRecover();} + else row.set$status(status); + return row; + } + static Row foreign(long id){var row=new Row();row.__internalHydrate("id",id,0);row.set$status(EntityStatus.REFER);return row;} + static final class Snapshot { + final LoadState state;final EntityStatus lifecycle;final String name,comment;final Integer count;final Long id,version,originalVersion; + final Object owner;final List trace;final List updated;final EntityMutationLedger ledger; + final Map> changes;final Set created,deleted,recovered; + Snapshot(Row row){ + state=row.__internalLoadState();lifecycle=row.get$status();name=row.name;count=row.count;id=row.getId();version=row.getVersion();originalVersion=row.getOriginalVersion(); + owner=row.getProperty("owner");comment=row.getComment();trace=row.getTraceChain();updated=List.copyOf(row.getUpdatedProperties()); + ledger=row.__internalHasMutationLedger()?row.getEntityMutationLedger():null; + changes=ledger==null?Map.of():ledger.currentChangeSet().changes();created=ledger==null?Set.of():Set.copyOf(ledger.newKeys()); + deleted=ledger==null?Set.of():Set.copyOf(ledger.deletedKeys());recovered=ledger==null?Set.of():Set.copyOf(ledger.recoveredKeys()); + } + void unchanged(Row row){ + assertSame("rejection must retain the exact immutable load state",state,row.__internalLoadState()); + assertEquals(lifecycle,row.get$status());assertEquals(name,row.name);assertEquals(count,row.count);assertEquals(id,row.getId());assertEquals(version,row.getVersion()); + assertEquals(originalVersion,row.getOriginalVersion());assertSame(owner,row.getProperty("owner"));assertEquals(comment,row.getComment());assertEquals(trace,row.getTraceChain()); + assertEquals(updated,row.getUpdatedProperties());assertEquals(ledger!=null,row.__internalHasMutationLedger()); + if(ledger!=null){assertSame(ledger,row.getEntityMutationLedger());assertEquals(changes,ledger.currentChangeSet().changes());assertEquals(created,ledger.newKeys());assertEquals(deleted,ledger.deletedKeys());assertEquals(recovered,ledger.recoveredKeys());} + } + } + private final EntityStatus status;private final Availability availability; + public RejectedMutationStateTest(EntityStatus status,Availability availability){this.status=status;this.availability=availability;} + void reject(Row row,Runnable action){var before=new Snapshot(row);assertThrows(TeaQLRuntimeException.class,action::run);before.unchanged(row);} + @Test public void typedUpdateRejectsBeforeChangingAvailability(){var row=row(status,availability);reject(row,()->row.updateName("attempted typed value"));} + @Test public void genericUpdateRejectsBeforeChangingPayload(){var row=row(status,availability);reject(row,()->row.updateProperty("name","attempted generic value"));} + @Test public void versionUpdateRejectsBeforeClaimingASelectedVersion(){var row=row(status,availability);reject(row,()->row.updateVersion(9L));} + @Test public void identityUpdateRejectsWithoutChangingTheKey(){var row=row(status,availability);reject(row,()->row.updateId(101L));} + @Test public void directUpdateHookRejectsBeforeChangingAvailability(){var row=row(status,availability);reject(row,()->row.handleUpdate("name",row.name,"attempted hook value"));} + @Test public void cacheAttachmentRejectsBeforeAddingAReference(){var row=row(status,availability);reject(row,()->row.cacheRelation("owner",foreign(200)));} + @Test public void cacheReplacementRejectsBeforeOverwritingAPreviousReference(){ + var row=row(status,availability);row.set$status(EntityStatus.NEW);row.cacheRelation("owner",foreign(200));row.set$status(status); + reject(row,()->row.cacheRelation("owner",foreign(201))); + } + @Test public void deletionRejectionAlreadyRetainsTheExistingState(){var row=row(status,availability);reject(row,row::markForDeletion);} +} diff --git a/teaql-core/src/test/java/io/teaql/core/VersionLifecycleCoreTest.java b/teaql-core/src/test/java/io/teaql/core/VersionLifecycleCoreTest.java new file mode 100644 index 000000000..50b3a7cb3 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/VersionLifecycleCoreTest.java @@ -0,0 +1,52 @@ +package io.teaql.core; + +import java.math.BigInteger; +import org.junit.Test; +import static io.teaql.core.MutationOperationKind.*; +import static org.junit.Assert.*; + +public class VersionLifecycleCoreTest { + @Test public void exactLiveEndpointsAndDeleteAtMax() { + assertEquals(2L, MutationVersions.next(UPDATE, 1L)); + assertEquals(Long.MAX_VALUE, MutationVersions.next(UPDATE, Long.MAX_VALUE - 1)); + assertEquals(-2L, MutationVersions.next(DELETE, 1L)); + assertEquals(Long.MIN_VALUE, MutationVersions.next(DELETE, Long.MAX_VALUE)); + } + @Test public void exactRecoveryEndpoints() { + assertEquals(2L, MutationVersions.next(RECOVER, -1L)); + assertEquals(Long.MAX_VALUE, MutationVersions.next(RECOVER, Long.MIN_VALUE + 2)); + } + @Test public void explicitCreatesDoNotTreatClientVersionAsPersistedBaseline() { + for (Long input : new Long[]{null, 0L, -2L, Long.MAX_VALUE}) assertEquals(1L, MutationVersions.next(CREATE, input)); + } + @Test public void exhaustedTransitionsHaveTypedOriginalAndOperation() { + exhausted(UPDATE, Long.MAX_VALUE); + exhausted(RECOVER, Long.MIN_VALUE); exhausted(RECOVER, Long.MIN_VALUE + 1); + } + private static void exhausted(MutationOperationKind operation, long original) { + var error = assertThrows(MutationVersionException.class, () -> MutationVersions.next(operation, original)); + assertEquals(MutationVersionException.Code.VERSION_EXHAUSTED, error.code()); + assertEquals(operation, error.operation()); assertEquals(Long.valueOf(original), error.originalVersion()); + } + @Test public void missingZeroAndWrongSignsCannotChangeLifecycle() { + for (var operation : new MutationOperationKind[]{UPDATE, DELETE, RECOVER}) { + Long wrongSign = operation == RECOVER ? 1L : -1L; + for (Long original : new Long[]{null, 0L, wrongSign}) { + var error = assertThrows(MutationVersionException.class, () -> MutationVersions.next(operation, original)); + assertEquals(MutationVersionException.Code.INVALID_VERSION_STATE, error.code()); + } + } + } + @Test public void deterministicDomainSampleMatchesUnboundedIntegerArithmetic() { + var random = new java.util.Random(236); + for (int i = 0; i < 2048; i++) { + long original = random.nextLong() & Long.MAX_VALUE; + if (original == 0 || original == Long.MAX_VALUE) continue; + var value = BigInteger.valueOf(original); + assertEquals(value.add(BigInteger.ONE).longValueExact(), MutationVersions.next(UPDATE, original)); + long tombstone = MutationVersions.next(DELETE, original); + assertEquals(value.negate().subtract(BigInteger.ONE).longValueExact(), tombstone); + assertEquals(value.add(BigInteger.TWO).longValueExact(), MutationVersions.next(RECOVER, tombstone)); + } + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/checker/CheckerEntityTypeTest.java b/teaql-core/src/test/java/io/teaql/core/checker/CheckerEntityTypeTest.java new file mode 100644 index 000000000..b4d8b71ea --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/checker/CheckerEntityTypeTest.java @@ -0,0 +1,104 @@ +package io.teaql.core.checker; + +import io.teaql.core.BaseEntity; +import io.teaql.core.UserContext; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Error identity belongs to the Checker that owns the rule, not its caller. */ +public class CheckerEntityTypeTest { + private static UserContext context() { + Map attributes = new HashMap<>(); + return (UserContext) Proxy.newProxyInstance(UserContext.class.getClassLoader(), new Class[]{UserContext.class}, + (proxy, method, args) -> { + if (method.getName().equals("getAttribute") && args.length == 1) return attributes.get(args[0]); + if (method.getName().equals("putAttribute")) { attributes.put((String) args[0], args[1]); return null; } + if (method.isDefault()) return InvocationHandler.invokeDefault(proxy, method, args); + throw new AssertionError("unexpected runtime/provider call: " + method.getName()); + }); + } + private static Checker checker(String type) { + return new Checker<>() { + public String type() { return type; } + public void checkAndFix(UserContext context, BaseEntity value, ObjectLocation location) { } + }; + } + @SuppressWarnings("unchecked") private static List results(UserContext context) { + return (List) context.getAttribute(Checker.TEAQL_DATA_CHECK_RESULT); + } + @Test public void generatedRequiredRuleCarriesItsCheckerTypeBeforeWireProjection() { + UserContext context = context(); + checker("PurchaseOrder").requiredCheck(context, ObjectLocation.hashRoot("contact_phone"), null); + CheckResult result = results(context).get(0); + assertEquals("PurchaseOrder", result.getRootType()); + assertEquals("PurchaseOrder", result.toWire(JsonFieldNamingProfile.CAMEL_CASE).entityType()); + assertEquals("/contactPhone", result.toWire(JsonFieldNamingProfile.CAMEL_CASE).instancePath()); + assertFalse(result.getNaturalLanguageStatement().isBlank()); + } + @Test public void everyRuleFamilyGetsTheSameStableTypeWithoutChangingItsRule() { + UserContext context = context(); Checker checker = checker("OrderItem"); + ObjectLocation location = ObjectLocation.hashRoot("unit_price"); + List candidates = List.of(CheckResult.required(location), CheckResult.min(location, 1, 0), + CheckResult.max(location, 1, 2), CheckResult.minStr(location, 2, "x"), + CheckResult.maxStr(location, 1, "xx"), CheckResult.invalidType(location, "invalid model value"), + CheckResult.unknownField(location)); + for (CheckResult result : candidates) { + CheckResult.RuleId original = result.getRuleId(); + checker.appendResult(context, result); + assertEquals("OrderItem", result.getRootType()); + assertSame(original, result.getRuleId()); + } + assertEquals(candidates, results(context)); + } + @Test public void explicitMoreSpecificTypeSurvivesAParentChecker() { + UserContext context = context(); CheckResult result = CheckResult.required(ObjectLocation.hashRoot("name")); + result.setRootType("SpecializedOrderItem"); + checker("OrderItem").appendResult(context, result); + assertEquals("SpecializedOrderItem", result.toWire(JsonFieldNamingProfile.CAMEL_CASE).entityType()); + } + @Test public void blankTypeIsBoundBeforeTheCustomerLocalizationHook() { + UserContext delegate = context(); int[] translations = {0}; + UserContext context = (UserContext) Proxy.newProxyInstance(UserContext.class.getClassLoader(), new Class[]{UserContext.class}, + (proxy, method, args) -> { + if (method.getName().equals("translateCheckResult")) { + assertEquals("OrderItem", ((CheckResult) args[0]).getRootType()); + translations[0]++; return args[0]; + } + try { return method.invoke(delegate, args); } + catch (java.lang.reflect.InvocationTargetException error) { throw error.getCause(); } + }); + CheckResult result = CheckResult.required(ObjectLocation.hashRoot("product_name")); + result.setRootType(" \t"); + checker("OrderItem").appendResult(context, result); + assertEquals(1, translations[0]); + assertEquals("OrderItem", results(delegate).get(0).getRootType()); + } + @Test public void nestedRuleKeepsCanonicalLocationAndAllThreeExternalProfiles() { + UserContext context = context(); + ObjectLocation location = ObjectLocation.hashRoot("order_item_list").element(0).member("product_name"); + checker("OrderItem").requiredCheck(context, location, null); + CheckResult result = results(context).get(0); + for (JsonFieldNamingProfile profile : JsonFieldNamingProfile.values()) { + WireCheckResult wire = result.toWire(profile); + assertEquals("OrderItem", wire.entityType()); + assertEquals(location.segments(), wire.location()); + } + assertEquals("/orderItemList/0/productName", result.toWire(JsonFieldNamingProfile.CAMEL_CASE).instancePath()); + assertEquals("/order_item_list/0/product_name", result.toWire(JsonFieldNamingProfile.SNAKE_CASE).instancePath()); + assertEquals("/OrderItemList/0/ProductName", result.toWire(JsonFieldNamingProfile.PASCAL_CASE).instancePath()); + assertEquals("order_item_list[0].product_name", result.getLocation().modelPath()); + } + @Test public void differentCheckersInOneContextDoNotShareOrOverwriteTypes() { + UserContext context = context(); ObjectLocation location = ObjectLocation.hashRoot("name"); + checker("PurchaseOrder").requiredCheck(context, location, null); + CheckResult first = results(context).get(0); + checker("OrderItem").requiredCheck(context, location, null); + assertEquals(List.of("PurchaseOrder", "OrderItem"), results(context).stream().map(CheckResult::getRootType).toList()); + assertEquals("PurchaseOrder", first.getRootType()); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/checker/FiniteScalarCheckerTest.java b/teaql-core/src/test/java/io/teaql/core/checker/FiniteScalarCheckerTest.java new file mode 100644 index 000000000..b2c34cec3 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/checker/FiniteScalarCheckerTest.java @@ -0,0 +1,95 @@ +package io.teaql.core.checker; + +import io.teaql.core.*; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.util.*; +import java.util.function.Consumer; +import org.junit.Test; +import static org.junit.Assert.*; + +public class FiniteScalarCheckerTest { + static UserContext context() { + Map attributes = new HashMap<>(); + return (UserContext)Proxy.newProxyInstance(UserContext.class.getClassLoader(), new Class[]{UserContext.class}, (proxy, method, args) -> { + if (method.getName().equals("businessTime")) return java.time.LocalDateTime.of(2032,2,29,10,15,30); + if (method.getName().equals("getAttribute")) return attributes.get(args[0]); + if (method.getName().equals("putAttribute")) { attributes.put((String)args[0],args[1]); return null; } + if (method.getDeclaringClass() == Object.class) return switch (method.getName()) { + case "equals" -> proxy == args[0]; case "hashCode" -> System.identityHashCode(proxy); default -> "FiniteCheckerContext"; + }; + if (method.isDefault()) return InvocationHandler.invokeDefault(proxy,method,args); + throw new AssertionError("unexpected provider operation: " + method.getName()); + }); + } + static final class Probe extends BaseEntity { + final Map values = new HashMap<>(); + @Override public String typeName() { return "FiniteProbe"; } + @Override public Object __internalGet(String field) { + return field.equals("id") || field.equals("version") ? super.__internalGet(field) : values.get(field); + } + @Override public void __internalSet(String field,Object value) { + if (field.equals("id") || field.equals("version")) super.__internalSet(field,value); else values.put(field,value); + } + } + static Checker checker(Consumer fix) { + return new Checker<>() { + public String type() { return "FiniteProbe"; } + public void checkAndFix(UserContext context, Probe entity, ObjectLocation location) { + var where = ObjectLocation.hashRoot("value"); + minNumberCheck(context, where, -10, (Number)entity.getProperty("value")); + if (fix != null) fix.accept(entity); + maxNumberCheck(context, where, 10, (Number)entity.getProperty("value")); + } + }; + } + @Test public void standaloneRangesReportStructuredNonfiniteTypeInsteadOfBigDecimalFailure() { + for (Number bad : List.of(Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, Float.NaN, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY)) { + var context = context(); var row = new Probe(); row.updateProperty("value", bad); + var error = assertThrows(CheckException.class, () -> checker(null).checkAndFix(context,row)); + assertEquals(1,error.getViolates().size()); var result = error.getViolates().get(0); + assertEquals(CheckResult.RuleId.INVALID_TYPE,result.getRuleId()); assertEquals("FiniteProbe",result.getRootType()); + assertEquals("value",result.getLocation().modelPath()); assertNull(result.getInputValue()); + for (var profile : JsonFieldNamingProfile.values()) assertEquals("/" + profile.render("value"),result.toWire(profile).instancePath()); + } + } + @Test public void aLaterCustomerRepairIsJudgedOnItsFinalValue() { + var row = new Probe(); row.updateProperty("value",Double.NaN); + checker(e -> e.updateProperty("value",7.5d)).checkAndFix(context(),row); + assertEquals(7.5d,(Double)row.getProperty("value"),0); + } + @Test public void rejectedInvocationDoesNotPolluteTheNextStandaloneCheck() { + var row = new Probe(); row.updateProperty("value",Double.NaN); var context = context(); + assertThrows(CheckException.class,() -> checker(null).checkAndFix(context,row)); + row.updateProperty("value",5.0d); checker(null).checkAndFix(context,row); + assertEquals(5.0d,(Double)row.getProperty("value"),0); + } + @Test public void rangeHelpersWithoutAnInvocationStillReportInvalidType() { + var context = context(); + checker(null).minNumberCheck(context,ObjectLocation.hashRoot("value"),0,Double.NaN); + var results = (List)context.getAttribute(Checker.TEAQL_DATA_CHECK_RESULT); + assertEquals(1,results.size()); assertEquals(CheckResult.RuleId.INVALID_TYPE,((CheckResult)results.get(0)).getRuleId()); + } + + @Test public void standaloneChecksLoadedValuesWithoutAllocatingAMutationLedger() { + var row = new Probe(); + row.__internalHydrate("value",Double.POSITIVE_INFINITY,BaseEntity.loadedPropertyIndex(Probe.class,"value")); + assertFalse(row.__internalHasMutationLedger()); + var error = assertThrows(CheckException.class,() -> checker(null).checkAndFix(context(),row)); + assertEquals(1,error.getViolates().size()); + assertEquals("value",error.getViolates().get(0).getLocation().modelPath()); + assertFalse(row.__internalHasMutationLedger()); + } + + @Test public void standaloneFindsLateChildThroughLoadedRelationsAndCyclesWithoutRuntimeCapabilities() { + var root = new Probe(); var first = new Probe(); var second = new Probe(); + first.updateProperty("value",1.0d); second.updateProperty("value",Double.NEGATIVE_INFINITY); + root.__internalHydrate("children",List.of(first,second),BaseEntity.loadedPropertyIndex(Probe.class,"children")); + second.__internalHydrate("owner",root,BaseEntity.loadedPropertyIndex(Probe.class,"owner")); + var error = assertThrows(CheckException.class,() -> checker(null).checkAndFix(context(),root)); + assertEquals(1,error.getViolates().size()); + assertEquals("children[1].value",error.getViolates().get(0).getLocation().modelPath()); + assertFalse(root.__internalHasMutationLedger()); + second.updateProperty("value",2.0d); checker(null).checkAndFix(context(),root); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/checker/StandaloneCheckerInvocationTest.java b/teaql-core/src/test/java/io/teaql/core/checker/StandaloneCheckerInvocationTest.java new file mode 100644 index 000000000..35e2b9761 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/checker/StandaloneCheckerInvocationTest.java @@ -0,0 +1,206 @@ +package io.teaql.core.checker; + +import io.teaql.core.BaseEntity; +import io.teaql.core.UserContext; +import io.teaql.core.checker.internal.CheckerInvocation; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Test; +import static org.junit.Assert.*; + +public class StandaloneCheckerInvocationTest { + private static final LocalDateTime T0 = LocalDateTime.of(2032, 2, 29, 10, 15, 30); + private static final String[] KEYS = {Checker.TEAQL_FIX_TIME, Checker.TEAQL_DATA_CHECKED_ITEMS, + Checker.TEAQL_DATA_CHECK_RESULT, UserContext.TEAQL_FIX_EVIDENCE_CURRENT}; + + private static final class Entity extends BaseEntity { + @Override public String typeName() { return "ClockNode"; } + } + @FunctionalInterface private interface Work { void run(UserContext context, Entity entity); } + private static Checker checker(Work work) { + return new Checker<>() { + public String type() { return "ClockNode"; } + public void checkAndFix(UserContext context, Entity entity, ObjectLocation location) { work.run(context, entity); } + }; + } + private static final class Context { + final Map attributes = new ConcurrentHashMap<>(); + final AtomicInteger calls = new AtomicInteger(); + final AtomicInteger next; + volatile RuntimeException clockFailure; + final UserContext value; + Context() { this(new AtomicInteger()); } + Context(AtomicInteger next) { + this.next = next; + value = (UserContext) Proxy.newProxyInstance(UserContext.class.getClassLoader(), new Class[]{UserContext.class}, + (proxy, method, args) -> { + if (method.getName().equals("businessTime")) { + calls.incrementAndGet(); + if (clockFailure != null) throw clockFailure; + return T0.plusNanos(next.getAndIncrement() * 1_000_000L); + } + if (method.getName().equals("getAttribute") && args.length == 1) return attributes.get(args[0]); + if (method.getName().equals("putAttribute")) { + if (args[1] == null) attributes.remove(args[0]); else attributes.put((String) args[0], args[1]); + return null; + } + if (method.getDeclaringClass() == Object.class) return switch (method.getName()) { + case "hashCode" -> System.identityHashCode(proxy); + case "equals" -> proxy == args[0]; + default -> "ClockContext"; + }; + if (method.isDefault()) return InvocationHandler.invokeDefault(proxy, method, args); + throw new AssertionError("unexpected capability/provider operation: " + method.getName()); + }); + } + } + private static LocalDateTime time(UserContext context) { + return (LocalDateTime) CheckerInvocation.attribute(context, Checker.TEAQL_FIX_TIME); + } + private static void evidence(UserContext context, String label) { + context.recordFixEvidence(new FixEvidence("ClockNode", "create_time", FixEvidence.Source.CLOCK, label)); + } + private static void released(Context context) { + assertNull(CheckerInvocation.current(context.value)); + for (String key : KEYS) assertNull(key, context.attributes.get(key)); + } + + @Test public void standaloneCapturesOnceAndPublishesDetachedReceipts() { + var context = new Context(); var times = new ArrayList(); + var checker = checker((ctx, entity) -> { times.add(time(ctx)); evidence(ctx, "first"); times.add(time(ctx)); }); + checker.checkAndFix(context.value, new Entity()); + List first = context.value.lastFixEvidence(); + assertEquals(1, context.calls.get()); assertEquals(List.of(T0,T0), times); released(context); + assertThrows(UnsupportedOperationException.class, () -> first.add(first.get(0))); + checker.checkAndFix(context.value, new Entity()); + assertEquals(List.of(T0,T0,T0.plusNanos(1_000_000),T0.plusNanos(1_000_000)), times); + assertEquals(2, context.calls.get()); assertEquals(1, first.size()); assertEquals(1, context.value.lastFixEvidence().size()); released(context); + } + + @Test public void aLaterInvocationChecksTheSameEntityAgain() { + var context = new Context(); var entity = new Entity(); var visited = new AtomicInteger(); + Checker[] holder = new Checker[1]; + holder[0] = checker((ctx, item) -> { + if (!holder[0].needCheck(ctx, item)) return; + holder[0].markAsChecked(ctx, item); visited.incrementAndGet(); + }); + holder[0].checkAndFix(context.value, entity); holder[0].checkAndFix(context.value, entity); + assertEquals(2, visited.get()); assertEquals(2, context.calls.get()); released(context); + } + + @Test public void recursivePublicChecksShareTheClockAndCycleGuard() { + var context = new Context(); var first = new Entity(); var second = new Entity(); + var seen = new ArrayList(); Checker[] holder = new Checker[1]; + holder[0] = checker((ctx, item) -> { + if (!holder[0].needCheck(ctx, item)) return; + holder[0].markAsChecked(ctx, item); seen.add(time(ctx)); + holder[0].checkAndFix(ctx, item == first ? second : first); + }); + holder[0].checkAndFix(context.value, first); + assertEquals(List.of(T0,T0), seen); assertEquals(1, context.calls.get()); released(context); + } + + @Test public void anExistingMutationInvocationIsJoinedWithoutResettingItsState() { + var context = new Context(); + try (var outer = CheckerInvocation.openMutation(context.value)) { + Object guard = outer.attribute(Checker.TEAQL_DATA_CHECKED_ITEMS); + checker((ctx, entity) -> { + assertSame(outer, CheckerInvocation.current(ctx)); assertTrue(outer.mutationOnly()); + assertSame(guard, CheckerInvocation.attribute(ctx, Checker.TEAQL_DATA_CHECKED_ITEMS)); evidence(ctx, "joined"); + }).checkAndFix(context.value, new Entity()); + assertSame(outer, CheckerInvocation.current(context.value)); assertEquals(1, context.calls.get()); + } + assertEquals(1, context.value.lastFixEvidence().size()); released(context); + } + + @Test public void aDifferentContextGetsItsOwnClockAndRestoresTheOuterContext() { + var counter = new AtomicInteger(); var first = new Context(counter); var second = new Context(counter); + checker((ctx, entity) -> { + var outer = CheckerInvocation.current(ctx); assertEquals(T0, time(ctx)); + checker((other, ignored) -> { assertNotSame(outer, CheckerInvocation.current(other)); assertEquals(T0.plusNanos(1_000_000),time(other)); }) + .checkAndFix(second.value, new Entity()); + assertSame(outer, CheckerInvocation.current(ctx)); assertEquals(T0,time(ctx)); + }).checkAndFix(first.value, new Entity()); + assertEquals(1, first.calls.get()); assertEquals(1, second.calls.get()); released(first); released(second); + } + + @Test public void failureRetainsItsOwnReceiptAndRetryCapturesFreshTime() { + var context = new Context(); var error = new IllegalStateException("checker failed"); + assertSame(error, assertThrows(IllegalStateException.class, () -> checker((ctx, item) -> { + evidence(ctx,"failed"); throw error; + }).checkAndFix(context.value,new Entity()))); + var failed = context.value.lastFixEvidence(); assertEquals(1,failed.size()); released(context); + checker((ctx, item) -> { assertEquals(T0.plusNanos(1_000_000),time(ctx)); evidence(ctx,"retry"); }).checkAndFix(context.value,new Entity()); + assertEquals(1,failed.size()); assertEquals(1,context.value.lastFixEvidence().size()); assertEquals(2,context.calls.get()); released(context); + } + + @Test public void synchronousCancellationUnwindsWithoutReplacingItsExactError() { + var context = new Context(); var error = new CancellationException("cancelled"); + assertSame(error,assertThrows(CancellationException.class,()->checker((ctx,item)->{ evidence(ctx,"cancelled"); throw error; }).checkAndFix(context.value,new Entity()))); + released(context); + checker((ctx,item)->assertEquals(T0.plusNanos(1_000_000),time(ctx))).checkAndFix(context.value,new Entity()); + assertEquals(2,context.calls.get()); released(context); + } + + @Test public void clockFailureCannotBindOrLeakAnInvocation() { + var context = new Context(); var error = new IllegalStateException("clock failed"); context.clockFailure = error; + assertSame(error,assertThrows(IllegalStateException.class,()->checker((ctx,item)->fail("callback must not run")).checkAndFix(context.value,new Entity()))); + released(context); context.clockFailure = null; + checker((ctx,item)->assertEquals(T0,time(ctx))).checkAndFix(context.value,new Entity()); + assertEquals(2,context.calls.get()); released(context); + } + + @Test public void diagnosticCloseFailureIsSuppressedUnderTheOriginalCallbackError() { + var context = new Context(); var error = new IllegalStateException("primary checker failure"); + assertSame(error,assertThrows(IllegalStateException.class,()->checker((ctx,item)->{ + CheckerInvocation.current(ctx).attribute(UserContext.TEAQL_FIX_EVIDENCE_LAST,"invalid receipt"); throw error; + }).checkAndFix(context.value,new Entity()))); + assertEquals(1,error.getSuppressed().length); assertTrue(error.getSuppressed()[0] instanceof ClassCastException); released(context); + } + + @Test public void anotherThreadCannotBorrowTheEnclosingContextInvocation() throws Exception { + var context = new Context(); var workers = Executors.newSingleThreadExecutor(); + try (var outer = CheckerInvocation.open(context.value)) { + workers.submit(()->{ + assertNull(CheckerInvocation.current(context.value)); + checker((ctx,item)->{ assertEquals(T0.plusNanos(1_000_000),time(ctx)); evidence(ctx,"worker"); }).checkAndFix(context.value,new Entity()); + assertNull(CheckerInvocation.current(context.value)); assertEquals(1,context.value.lastFixEvidence().size()); + }).get(10,TimeUnit.SECONDS); + assertSame(outer,CheckerInvocation.current(context.value)); assertEquals(T0,time(context.value)); + } finally { workers.shutdownNow(); assertTrue(workers.awaitTermination(10,TimeUnit.SECONDS)); } + assertEquals(2,context.calls.get()); released(context); + } + + @Test public void standaloneValidationFailuresSurviveClosingAsARealCheckException() { + var context = new Context(); + var expected = CheckResult.required(ObjectLocation.hashRoot("contact_phone")); + var error = assertThrows(CheckException.class, () -> checker((ctx, item) -> { + evidence(ctx,"invalid"); + CheckerInvocation.current(ctx).attribute(Checker.TEAQL_DATA_CHECK_RESULT,new ArrayList<>(List.of(expected))); + }).checkAndFix(context.value,new Entity())); + assertEquals(1,error.getViolates().size()); assertSame(expected,error.getViolates().get(0)); + assertEquals(1,context.calls.get()); assertEquals(1,context.value.lastFixEvidence().size()); released(context); + } + + @Test public void joinedGraphChecksLeaveValidationFailuresForTheGraphOwner() { + var context = new Context(); var expected = CheckResult.required(ObjectLocation.hashRoot("contact_phone")); + try (var outer = CheckerInvocation.openMutation(context.value)) { + var violations = new ArrayList(); + outer.attribute(Checker.TEAQL_DATA_CHECK_RESULT,violations); + checker((ctx,item)->violations.add(expected)).checkAndFix(context.value,new Entity()); + assertSame(outer,CheckerInvocation.current(context.value)); + assertSame(violations,outer.attribute(Checker.TEAQL_DATA_CHECK_RESULT)); + assertEquals(List.of(expected),violations); assertEquals(1,context.calls.get()); + } + released(context); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/value/ExpressionLocationTest.java b/teaql-core/src/test/java/io/teaql/core/value/ExpressionLocationTest.java new file mode 100644 index 000000000..6f817a0f2 --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/value/ExpressionLocationTest.java @@ -0,0 +1,167 @@ +package io.teaql.core.value; + +import io.teaql.core.BaseEntity; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.checker.ObjectLocation; +import io.teaql.core.checker.WireLocationSegment; +import org.junit.Test; +import static org.junit.Assert.*; + +public class ExpressionLocationTest { + @Test public void literalPunctuationAndIndicesPreserveCanonicalIdentityInAllWireProfiles() throws Exception { + var trace = ExpressionTrace.root("E.node()").member("school_type", "getSchoolType") + .element(2, false).member("a~/b.c", "safeField"); + var canonical = ObjectLocation.hashRoot("school_type").element(2).member("a~/b.c"); + var expected = java.util.Map.of(JsonFieldNamingProfile.CAMEL_CASE, "/schoolType/2/a~0~1b.c", + JsonFieldNamingProfile.SNAKE_CASE, "/school_type/2/a~0~1b.c", + JsonFieldNamingProfile.PASCAL_CASE, "/SchoolType/2/A~0~1b.c"); + var labels = java.util.Map.of(JsonFieldNamingProfile.CAMEL_CASE, "camelCase", + JsonFieldNamingProfile.SNAKE_CASE, "snake_case", JsonFieldNamingProfile.PASCAL_CASE, "PascalCase"); + for (var profile : JsonFieldNamingProfile.values()) { + var wire = new TeaQLNotLoadedException("Row", canonical, "a~/b.c", profile) + .withAttempt(trace.operation("eval()")).toWire(); + assertEquals(expected.get(profile), wire.instancePath()); + assertEquals(expected.get(profile), wire.attemptedInstancePath()); + assertEquals(java.util.List.of(WireLocationSegment.property("school_type"), + WireLocationSegment.index(2), WireLocationSegment.property("a~/b.c")), wire.location()); + assertEquals(wire.location(), wire.attemptedLocation()); + assertEquals(wire.location(), wire.suggestedFix().location()); + assertEquals(2, wire.breakPointIndex()); + assertEquals("a~/b.c", wire.breakPoint()); + assertEquals("E.node().getSchoolType().get(2).safeField().eval()", wire.expressionWithBrokenPoint()); + String record = new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString( + java.util.Map.of("language", "java", "profile", labels.get(profile), "wire", wire)); + System.out.println("E_POINTER_PROFILE_CASE=" + record); + String output = System.getenv("TEAQL_POINTER_PROFILE_EVIDENCE"); + if (output != null) java.nio.file.Files.writeString(java.nio.file.Path.of(output), record + "\n", + java.nio.file.StandardOpenOption.CREATE, java.nio.file.StandardOpenOption.APPEND); + } + } + + static class Row extends BaseEntity { + Row child; + SmartList children = new SmartList<>(); + String text; + Row child(Row value) { child = value; markPropertyLoaded("school_type"); return this; } + } + + private Expression childText(Row row, JsonFieldNamingProfile profile) { + Expression root = new ValueExpression<>(row, profile); + var child = new LoadedPropertyExpression<>(root, "school_type", r -> r.child); + return new LoadedPropertyExpression<>(child, "user_url", r -> r.text); + } + + @Test public void canonicalIdentityNativeDisplayAndWirePointerAreSeparate() { + Row root = new Row().child(new Row()); + var error = assertThrows(TeaQLNotLoadedException.class, + () -> childText(root, JsonFieldNamingProfile.CAMEL_CASE).eval()); + assertEquals("school_type.user_url", error.getModelPath()); + assertEquals("schoolType.userUrl", error.getAccessPath()); + assertEquals("/schoolType/userUrl", error.getInstancePath()); + assertEquals(java.util.List.of(WireLocationSegment.property("school_type"), + WireLocationSegment.property("user_url")), error.toWire().location()); + assertEquals("NOT_LOADED", error.toWire().code()); + } + + @Test public void selectedWireProfileDoesNotChangeModelOrJavaNames() { + for (var profile : JsonFieldNamingProfile.values()) { + var expression = childText(new Row().child(new Row()), profile); + var error = assertThrows(TeaQLNotLoadedException.class, expression::eval); + assertEquals("school_type.user_url", error.getModelPath()); + assertEquals("schoolType.userUrl", error.getAccessPath()); + assertEquals(ObjectLocation.hashRoot("school_type").member("user_url").instancePath(profile), + error.getInstancePath()); + } + } + + @Test public void listElementAndFirstPreserveIndexRatherThanPretendingItIsAField() { + Row root = new Row(); root.markPropertyLoaded("order_items"); root.children.add(new Row()); + var list = new SmartListExpression<>(new LoadedPropertyExpression<>(new ValueExpression<>(root), + "order_items", r -> r.children)); + for (var item : java.util.List.of(list.first(), list.get(0))) { + var text = new LoadedPropertyExpression<>(item, "user_url", r -> r.text); + var error = assertThrows(TeaQLNotLoadedException.class, text::eval); + assertEquals("order_items[0].user_url", error.getModelPath()); + assertEquals("/orderItems/0/userUrl", error.getInstancePath()); + assertEquals("index", error.toWire().location().get(1).kind()); + } + assertNull(new LoadedPropertyExpression<>(list.get(1), "user_url", r -> r.text).eval()); + } + + @Test public void pointerEscapingDoesNotSplitLiteralMemberNames() { + var expression = new LoadedPropertyExpression<>(new ValueExpression<>(new Row()), "a~/b.c", r -> r.text); + var error = assertThrows(TeaQLNotLoadedException.class, expression::eval); + assertEquals("/a~0~1b.c", error.getInstancePath()); + assertEquals(1, error.getLocation().segments().size()); + } + + @Test public void loadedNullEmptyAndNotLoadedStayDifferentAndDoNotCreateLedgers() { + Row root = new Row().child(new Row()); + var expression = childText(root, JsonFieldNamingProfile.CAMEL_CASE); + assertThrows(TeaQLNotLoadedException.class, () -> expression.orIfNull("fallback")); + assertFalse(root.__internalHasMutationLedger()); + root.child.markPropertyLoaded("user_url"); + assertEquals("fallback", expression.orIfNull("fallback")); + root.child.text = ""; + assertEquals("", expression.orIfNull("fallback")); + assertFalse(root.child.__internalHasMutationLedger()); + } + + @Test public void wireJsonIsExplicitAndDoesNotExposeTheInternalRoot() throws Exception { + var expression = childText(new Row().child(new Row()), JsonFieldNamingProfile.SNAKE_CASE); + var error = assertThrows(TeaQLNotLoadedException.class, expression::eval); + var mapper = new com.fasterxml.jackson.databind.ObjectMapper(); + var wire = mapper.readTree(mapper.writeValueAsBytes(error.toWire())); + assertEquals("/school_type/user_url", wire.get("instancePath").asText()); + assertEquals("school_type", wire.get("location").get(0).get("name").asText()); + assertFalse(wire.has("root")); + assertFalse(wire.has("inputValue")); + assertFalse(wire.has("accessPath")); + assertFalse(wire.get("location").get(0).has("index")); + } + + @Test public void earlyMissingRelationRetainsTheFullExpressionAndOnePositionalBreakpoint() { + Row row = new Row(); + Expression root = new ValueExpression<>(row, JsonFieldNamingProfile.CAMEL_CASE, "E.row()"); + var parent = new LoadedPropertyExpression<>(root, "parent", r -> r.child); + var repeated = new LoadedPropertyExpression<>(parent, "parent", r -> r.child); + var leaf = new LoadedPropertyExpression<>(repeated, "user_url", r -> r.text); + var error = assertThrows(TeaQLNotLoadedException.class, leaf::eval); + var wire = error.toWire(); + assertEquals("/parent", wire.instancePath()); + assertEquals("/parent/parent/userUrl", wire.attemptedInstancePath()); + assertEquals("E.row().getParent().getParent().getUserUrl().eval()", wire.originalExpression()); + assertEquals("E.row().getParent().getParent().getUserUrl().eval()", wire.expressionWithBrokenPoint()); + assertEquals(0, wire.breakPointIndex()); + assertEquals(wire.location(), wire.suggestedFix().location()); + assertFalse(row.__internalHasMutationLedger()); + } + + @Test public void listFirstSizeAndFallbackOperationsAreReconstructedWithoutArgumentValues() { + Row row = new Row(); + var root = new ValueExpression<>(row, JsonFieldNamingProfile.SNAKE_CASE, "E.row()"); + var list = new SmartListExpression<>(new LoadedPropertyExpression<>(root, "order_items", r -> r.children)); + var first = new LoadedPropertyExpression<>(list.first(), "user_url", r -> r.text); + var missing = assertThrows(TeaQLNotLoadedException.class, () -> first.orIfNull("PRIVATE-FALLBACK")); + assertEquals("E.row().getOrderItems().first().getUserUrl().orIfNull()", missing.getExpressionWithBrokenPoint()); + assertEquals("/order_items/0/user_url", missing.toWire().attemptedInstancePath()); + assertFalse(missing.getMessage().contains("PRIVATE-FALLBACK")); + var size = assertThrows(TeaQLNotLoadedException.class, () -> list.size().eval()); + assertEquals("E.row().getOrderItems().size().eval()", size.getExpressionWithBrokenPoint()); + assertEquals("/order_items", size.toWire().attemptedInstancePath()); + var indexed = new LoadedPropertyExpression<>(list.get(12), "user_url", r -> r.text); + assertEquals("/order_items/12/user_url", assertThrows(TeaQLNotLoadedException.class, indexed::eval).toWire().attemptedInstancePath()); + } + + @Test public void explicitRootEvaluationRetainsTheTerminalWithoutExportingTheArgument() { + Row row = new Row(); + var root = new ValueExpression<>(row, JsonFieldNamingProfile.CAMEL_CASE, "E.row()"); + var child = new LoadedPropertyExpression<>(root, "school_type", r -> r.child); + var name = new LoadedPropertyExpression<>(child, "user_url", r -> r.text); + var error = assertThrows(TeaQLNotLoadedException.class, () -> name.eval(row)); + assertEquals("E.row().getSchoolType().getUserUrl().eval()", error.toWire().expressionWithBrokenPoint()); + assertEquals("/schoolType", error.getInstancePath()); + assertEquals("/schoolType/userUrl", error.toWire().attemptedInstancePath()); + } +} diff --git a/teaql-core/src/test/java/io/teaql/core/value/ExpressionTerminalTraceTest.java b/teaql-core/src/test/java/io/teaql/core/value/ExpressionTerminalTraceTest.java new file mode 100644 index 000000000..e32c9f48f --- /dev/null +++ b/teaql-core/src/test/java/io/teaql/core/value/ExpressionTerminalTraceTest.java @@ -0,0 +1,128 @@ +package io.teaql.core.value; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.BaseEntity; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Every public terminal must identify itself, not the helper it delegates to. */ +public class ExpressionTerminalTraceTest { + static class Row extends BaseEntity { String text; } + static final class PrivateRow extends Row { + int identityReads; + @Override public Long getId() { identityReads++; return 9823456789012345L; } + @Override public String toString() { throw new AssertionError("PRIVATE-ROOT-OBJECT"); } + } + static final class RootBox { + final Row row = new Row(); + int stringReads; + @Override public String toString() { stringReads++; return "PRIVATE-ROOT-OBJECT"; } + } + @FunctionalInterface interface Operation { + void run(Expression expression, AtomicInteger callbacks) throws Throwable; + } + record Terminal(String name, String suffix, Operation operation) { } + static List terminals() { + return List.of( + new Terminal("eval", "eval()", (e, c) -> e.eval()), + new Terminal("resolve", "resolve()", (e, c) -> e.resolve()), + new Terminal("orIfNull", "orIfNull()", (e, c) -> e.orIfNull("PRIVATE-TERMINAL-ARGUMENT")), + new Terminal("orElseThrow", "orElseThrow()", (e, c) -> e.orElseThrow()), + new Terminal("orElseThrowSupplier", "orElseThrow()", (e, c) -> e.orElseThrow(() -> { + c.incrementAndGet(); return new AssertionError("PRIVATE-TERMINAL-ARGUMENT"); + })), + new Terminal("isNull", "isNull()", (e, c) -> e.isNull()), + new Terminal("isNotNull", "isNotNull()", (e, c) -> e.isNotNull()), + new Terminal("isEmpty", "isEmpty()", (e, c) -> e.isEmpty()), + new Terminal("isNotEmpty", "isNotEmpty()", (e, c) -> e.isNotEmpty()), + new Terminal("whenIsNull", "whenIsNull()", (e, c) -> e.whenIsNull(c::incrementAndGet)), + new Terminal("whenIsNotNullRunnable", "whenIsNotNull()", (e, c) -> e.whenIsNotNull((Runnable) c::incrementAndGet)), + new Terminal("whenIsNotNullConsumer", "whenIsNotNull()", (e, c) -> e.whenIsNotNull((Consumer) v -> c.incrementAndGet())), + new Terminal("whenIsEmpty", "whenIsEmpty()", (e, c) -> e.whenIsEmpty(c::incrementAndGet)), + new Terminal("whenNotEmptyConsumer", "whenNotEmpty()", (e, c) -> e.whenNotEmpty((Consumer) v -> c.incrementAndGet())), + new Terminal("whenNotEmptyRunnable", "whenNotEmpty()", (e, c) -> e.whenNotEmpty((Runnable) c::incrementAndGet))); + } + private Expression expression(Row row, AtomicInteger reads) { + return new LoadedPropertyExpression<>(new ValueExpression<>(row, + io.teaql.core.checker.JsonFieldNamingProfile.CAMEL_CASE, "E.row()"), + "private_note", value -> { reads.incrementAndGet(); return value.text; }); + } + + @Test public void everyMissingTerminalRetainsItsOwnNativeCallAndNeverExecutesCallbacks() throws Exception { + var rows = new ArrayList>(); + var failures = new ArrayList(); + for (var terminal : terminals()) { + var row = new Row(); var callbacks = new AtomicInteger(); var reads = new AtomicInteger(); + var error = assertThrows(TeaQLNotLoadedException.class, () -> terminal.operation().run(expression(row, reads), callbacks)); + String expected = "E.row().getPrivateNote()." + terminal.suffix(); + boolean passed = expected.equals(error.getExpressionWithBrokenPoint()) + && callbacks.get() == 0 && reads.get() == 0 && !row.__internalHasMutationLedger() + && !error.getMessage().contains("PRIVATE-TERMINAL-ARGUMENT"); + if (!passed) failures.add(terminal.name()); + rows.add(Map.of("name", terminal.name(), "expected", expected, "wire", error.toWire(), + "human", error.getMessage(), "callbacks", callbacks.get(), "getterReads", reads.get(), + "mutationLedgerCreated", row.__internalHasMutationLedger(), "passed", passed)); + } + System.out.println("JAVA_NATIVE_E_TERMINALS=" + new ObjectMapper().writeValueAsString(Map.of( + "language", "java", "passed", failures.isEmpty(), "observations", rows, "failures", failures))); + assertTrue("Incorrect terminal reconstruction: " + failures, failures.isEmpty()); + } + + @Test public void loadedCallbacksReadTheValueOnceAndRetainNullAndEmptySemantics() throws Throwable { + for (String value : new String[] {null, "", "loaded"}) { + for (var terminal : terminals().stream().filter(v -> v.name().startsWith("when")).toList()) { + var row = new Row(); row.text = value; row.markPropertyLoaded("private_note"); + var reads = new AtomicInteger(); var callbacks = new AtomicInteger(); + terminal.operation().run(expression(row, reads), callbacks); + assertEquals(terminal.name(), 1, reads.get()); + boolean expected = switch (terminal.name()) { + case "whenIsNull" -> value == null; + case "whenIsNotNullRunnable", "whenIsNotNullConsumer" -> value != null; + case "whenIsEmpty" -> value == null || value.isEmpty(); + default -> value != null && !value.isEmpty(); + }; + assertEquals(terminal.name(), expected ? 1 : 0, callbacks.get()); + assertFalse(row.__internalHasMutationLedger()); + } + } + } + + @Test public void nullCallbacksStillValidateNotLoadedBeforeDoingNothing() { + var row = new Row(); var reads = new AtomicInteger(); var e = expression(row, reads); + for (var suffix : List.of("whenIsNull()", "whenIsNotNull()", "whenIsEmpty()", "whenNotEmpty()")) { + var error = assertThrows(TeaQLNotLoadedException.class, () -> { + switch (suffix) { + case "whenIsNull()" -> e.whenIsNull(null); + case "whenIsNotNull()" -> e.whenIsNotNull((Runnable) null); + case "whenIsEmpty()" -> e.whenIsEmpty(null); + default -> e.whenNotEmpty((Runnable) null); + } + }); + assertEquals("E.row().getPrivateNote()." + suffix, error.getExpressionWithBrokenPoint()); + } + assertEquals(0, reads.get()); assertFalse(row.__internalHasMutationLedger()); + } + + @Test public void diagnosticsUseTypeLabelsWithoutReadingIdentityOrRenderingRootObjects() throws Exception { + var row = new PrivateRow(); + var direct = assertThrows(TeaQLNotLoadedException.class, () -> expression(row, new AtomicInteger()).eval()); + var box = new RootBox(); + Expression parent = new ValueExpression<>(box).apply(value -> value.row); + var nested = new LoadedPropertyExpression<>(parent, "private_note", value -> value.text); + var indirect = assertThrows(TeaQLNotLoadedException.class, nested::eval); + boolean passed = "PrivateRow".equals(direct.getRoot()) && "RootBox".equals(indirect.getRoot()) + && row.identityReads == 0 && box.stringReads == 0 + && !direct.getMessage().contains("9823456789012345") + && !indirect.getMessage().contains("PRIVATE-ROOT-OBJECT"); + System.out.println("JAVA_NATIVE_E_ROOTS=" + new ObjectMapper().writeValueAsString(Map.of( + "passed", passed, "entityHuman", direct.getMessage(), "objectHuman", indirect.getMessage(), + "identityReads", row.identityReads, "rootStringReads", box.stringReads))); + assertTrue("Diagnostics must not inspect identity or stringify roots", passed); + assertFalse(row.__internalHasMutationLedger()); assertFalse(box.row.__internalHasMutationLedger()); + } +} diff --git a/teaql-data-service-sql/pom.xml b/teaql-data-service-sql/pom.xml index fc6a44ea6..2a486dbd4 100644 --- a/teaql-data-service-sql/pom.xml +++ b/teaql-data-service-sql/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlDataServiceExecutor.java b/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlDataServiceExecutor.java index d120e2eca..c2250e7cf 100644 --- a/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlDataServiceExecutor.java +++ b/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlDataServiceExecutor.java @@ -78,6 +78,11 @@ public T executeInTransaction(UserContext context, TransactionCallback ac @Override public Object transactionResource() { return executionAdapter; } + @Override public boolean registerTransactionSynchronization( + UserContext context, Runnable committed, Runnable rolledBack) { + return executionAdapter.registerTransactionSynchronization(committed, rolledBack); + } + @Override public void ensureSchema(UserContext context, io.teaql.core.SchemaExecutor.Invocation invocation) { io.teaql.core.SchemaExecutor.Invocation.requireContextOwned(invocation); @@ -153,13 +158,14 @@ public boolean supportsCompiledRowMapping() { @Override public java.util.stream.Stream queryForStream( io.teaql.core.UserContext context, String sql, Object[] args, io.teaql.core.CompiledRowMapper mapper, io.teaql.core.sql.portable.SqlLogBindings bindings) { - return observedQueryStream(context, sql, args, bindings, - () -> executionAdapter.queryForStream(sql, args, mapper)); + var effective = io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args); + return observedQueryStream(context, sql, effective, bindings, + () -> executionAdapter.queryForStream(sql, effective, mapper)); } @Override public java.util.List> query(String sql, Object[] args) { - return executionAdapter.queryForList(sql, args); + return executionAdapter.queryForList(sql, io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args)); } @Override public java.util.stream.Stream> queryForStream(io.teaql.core.UserContext context, String sql, Object[] args) { @@ -168,16 +174,17 @@ public java.util.stream.Stream> queryForStream(io. @Override public java.util.stream.Stream> queryForStream(io.teaql.core.UserContext context, String sql, Object[] args, io.teaql.core.sql.portable.SqlLogBindings bindings) { - return observedQueryStream(context, sql, args, bindings, - () -> executionAdapter.queryForStream(sql, args)); + var effective = io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args); + return observedQueryStream(context, sql, effective, bindings, + () -> executionAdapter.queryForStream(sql, effective)); } @Override public int executeUpdate(String sql, Object[] args) { - return executionAdapter.update(sql, args); + return executionAdapter.update(sql, io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args)); } @Override public int[] batchUpdate(String sql, java.util.List batchArgs) { - return executionAdapter.batchUpdate(sql, batchArgs); + return executionAdapter.batchUpdate(sql, io.teaql.core.sql.portable.SqlTemporalPrecision.batch(batchArgs)); } @Override public void execute(String sql) { @@ -200,8 +207,9 @@ public java.util.List> query(io.teaql.core.UserCon @Override public java.util.List> query(io.teaql.core.UserContext context, String sql, Object[] args, io.teaql.core.sql.portable.SqlLogBindings bindings) { - return observedStatement(context, sql, args, bindings, io.teaql.core.DataServiceOperation.QUERY, - () -> executionAdapter.queryForList(sql, args), (meta, result) -> meta.setResultCount(result.size())); + var effective = io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args); + return observedStatement(context, sql, effective, bindings, io.teaql.core.DataServiceOperation.QUERY, + () -> executionAdapter.queryForList(sql, effective), (meta, result) -> meta.setResultCount(result.size())); } @Override @@ -215,8 +223,9 @@ public java.util.List query( public java.util.List query( io.teaql.core.UserContext context, String sql, Object[] args, io.teaql.core.CompiledRowMapper rowMapper, io.teaql.core.sql.portable.SqlLogBindings bindings) { - return observedStatement(context, sql, args, bindings, io.teaql.core.DataServiceOperation.QUERY, - () -> executionAdapter.query(sql, args, rowMapper), (meta, result) -> meta.setResultCount(result.size())); + var effective = io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args); + return observedStatement(context, sql, effective, bindings, io.teaql.core.DataServiceOperation.QUERY, + () -> executionAdapter.query(sql, effective, rowMapper), (meta, result) -> meta.setResultCount(result.size())); } @Override @@ -227,8 +236,9 @@ public int executeUpdate(io.teaql.core.UserContext context, String sql, Object[] @Override public int executeUpdate(io.teaql.core.UserContext context, String sql, Object[] args, io.teaql.core.sql.portable.SqlLogBindings bindings) { - return observedStatement(context, sql, args, bindings, io.teaql.core.DataServiceOperation.MUTATION, - () -> executionAdapter.update(sql, args), (meta, result) -> meta.setAffectedRows(result.longValue())); + var effective = io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args); + return observedStatement(context, sql, effective, bindings, io.teaql.core.DataServiceOperation.MUTATION, + () -> executionAdapter.update(sql, effective), (meta, result) -> meta.setAffectedRows(result.longValue())); } @Override @@ -239,7 +249,8 @@ public int[] batchUpdate(io.teaql.core.UserContext context, String sql, java.uti @Override public int[] batchUpdate(io.teaql.core.UserContext context, String sql, java.util.List batchArgs, io.teaql.core.sql.portable.SqlLogBindings bindings) { - bindings.validateBatchSize(batchArgs == null ? 0 : batchArgs.size()); + var effective = io.teaql.core.sql.portable.SqlTemporalPrecision.batch(batchArgs); + bindings.validateBatchSize(effective == null ? 0 : effective.size()); var observation = io.teaql.core.SqlStatementObservation.startSafely(context, debugDatabaseKind, io.teaql.core.DataServiceOperation.MUTATION); boolean logging = context.isMutationExecutionLoggingEnabled(); @@ -247,10 +258,10 @@ public int[] batchUpdate(io.teaql.core.UserContext context, String sql, java.uti long start = collecting ? System.nanoTime() : 0L; int[] res; try { - res = executionAdapter.batchUpdate(sql, batchArgs); + res = executionAdapter.batchUpdate(sql, effective); } catch (RuntimeException failure) { try { - if (collecting) recordBatch(context, sql, batchArgs, bindings, start, batchCounts(failure), failure, + if (collecting) recordBatch(context, sql, effective, bindings, start, batchCounts(failure), failure, logging, observation.correlation()); } finally { observation.failure(failure); } throw failure; @@ -259,7 +270,7 @@ public int[] batchUpdate(io.teaql.core.UserContext context, String sql, java.uti throw failure; } try { - if (collecting) recordBatch(context, sql, batchArgs, bindings, start, + if (collecting) recordBatch(context, sql, effective, bindings, start, res == null ? null : java.util.Arrays.stream(res).asLongStream().toArray(), null, logging, observation.correlation()); } finally { observation.success(); } @@ -426,7 +437,7 @@ public static String debugSql( public static String debugSql(String sql, Object[] args, String databaseKind) { if (sql == null) return null; - Object[] parameters = args == null ? new Object[0] : args; + Object[] parameters = args == null ? new Object[0] : io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(args); try { return io.teaql.core.utils.SqlLogRenderer.render(sql, parameters.length, index -> io.teaql.core.utils.SqlLogRenderer.literal(parameters[index], databaseKind), diff --git a/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlExecutionAdapter.java b/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlExecutionAdapter.java index 708d9faf5..3d79fcc38 100644 --- a/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlExecutionAdapter.java +++ b/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlExecutionAdapter.java @@ -46,6 +46,9 @@ default void executeInTransaction(Runnable action) { } default boolean hasActiveTransaction() { return false; } + /** Provider-owned completion callbacks. Unsupported adapters must not claim registration. */ + default boolean registerTransactionSynchronization(Runnable committed, Runnable rolledBack) { return false; } + /** Opaque, non-reused instance token for held storage views; never a URL or transaction handle. */ default Object storageIdentity() { return null; } } diff --git a/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlNumericConversions.java b/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlNumericConversions.java new file mode 100644 index 000000000..a02c1f301 --- /dev/null +++ b/teaql-data-service-sql/src/main/java/io/teaql/dataservice/sql/SqlNumericConversions.java @@ -0,0 +1,71 @@ +package io.teaql.dataservice.sql; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Locale; + +/** Shared provider boundary, not a numeric rounding policy or application API. */ +public final class SqlNumericConversions { + private SqlNumericConversions() {} + + public static boolean supports(Class target) { + return target == Long.class || target == Integer.class || target == Short.class || target == Byte.class + || target == Float.class || target == Double.class || target == BigDecimal.class; + } + + public static Object convert(Class target, Number number) { + if (target == Double.class) { + double value = number.doubleValue(); + if (!Double.isFinite(value)) throw new ArithmeticException("Nonfinite JDBC Double"); + return number instanceof Double ? number : Double.valueOf(value); + } + if (target == Float.class) { + float value = number.floatValue(); + if (!Float.isFinite(value)) throw new ArithmeticException("Nonfinite JDBC Float"); + return number instanceof Float ? number : Float.valueOf(value); + } + if (target == BigDecimal.class) { + if (number instanceof BigDecimal) return number; + if (number instanceof BigInteger integer) return new BigDecimal(integer); + // Floating input is already approximate. Exact storage uses + // BigDecimal or text; this conversion cannot recover lost digits. + if (number instanceof Float || number instanceof Double) return BigDecimal.valueOf(number.doubleValue()); + if (integralCarrier(number)) return BigDecimal.valueOf(number.longValue()); + return new BigDecimal(number.toString()); + } + long value = exactLong(number); + if (target == Long.class) return value; + if (target == Integer.class) return Math.toIntExact(value); + if (target == Short.class && value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) return (short) value; + if (target == Byte.class && value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) return (byte) value; + throw new ArithmeticException("JDBC integral value outside target range"); + } + + /** Deliberately excludes the untrusted value and original exception cause. */ + public static IllegalArgumentException invalidColumn(int index, String label, Class target) { + String safe = label != null && label.matches("[A-Za-z_][A-Za-z0-9_]*") + ? " (" + label.toLowerCase(Locale.ROOT) + ")" : ""; + return new IllegalArgumentException("Invalid JDBC column " + index + safe + " as " + target.getName()); + } + + private static boolean integralCarrier(Number number) { + return number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long + || number instanceof java.util.concurrent.atomic.AtomicInteger || number instanceof java.util.concurrent.atomic.AtomicLong; + } + + private static long exactLong(Number number) { + if (integralCarrier(number)) return number.longValue(); + if (number instanceof BigInteger integer) return integer.longValueExact(); + if (number instanceof BigDecimal decimal) return decimal.longValueExact(); + if (number instanceof Float || number instanceof Double) { + double value = number.doubleValue(); + // 2^63 is exclusive: the double representation of Long.MAX_VALUE + // rounds there, so a Java saturating cast is not valid admission. + if (!Double.isFinite(value) || value != Math.rint(value) || value < -0x1.0p63 || value >= 0x1.0p63) { + throw new ArithmeticException("JDBC number is not an exact signed 64-bit integer"); + } + return (long) value; + } + return new BigDecimal(number.toString()).longValueExact(); + } +} diff --git a/teaql-data-service-sql/src/test/java/io/teaql/dataservice/sql/SqlTemporalPrecisionBridgeTest.java b/teaql-data-service-sql/src/test/java/io/teaql/dataservice/sql/SqlTemporalPrecisionBridgeTest.java new file mode 100644 index 000000000..93eecf7d5 --- /dev/null +++ b/teaql-data-service-sql/src/test/java/io/teaql/dataservice/sql/SqlTemporalPrecisionBridgeTest.java @@ -0,0 +1,136 @@ +package io.teaql.dataservice.sql; + +import io.teaql.core.*; +import io.teaql.core.meta.*; +import io.teaql.core.sql.portable.*; +import io.teaql.runtime.*; +import java.lang.reflect.*; +import java.time.*; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.stream.Stream; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Modeled SQL precision, not a change to native objects or JSON codecs. */ +public class SqlTemporalPrecisionBridgeTest { + private static final String SQL = "SELECT happened_at FROM temporal WHERE happened_at = ? LIMIT 1"; + private static final LocalDateTime INPUT = LocalDateTime.of(2026, 11, 10, 12, 34, 56, 123456789); + private static final LocalDateTime EXPECTED = INPUT.truncatedTo(ChronoUnit.MILLIS); + private static final SqlLogBindings BINDINGS = new SqlLogBindings(List.of(SqlParameterLogPolicy.PLAIN), true); + private final List logs = new ArrayList<>(); + private final DefaultUserContext context = new DefaultUserContext(TeaQLRuntime.builder() + .metadata(new SimpleEntityMetaFactory()) + .logSink((caller, value) -> logs.add(value)).build()); + + private TeaQLDatabase database(InvocationHandler handler) throws Exception { + var adapter = (SqlExecutionAdapter) Proxy.newProxyInstance(SqlExecutionAdapter.class.getClassLoader(), + new Class[]{SqlExecutionAdapter.class}, handler); + var factory = SqlDataServiceExecutor.class.getDeclaredMethod("createPortableService", EntityMetaFactory.class); + factory.setAccessible(true); + var service = factory.invoke(new SqlDataServiceExecutor("sql", adapter), new SimpleEntityMetaFactory()); + var field = PortableSQLDataService.class.getDeclaredField("database"); + field.setAccessible(true); + return (TeaQLDatabase) field.get(service); + } + + private TeaQLDatabase checking() throws Exception { + return database((proxy, method, args) -> { + if (method.getName().equals("supportsCompiledStreamMapping")) return true; + Object value = args[1]; + if (value instanceof List batch) { + assertEquals(EXPECTED, ((Object[]) batch.get(0))[0]); + return new int[]{1}; + } + assertEquals(EXPECTED, ((Object[]) value)[0]); + return switch (method.getName()) { + case "update" -> 1; + case "queryForStream" -> Stream.empty(); + default -> List.of(); + }; + }); + } + + private interface Call { void run(TeaQLDatabase db, Object[] args) throws Exception; } + private void check(Call call) throws Exception { + Object[] original = {INPUT}; + call.run(checking(), original); + assertSame(INPUT, original[0]); + assertEquals(123456789, INPUT.getNano()); + } + + @Test public void directQueryBindsMilliseconds() throws Exception { + check((db,args) -> db.query(SQL,args)); + } + @Test public void observedMapQueryBindsMillisecondsAndLogsEffectiveValues() throws Exception { + check((db,args) -> db.query(context,SQL,args,BINDINGS)); + assertEquals(EXPECTED, logs.get(0).getParameters().get(0)); + } + @Test public void observedCompiledQueryBindsMilliseconds() throws Exception { + check((db,args) -> db.query(context,SQL,args,row -> new BaseEntity(),BINDINGS)); + } + @Test public void mapStreamBindsMilliseconds() throws Exception { + check((db,args) -> { try (var stream=db.queryForStream(context,SQL,args,BINDINGS)) { assertEquals(0,stream.count()); } }); + } + @Test public void compiledStreamBindsMilliseconds() throws Exception { + check((db,args) -> { try (var stream=db.queryForStream(context,SQL,args,row -> new BaseEntity(),BINDINGS)) { assertEquals(0,stream.count()); } }); + } + @Test public void directUpdateBindsMilliseconds() throws Exception { + check((db,args) -> assertEquals(1,db.executeUpdate("UPDATE temporal SET happened_at = ?",args))); + } + @Test public void observedUpdateBindsMilliseconds() throws Exception { + check((db,args) -> assertEquals(1,db.executeUpdate(context,"UPDATE temporal SET happened_at = ?",args,BINDINGS))); + assertEquals(EXPECTED,logs.get(0).getParameters().get(0)); + } + @Test public void directBatchUsesDetachedMillisecondRows() throws Exception { + check((db,args) -> assertArrayEquals(new int[]{1},db.batchUpdate("UPDATE temporal SET happened_at = ?",Collections.singletonList(args)))); + } + @Test public void observedBatchUsesTheSameValuesForDriverAndLog() throws Exception { + check((db,args) -> assertArrayEquals(new int[]{1},db.batchUpdate(context,"UPDATE temporal SET happened_at = ?",Collections.singletonList(args),BINDINGS))); + assertEquals(EXPECTED,logs.get(0).getParameters().get(0)); + } + @Test public void alignedAndNullArgumentsKeepTheExistingFastPath() throws Exception { + Object[] aligned={EXPECTED,null,"unchanged",17L}; + var db=database((proxy,method,args) -> { assertSame(aligned,args[1]);return List.of(); }); + db.query(SQL,aligned); + } + @Test public void truncationDoesNotRoundAcrossASecondOrChangePreEpochWallTime() throws Exception { + for (var value:List.of(LocalDateTime.of(1960,2,29,23,59,59,999999999), + LocalDateTime.of(2024,3,10,2,30,0,999999),LocalDateTime.of(2026,12,31,23,59,59,999999999))) { + var db=database((proxy,method,args) -> { assertEquals(value.truncatedTo(ChronoUnit.MILLIS),((Object[])args[1])[0]);return List.of(); }); + Object[] original={value};db.query(SQL,original);assertSame(value,original[0]); + } + } + @Test public void failureRetainsTheDriverErrorAndCanonicalSqlMetadata() throws Exception { + var failure=new IllegalStateException("controlled driver failure"); + var db=database((proxy,method,args) -> { assertEquals(EXPECTED,((Object[])args[1])[0]);throw failure; }); + assertSame(failure,assertThrows(IllegalStateException.class,()->db.query(context,SQL,new Object[]{INPUT},BINDINGS))); + assertEquals(EXPECTED,logs.get(0).getParameters().get(0)); + } + private Object read(Object value) throws Exception { + var method=PortableSQLRepository.class.getDeclaredMethod("convertTemporalColumnValue",Class.class,Object.class); + method.setAccessible(true); + try { return method.invoke(null,LocalDateTime.class,value); } + catch (InvocationTargetException error) { + if (error.getCause() instanceof RuntimeException runtime) throw runtime; + throw error; + } + } + @Test public void nativeSqlDateTimeReadRejectsLegacyPrecisionWithoutMutatingTheNativeInput() throws Exception { + assertThrows(SqlTemporalPrecisionException.class,()->read(INPUT));assertEquals(123456789,INPUT.getNano()); + assertSame(EXPECTED,read(EXPECTED)); + } + @Test public void jdbcTimestampReadRejectsTheSameLegacyPrecision() throws Exception { + var timestamp=java.sql.Timestamp.valueOf(INPUT); + assertThrows(SqlTemporalPrecisionException.class,()->read(timestamp));assertEquals(123456789,timestamp.getNanos()); + assertEquals(EXPECTED,read(java.sql.Timestamp.valueOf(EXPECTED))); + } + @Test public void textualSqlFallbackReadRejectsTheSameLegacyPrecision() throws Exception { + assertThrows(SqlTemporalPrecisionException.class,()->read("2026-11-10 12:34:56.123456789")); + assertEquals(EXPECTED,read("2026-11-10 12:34:56.123")); + } + @Test public void copyPasteDebugSqlRepresentsTheEffectiveMillisecondBinding() { + assertEquals("SELECT '2026-11-10 12:34:56.123'",SqlDataServiceExecutor.debugSql("SELECT ?",new Object[]{INPUT})); + assertEquals(123456789,INPUT.getNano()); + } +} diff --git a/teaql-db2/pom.xml b/teaql-db2/pom.xml index d4886a65d..aa7bbe343 100644 --- a/teaql-db2/pom.xml +++ b/teaql-db2/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-db2 teaql-db2 diff --git a/teaql-dm8/pom.xml b/teaql-dm8/pom.xml index dcb69493d..ee93206d4 100644 --- a/teaql-dm8/pom.xml +++ b/teaql-dm8/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-dm8 teaql-dm8 diff --git a/teaql-duckdb/pom.xml b/teaql-duckdb/pom.xml index 8b6668522..28e403776 100644 --- a/teaql-duckdb/pom.xml +++ b/teaql-duckdb/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-duckdb teaql-duckdb diff --git a/teaql-duckdb/src/main/java/io/teaql/core/duck/DuckDataServiceExecutor.java b/teaql-duckdb/src/main/java/io/teaql/core/duck/DuckDataServiceExecutor.java index 573f5f55e..5f595b4ed 100644 --- a/teaql-duckdb/src/main/java/io/teaql/core/duck/DuckDataServiceExecutor.java +++ b/teaql-duckdb/src/main/java/io/teaql/core/duck/DuckDataServiceExecutor.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; +import java.util.Optional; public class DuckDataServiceExecutor extends SqlDataServiceExecutor { @@ -58,6 +59,18 @@ public List> getTableColumns(String tableName) { + "FROM information_schema.columns WHERE table_name = ?"; return getExecutionAdapter().queryForList(sql, new Object[] {tableName}); } + + @Override + public Optional indexExists( + UserContext context, String tableName, String indexName) { + List> rows = getExecutionAdapter().queryForList( + "SELECT 1 AS present FROM duckdb_indexes() " + + "WHERE database_name = current_database() " + + "AND schema_name = current_schema() " + + "AND table_name = ? AND index_name = ? LIMIT 1", + new Object[] {tableName, indexName}); + return Optional.of(!rows.isEmpty()); + } }; for (EntityDescriptor descriptor : descriptors) { diff --git a/teaql-duckdb/src/test/java/io/teaql/duckdb/DuckDbIntegrationTest.java b/teaql-duckdb/src/test/java/io/teaql/duckdb/DuckDbIntegrationTest.java index 00fae1538..bd98eea29 100644 --- a/teaql-duckdb/src/test/java/io/teaql/duckdb/DuckDbIntegrationTest.java +++ b/teaql-duckdb/src/test/java/io/teaql/duckdb/DuckDbIntegrationTest.java @@ -16,6 +16,7 @@ import io.teaql.core.duck.DuckDataServiceExecutor; import io.teaql.core.meta.SimpleEntityMetaFactory; import io.teaql.core.sql.GenericSQLProperty; +import io.teaql.core.sql.GenericSQLRelation; import io.teaql.core.sql.SQLEntityDescriptor; import io.teaql.provider.jdbc.JdbcSqlExecutor; import io.teaql.runtime.DefaultUserContext; @@ -31,6 +32,9 @@ import java.sql.SQLFeatureNotSupportedException; import java.sql.Statement; import java.util.UUID; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Logger; import javax.sql.DataSource; @@ -303,4 +307,92 @@ private static void assertSchemaFailure(String expectedMessage) { assertTrue(error.getMessage(), error.getMessage().contains("Task")); assertTrue(error.getMessage(), error.getMessage().contains("task_data")); } + + public static class CatalogParent extends BaseEntity { + @Override public String typeName() { return "CatalogParent"; } + } + + public static class CatalogChild extends BaseEntity { + @Override public String typeName() { return "CatalogChild"; } + } + + @Test + public void relationIndexesAreIdempotentAndUseInvokingContextMetadata() { + UserContext first = relationContext(sql, "catalog_alpha"); + UserContext second = relationContext(sql, "catalog_beta"); + first.ensureSchema(); + first.ensureSchema(); + assertEquals(1, sql.queryForList( + "SELECT index_name FROM duckdb_indexes() WHERE table_name = ?", + new Object[] {"catalog_alpha_child_data"}).size()); + assertTrue(sql.queryForList( + "SELECT table_name FROM information_schema.tables WHERE table_name = ?", + new Object[] {"catalog_beta_child_data"}).isEmpty()); + second.ensureSchema(); + second.ensureSchema(); + assertEquals(1, sql.queryForList( + "SELECT index_name FROM duckdb_indexes() WHERE table_name = ?", + new Object[] {"catalog_beta_child_data"}).size()); + } + + @Test + public void relationIndexInspectionFailureIsNotTreatedAsAbsence() { + relationContext(sql, "catalog_failure").ensureSchema(); + IllegalStateException injected = new IllegalStateException("index metadata unavailable"); + AtomicInteger writes = new AtomicInteger(); + JdbcSqlExecutor failing = new JdbcSqlExecutor(new DriverManagerDataSource(url)) { + @Override public List> queryForList(String statement, Object[] args) { + if (statement.contains("duckdb_indexes()")) throw injected; + return super.queryForList(statement, args); + } + @Override public void execute(String statement) { + writes.incrementAndGet(); + super.execute(statement); + } + }; + IllegalStateException error = org.junit.Assert.assertThrows( + IllegalStateException.class, + () -> relationContext(failing, "catalog_failure").ensureSchema()); + assertTrue(error.getMessage(), error.getMessage().contains("inspect canonical relation index")); + assertSame(injected, error.getCause()); + assertEquals("metadata failure must not trigger speculative DDL", 0, writes.get()); + } + + private static UserContext relationContext(JdbcSqlExecutor executor, String tablePrefix) { + SimpleEntityMetaFactory metadata = new SimpleEntityMetaFactory(); + SQLEntityDescriptor parent = new SQLEntityDescriptor(); + parent.setType("CatalogParent"); + parent.setTargetType(CatalogParent.class); + parent.setEntitySupplier(CatalogParent::new); + parent.setDataService("duckdb"); + parent.with("table_name", tablePrefix + "_parent_data"); + for (String field : List.of("id", "version")) { + GenericSQLProperty property = (GenericSQLProperty) parent.addSimpleProperty(field, Long.class); + property.setColumnType("BIGINT"); + property.setTableName(tablePrefix + "_parent_data"); + } + metadata.register(parent); + + SQLEntityDescriptor child = new SQLEntityDescriptor(); + child.setType("CatalogChild"); + child.setTargetType(CatalogChild.class); + child.setEntitySupplier(CatalogChild::new); + child.setDataService("duckdb"); + child.with("table_name", tablePrefix + "_child_data"); + for (String field : List.of("id", "version")) { + GenericSQLProperty property = (GenericSQLProperty) child.addSimpleProperty(field, Long.class); + property.setColumnType("BIGINT"); + property.setTableName(tablePrefix + "_child_data"); + } + GenericSQLRelation relation = (GenericSQLRelation) child.addObjectProperty( + metadata, "parent", "CatalogParent", "children", CatalogParent.class, + GenericSQLRelation::new); + relation.setTableName(tablePrefix + "_child_data"); + relation.setColumnName("parent"); + relation.setColumnType("BIGINT"); + metadata.register(child); + return new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata) + .dataService("duckdb", new DuckDataServiceExecutor("duckdb", executor)) + .idGenerationService((ignored, entity) -> 1L).build()); + } } diff --git a/teaql-dynamic-fields-api/pom.xml b/teaql-dynamic-fields-api/pom.xml index 0bb67d3b5..9851fb8b1 100644 --- a/teaql-dynamic-fields-api/pom.xml +++ b/teaql-dynamic-fields-api/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-dynamic-fields-jdbc/pom.xml b/teaql-dynamic-fields-jdbc/pom.xml index 0360a556a..a4446c3fb 100644 --- a/teaql-dynamic-fields-jdbc/pom.xml +++ b/teaql-dynamic-fields-jdbc/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-hana/pom.xml b/teaql-hana/pom.xml index 0b2e6465c..7917f6d06 100644 --- a/teaql-hana/pom.xml +++ b/teaql-hana/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-hana teaql-hana diff --git a/teaql-jackson/pom.xml b/teaql-jackson/pom.xml index 27cfceb21..3f4a5087d 100644 --- a/teaql-jackson/pom.xml +++ b/teaql-jackson/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-jackson @@ -32,6 +32,11 @@ junit test + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + test + diff --git a/teaql-jackson/src/main/java/io/teaql/jackson/BaseEntityJsonSerializer.java b/teaql-jackson/src/main/java/io/teaql/jackson/BaseEntityJsonSerializer.java index 3c47b3820..ff5da066c 100644 --- a/teaql-jackson/src/main/java/io/teaql/jackson/BaseEntityJsonSerializer.java +++ b/teaql-jackson/src/main/java/io/teaql/jackson/BaseEntityJsonSerializer.java @@ -23,11 +23,13 @@ public void serialize(BaseEntity value, JsonGenerator gen, SerializerProvider se boolean added = path.add(value); try { gen.writeStartObject(); + var state = value.__internalLoadState(); + var layout = state.layout(); if (value.getId() != null) { - serializers.defaultSerializeField(BaseEntity.ID_PROPERTY, value.getId(), gen); + ModelScalarJson.writeField(value, layout.isGenerated() ? layout.jsonFieldName(BaseEntity.ID_PROPERTY) : BaseEntity.ID_PROPERTY, value.getId(), gen, serializers); } if (value.getVersion() != null) { - serializers.defaultSerializeField(BaseEntity.VERSION_PROPERTY, value.getVersion(), gen); + ModelScalarJson.writeField(value, layout.isGenerated() ? layout.jsonFieldName(BaseEntity.VERSION_PROPERTY) : BaseEntity.VERSION_PROPERTY, value.getVersion(), gen, serializers); } // A cycle retains the existing identity-only reference shape, without // recursively reserializing the same object's business fields. @@ -35,16 +37,16 @@ public void serialize(BaseEntity value, JsonGenerator gen, SerializerProvider se gen.writeEndObject(); return; } - var state = value.__internalLoadState(); - var layout = state.layout(); if (layout.isGenerated()) { for (String field : layout.indexes().keySet()) { if (BaseEntity.ID_PROPERTY.equals(field) || BaseEntity.VERSION_PROPERTY.equals(field)) continue; if (!state.isLoaded(field)) continue; - String member = layout.memberName(field); + String member = layout.jsonFieldName(field); // Preserve this provider's graph path, configured serializers // and per-call attributes during nested serialization. - serializers.defaultSerializeField(member, value.__internalGet(member), gen); + // The selected wire spelling is not the native/member or model key used by + // generated entity access and the mutation ledger. + ModelScalarJson.writeField(value, member, value.__internalGet(field), gen, serializers); } for (String relation : layout.relationNames()) { if (layout.findIndex(relation) != null) continue; @@ -54,13 +56,13 @@ public void serialize(BaseEntity value, JsonGenerator gen, SerializerProvider se boolean pending = children instanceof io.teaql.core.SmartList list && list.stream().anyMatch(child -> child instanceof io.teaql.core.Entity entity && entity.needPersist()); if (!state.isLoaded(relation) && !pending) continue; - serializers.defaultSerializeField(relation, children, gen); + ModelScalarJson.writeField(value, layout.jsonFieldName(relation), children, gen, serializers); } } for (Map.Entry entry : value.getAdditionalInfo().entrySet()) { if (BaseEntity.ID_PROPERTY.equals(entry.getKey()) || BaseEntity.VERSION_PROPERTY.equals(entry.getKey()) || layout.findIndex(entry.getKey()) != null - || layout.relationNames().contains(entry.getKey())) continue; + || layout.canonicalRelationName(entry.getKey()) != null) continue; serializers.defaultSerializeField(entry.getKey(), entry.getValue(), gen); } gen.writeEndObject(); diff --git a/teaql-jackson/src/main/java/io/teaql/jackson/ModelScalarJson.java b/teaql-jackson/src/main/java/io/teaql/jackson/ModelScalarJson.java new file mode 100644 index 000000000..d4cba245e --- /dev/null +++ b/teaql-jackson/src/main/java/io/teaql/jackson/ModelScalarJson.java @@ -0,0 +1,133 @@ +package io.teaql.jackson; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import java.io.IOException; +import java.math.BigDecimal; + +/** Logical scalar wire rules, local to model entities; never global mapper coercion. */ +final class ModelScalarJson { + private static final long SAFE_INTEGER = 9_007_199_254_740_991L; + private static final JsonNodeFactory NODES = JsonNodeFactory.withExactBigDecimals(true); + private ModelScalarJson() {} + + static boolean supports(Class type) { + return type == String.class || type == Boolean.class || type == boolean.class + || type == Integer.class || type == int.class || type == Long.class || type == long.class + || type == BigDecimal.class || type == Float.class || type == float.class + || type == Double.class || type == double.class || ModelTemporalJson.supports(type); + } + + static Object read(JsonNode node, Class type, Object owner, String field) throws JsonMappingException { + if (node.isNull() && !type.isPrimitive()) return null; + if (ModelTemporalJson.supports(type)) return ModelTemporalJson.read(node, type, owner, field); + if (type == String.class && node.isTextual()) return node.textValue(); + if ((type == Boolean.class || type == boolean.class) && node.isBoolean()) return node.booleanValue(); + if ((type == Integer.class || type == int.class) && node.isIntegralNumber() && node.canConvertToInt()) return node.intValue(); + if (type == Long.class || type == long.class) { + if (node.isIntegralNumber() && node.canConvertToLong()) { + long value = node.longValue(); + if (value >= -SAFE_INTEGER && value <= SAFE_INTEGER) return value; + } + if (node.isTextual() && canonicalInteger(node.textValue())) { + try { return Long.parseLong(node.textValue()); } catch (NumberFormatException ignored) { /* reject below */ } + } + } + if (type == BigDecimal.class && node.isTextual()) { + try { return new BigDecimal(node.textValue()); } catch (NumberFormatException ignored) { /* reject below */ } + } + if ((type == Float.class || type == float.class) && node.isNumber()) { + float value = node.floatValue(); + if (Float.isFinite(value) && (value != 0 || node.decimalValue().signum() == 0)) return value; + } + if ((type == Double.class || type == double.class) && node.isNumber()) { + double value = node.doubleValue(); + if (Double.isFinite(value) && (value != 0 || node.decimalValue().signum() == 0)) return value; + } + throw invalid(owner, field, type.getSimpleName()); + } + + static void writeField(Object owner, String field, Object value, JsonGenerator output, SerializerProvider provider) throws IOException { + if (value instanceof Long || value instanceof BigDecimal) { + // BigDecimal.toString retains exact value and scale, including a + // negative scale, without expanding attacker-sized exponents. + output.writeStringField(field, value.toString()); + } else if (value != null && ModelTemporalJson.supports(value.getClass())) { + ModelTemporalJson.writeField(owner, field, value, output); + } else { + if ((value instanceof Float floatValue && !Float.isFinite(floatValue)) + || (value instanceof Double doubleValue && !Double.isFinite(doubleValue))) { + throw invalid(owner, field, "finite floating-point number"); + } + try { provider.defaultSerializeField(field, value, output); } + catch (JsonMappingException error) { error.prependPath(owner, field); throw error; } + } + } + + static JsonMappingException invalid(Object owner, String field, String expected) { + // A source-less diagnostic cannot copy private input values from the + // parser's source reference; the wire field remains structured in path. + var error = JsonMappingException.from((JsonParser) null, "Invalid model scalar; expected " + expected); + error.prependPath(owner, field); + return error; + } + + private static boolean canonicalInteger(String value) { + int start = !value.isEmpty() && value.charAt(0) == '-' ? 1 : 0; + if (start == value.length() || (value.charAt(start) == '0' && start + 1 < value.length())) return false; + for (int index = start; index < value.length(); index++) { + char digit = value.charAt(index); + if (digit < '0' || digit > '9') return false; + } + return true; + } + + /** Preserve numeric tokens before narrowing, without changing reader/mapper flags. */ + static JsonNode readTree(JsonParser parser) throws IOException { + JsonToken token = parser.currentToken(); + if (token == null) token = parser.nextToken(); + if (token == null) throw JsonMappingException.from((JsonParser) null, "Expected a model JSON value"); + return switch (token) { + case START_OBJECT -> { + var object = NODES.objectNode(); + while (parser.nextToken() != JsonToken.END_OBJECT) { + if (parser.currentToken() != JsonToken.FIELD_NAME) throw JsonMappingException.from((JsonParser) null, "Expected a model JSON field"); + String name = parser.currentName(); parser.nextToken(); object.set(name, readTree(parser)); + } + yield object; + } + case START_ARRAY -> { + var array = NODES.arrayNode(); + while (parser.nextToken() != JsonToken.END_ARRAY) array.add(readTree(parser)); + yield array; + } + case VALUE_NUMBER_INT -> switch (parser.getNumberType()) { + case INT -> NODES.numberNode(parser.getIntValue()); + case LONG -> NODES.numberNode(parser.getLongValue()); + default -> NODES.numberNode(parser.getBigIntegerValue()); + }; + case VALUE_NUMBER_FLOAT -> { + String literal = parser.getText(); + try { + var decimal = new BigDecimal(literal); + // Decimal parsing intentionally has no signed zero; native + // Float/Double do. Preserve it before selecting a scalar type. + yield decimal.signum() == 0 && literal.startsWith("-") ? NODES.numberNode(-0.0d) : NODES.numberNode(decimal); + } catch (NumberFormatException invalid) { + if (parser.isNaN()) yield NODES.numberNode(parser.getDoubleValue()); + throw JsonMappingException.from((JsonParser) null, "Unrepresentable model JSON number"); + } + } + case VALUE_STRING -> NODES.textNode(parser.getText()); + case VALUE_TRUE -> NODES.booleanNode(true); + case VALUE_FALSE -> NODES.booleanNode(false); + case VALUE_NULL -> NODES.nullNode(); + default -> throw JsonMappingException.from((JsonParser) null, "Unsupported model JSON token"); + }; + } +} diff --git a/teaql-jackson/src/main/java/io/teaql/jackson/ModelTemporalJson.java b/teaql-jackson/src/main/java/io/teaql/jackson/ModelTemporalJson.java new file mode 100644 index 000000000..e3b8b1a2e --- /dev/null +++ b/teaql-jackson/src/main/java/io/teaql/jackson/ModelTemporalJson.java @@ -0,0 +1,66 @@ +package io.teaql.jackson; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import java.io.IOException; +import java.time.DateTimeException; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** Passive temporal values: no clock, implicit zone, provider or mapper-wide settings. */ +final class ModelTemporalJson { + private ModelTemporalJson() {} + + static boolean supports(Class type) { + return type == LocalDate.class || type == LocalTime.class + || type == LocalDateTime.class || type == Instant.class; + } + + static Object read(JsonNode node, Class type, Object owner, String field) throws JsonMappingException { + if (node.isTextual()) { + try { + String text = node.textValue(); + if (type == LocalDate.class) return LocalDate.parse(text, DateTimeFormatter.ISO_LOCAL_DATE); + if (type == LocalTime.class) return LocalTime.parse(text, DateTimeFormatter.ISO_LOCAL_TIME); + // A wall date-time has no offset or zone. Never route it through + // an instant parser or mapper-wide date/time coercion settings. + if (type == LocalDateTime.class) return LocalDateTime.parse(text, DateTimeFormatter.ISO_LOCAL_DATE_TIME); + // Parsing an offset date-time (not Instant.parse) rejects leap + // seconds rather than silently normalizing second 60 to 59. + Instant instant = OffsetDateTime.parse(text, DateTimeFormatter.ISO_OFFSET_DATE_TIME).toInstant(); + requireMillis(instant); + return instant; + } catch (DateTimeException | ArithmeticException invalid) { + // Do not attach the parse exception: its message contains input. + } + } + throw ModelScalarJson.invalid(owner, field, type == Instant.class ? "offset Timestamp at millisecond precision" : type.getSimpleName() + " ISO string"); + } + + static void writeField(Object owner, String field, Object value, JsonGenerator output) throws IOException { + String wire; + try { + if (value instanceof LocalDate date) wire = DateTimeFormatter.ISO_LOCAL_DATE.format(date); + else if (value instanceof LocalTime time) wire = DateTimeFormatter.ISO_LOCAL_TIME.format(time); + else if (value instanceof LocalDateTime dateTime) wire = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(dateTime); + else { + Instant instant = (Instant) value; + requireMillis(instant); + wire = instant.toString(); + } + } catch (DateTimeException | ArithmeticException invalid) { + throw ModelScalarJson.invalid(owner, field, "representable temporal value without precision loss"); + } + output.writeStringField(field, wire); + } + + private static void requireMillis(Instant instant) { + if (instant.getNano() % 1_000_000 != 0) throw new DateTimeException("Timestamp precision exceeds milliseconds"); + instant.toEpochMilli(); // Refuse instants outside the signed epoch-millisecond carrier. + } +} diff --git a/teaql-jackson/src/main/java/io/teaql/jackson/TypedEntityJsonDeserializer.java b/teaql-jackson/src/main/java/io/teaql/jackson/TypedEntityJsonDeserializer.java index e770f1faa..ca25ba4a8 100644 --- a/teaql-jackson/src/main/java/io/teaql/jackson/TypedEntityJsonDeserializer.java +++ b/teaql-jackson/src/main/java/io/teaql/jackson/TypedEntityJsonDeserializer.java @@ -3,9 +3,11 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import io.teaql.core.BaseEntity; import io.teaql.core.Entity; +import io.teaql.core.EntityStatus; import io.teaql.core.FieldLayout; import io.teaql.core.LoadState; import io.teaql.core.SmartList; @@ -65,12 +67,20 @@ private record Binding(String member, Class type, int index, Class members = new ArrayList<>(); var names = node.fieldNames(); @@ -121,18 +131,40 @@ private Binding binding(String name) { } Binding binding = binding(name); Object converted; - if (binding.element() != null && !value.isNull()) { - if (!value.isArray()) return context.reportInputMismatch(target, "Expected relation array: %s", name); - List children = new ArrayList<>(value.size()); - for (JsonNode child : value) { - if (child.isNull()) return context.reportInputMismatch(target, "Null relation-list element: %s", name); - children.add(parser.getCodec().treeToValue(child, binding.element())); + if (binding.element() != null) { + if (value.isNull()) converted = null; + else { + if (!value.isArray()) return context.reportInputMismatch(target, "Expected relation array: %s", name); + List children = new ArrayList<>(value.size()); + for (JsonNode child : value) { + if (child.isNull()) return context.reportInputMismatch(target, "Null relation-list element: %s", name); + try { children.add(parser.getCodec().treeToValue(child, binding.element())); } + catch (JsonMappingException error) { + error.prependPath(children, children.size()); error.prependPath(target, name); throw error; + } + } + converted = SmartList.takeOwnership(children); } - converted = SmartList.takeOwnership(children); - } else converted = parser.getCodec().treeToValue(value, binding.type()); + } else if (ModelScalarJson.supports(binding.type())) converted = ModelScalarJson.read(value, binding.type(), target, name); + else { + try { converted = parser.getCodec().treeToValue(value, binding.type()); } + catch (JsonMappingException error) { error.prependPath(target, name); throw error; } + } if (binding.index() >= 0) entity.__internalHydrate(binding.member(), converted, binding.index()); else entity.__internalSet(binding.member(), converted); } + // Persistence state is derived from the hydrated identity, never accepted + // as wire metadata or invented as mutation intent. Hydrate all members + // first so JSON order cannot change the lifecycle or original version. + if (entity.getId() != null && entity.getVersion() != null && entity.getVersion() != 0) { + entity.set$status(entity.getVersion() > 0 ? EntityStatus.PERSISTED : EntityStatus.PERSISTED_DELETED); + } else if (entity.getId() != null && entity.getVersion() == null + && members.stream().allMatch(name -> BaseEntity.ID_PROPERTY.equals(name) || BaseEntity.VERSION_PROPERTY.equals(name))) { + // Native FK stubs carry identity but no editable snapshot/version. + // Retain that reference-only contract across JSON without loading + // target details, validating them as a new entity, or permitting edits. + entity.set$status(EntityStatus.REFER); + } return entity; } } diff --git a/teaql-jackson/src/test/java/io/teaql/jackson/BaseEntitySerializationTest.java b/teaql-jackson/src/test/java/io/teaql/jackson/BaseEntitySerializationTest.java index 57e7d9dcb..484156efd 100644 --- a/teaql-jackson/src/test/java/io/teaql/jackson/BaseEntitySerializationTest.java +++ b/teaql-jackson/src/test/java/io/teaql/jackson/BaseEntitySerializationTest.java @@ -17,19 +17,19 @@ static final class NamedRelationsEntity extends BaseEntity { java.util.Map.of("id", 0, "version", 1), java.util.Map.of("id", java.util.List.of("id", "id"), "version", java.util.List.of("version", "version")), - java.util.Set.of("childList", "child"))); + java.util.Set.of("child_list", "child"))); io.teaql.core.SmartList childList; BaseEntity child; @Override public void __internalSet(String field, Object value) { switch (field) { - case "childList" -> { markPropertyLoaded(field); childList = (io.teaql.core.SmartList) value; } + case "child_list" -> { markPropertyLoaded(field); childList = (io.teaql.core.SmartList) value; } case "child" -> { markPropertyLoaded(field); child = (BaseEntity) value; } default -> super.__internalSet(field, value); } } @Override public Object __internalGet(String field) { return switch (field) { - case "childList" -> childList; + case "child_list" -> childList; case "child" -> child; default -> super.__internalGet(field); }; @@ -40,7 +40,7 @@ static final class NamedRelationsEntity extends BaseEntity { var parent = new NamedRelationsEntity(); parent.__internalSet("id", 1L); parent.__internalSet("version", 1L); var child = new JsonGraphEntity(); child.__internalSet("id", 1L); child.__internalSet("version", 1L); child.__internalSet("name", "same ID different type"); var list = new io.teaql.core.SmartList(); list.add(child); - parent.__internalSet("childList", list); + parent.__internalSet("child_list", list); parent.__internalSet("child", null); parent.putAdditional("childList", "must not replace the declared relation"); parent.addDynamicProperty("childList", "readonly summary"); @@ -54,7 +54,7 @@ static final class NamedRelationsEntity extends BaseEntity { assertTrue(state == parent.__internalLoadState()); assertEquals(hadLedger, parent.__internalHasMutationLedger()); assertNull(NamedRelationsEntity.LAYOUT.findIndex("childList")); - var empty = new NamedRelationsEntity(); empty.__internalSet("childList", new io.teaql.core.SmartList()); + var empty = new NamedRelationsEntity(); empty.__internalSet("child_list", new io.teaql.core.SmartList()); json = mapper.readTree(mapper.writeValueAsString(empty)); assertTrue(json.get("childList").isArray()); assertEquals(0, json.get("childList").size()); assertFalse(json.has("child")); @@ -183,12 +183,12 @@ public static class IndexedEntity extends BaseEntity { markPropertyLoaded(field); switch (field) { case "name" -> name = (String) value; - case "baseUrl" -> baseUrl = (String) value; + case "base_url" -> baseUrl = (String) value; default -> super.__internalSet(field, value); } } @Override public Object __internalGet(String field) { - return switch (field) { case "name" -> name; case "baseUrl" -> baseUrl; default -> super.__internalGet(field); }; + return switch (field) { case "name" -> name; case "base_url" -> baseUrl; default -> super.__internalGet(field); }; } } @@ -214,12 +214,27 @@ public void indexedFixedDerivedAndPersistentNamespacesSurviveWithoutBeanReflecti assertTrue(json.get("_nil").isNull()); assertTrue(json.get("#nil").isNull()); assertFalse(json.has("#missing")); assertFalse(json.has("baseUrl")); assertFalse(json.has("loadState")); assertFalse(json.has("entityMutationLedger")); - entity.__internalSet("baseUrl", null); + entity.__internalSet("base_url", null); json = mapper.readTree(mapper.writeValueAsString(entity)); assertTrue(json.has("baseUrl")); assertTrue(json.get("baseUrl").isNull()); assertFalse(json.has("base_url")); assertFalse(json.has("legacy_url")); } + @Test + public void nativeJsonNamesDoNotBecomeInternalModelKeys() throws Exception { + var entity = new IndexedEntity(); + entity.__internalSet("base_url", "https://example.test"); + var state = entity.__internalLoadState(); + var mapper = new ObjectMapper().registerModule(TeaQLModule.INSTANCE); + var json = mapper.readTree(mapper.writeValueAsString(entity)); + assertEquals("https://example.test", json.get("baseUrl").asText()); + assertFalse(json.has("base_url")); + assertFalse(json.has("legacy_url")); + assertFalse(json.has("name")); + assertTrue(state == entity.__internalLoadState()); + assertFalse(entity.__internalHasMutationLedger()); + } + public static class NamedEntity extends BaseEntity { private String name; diff --git a/teaql-jackson/src/test/java/io/teaql/jackson/JsonFieldProfileTest.java b/teaql-jackson/src/test/java/io/teaql/jackson/JsonFieldProfileTest.java new file mode 100644 index 000000000..8b360ceb1 --- /dev/null +++ b/teaql-jackson/src/test/java/io/teaql/jackson/JsonFieldProfileTest.java @@ -0,0 +1,142 @@ +package io.teaql.jackson; + +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.meta.*; +import io.teaql.runtime.*; +import java.lang.reflect.InvocationTargetException; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.*; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import static org.junit.Assert.*; + +/** Old-runtime fallback is test-only: the baseline still compiles and exposes wrong wire behavior. */ +@RunWith(Parameterized.class) +public class JsonFieldProfileTest { + @Parameterized.Parameters(name = "{0}") public static Collection profiles() { + return List.of(new Object[]{JsonFieldNamingProfile.CAMEL_CASE}, new Object[]{JsonFieldNamingProfile.SNAKE_CASE}, new Object[]{JsonFieldNamingProfile.PASCAL_CASE}); + } + private final JsonFieldNamingProfile profile; + public JsonFieldProfileTest(JsonFieldNamingProfile profile) { this.profile = profile; } + static FieldLayout layout(Class type, JsonFieldNamingProfile profile) { + var indexes = Map.of("id", 0, "version", 1, "base_url", 2, "other_name", 3); + var mappings = Map.of("id", List.of("id", "id"), "version", List.of("version", "version"), + "base_url", List.of("baseUrl", "private_storage_column"), "other_name", List.of("otherName", "other_name")); + var relations = Set.of("child_row", "child_list"); + try { + return FieldLayout.installGenerated((FieldLayout) FieldLayout.class.getMethod("generated", Class.class, String.class, + Map.class, Map.class, Set.class, JsonFieldNamingProfile.class, Map.class) + .invoke(null, type, "wire-v1", indexes, mappings, relations, profile, Map.of("legacy_url", "base_url"))); + } catch (NoSuchMethodException baseline) { + return FieldLayout.installGenerated(FieldLayout.generated(type, "wire-v1", indexes, mappings, relations)); + } catch (ReflectiveOperationException error) { + throw new AssertionError(error instanceof InvocationTargetException invocation ? invocation.getCause() : error); + } + } + public abstract static class Row extends BaseEntity { + String baseUrl, otherName; + Row child; + SmartList children; + @Override public String typeName() { return "ProfileRow"; } + @Override public Object __internalGet(String name) { + return switch (name) { + case "base_url" -> baseUrl; case "other_name" -> otherName; + case "child_row" -> child; case "child_list" -> children; + default -> super.__internalGet(name); + }; + } + @Override public void __internalSet(String name, Object value) { + markPropertyLoaded(name); + switch (name) { + case "base_url" -> baseUrl = (String) value; case "other_name" -> otherName = (String) value; + case "child_row" -> child = (Row) value; case "child_list" -> children = (SmartList) value; + default -> super.__internalSet(name, value); + } + } + } + public static final class CamelRow extends Row { static final FieldLayout LAYOUT = layout(CamelRow.class, JsonFieldNamingProfile.CAMEL_CASE); } + public static final class SnakeRow extends Row { static final FieldLayout LAYOUT = layout(SnakeRow.class, JsonFieldNamingProfile.SNAKE_CASE); } + public static final class PascalRow extends Row { static final FieldLayout LAYOUT = layout(PascalRow.class, JsonFieldNamingProfile.PASCAL_CASE); } + static final class Fixture { + final AtomicInteger constructed = new AtomicInteger(); + final ObjectMapper mapper; + final Class type; + Fixture(JsonFieldNamingProfile profile) { + // Initialize generated metadata before constructing the first row. + if (profile == JsonFieldNamingProfile.CAMEL_CASE) { assertNotNull(CamelRow.LAYOUT); type = CamelRow.class; } + else if (profile == JsonFieldNamingProfile.SNAKE_CASE) { assertNotNull(SnakeRow.LAYOUT); type = SnakeRow.class; } + else { assertNotNull(PascalRow.LAYOUT); type = PascalRow.class; } + var metadata = new SimpleEntityMetaFactory(); var descriptor = new EntityDescriptor(); + descriptor.setType("ProfileRow"); descriptor.setTargetType(type); + descriptor.setEntitySupplier(() -> { constructed.incrementAndGet(); return profile == JsonFieldNamingProfile.CAMEL_CASE ? new CamelRow() + : profile == JsonFieldNamingProfile.SNAKE_CASE ? new SnakeRow() : new PascalRow(); }); + descriptor.addSimpleProperty("id", Long.class); descriptor.addSimpleProperty("version", Long.class); + descriptor.addSimpleProperty("base_url", String.class); descriptor.addSimpleProperty("other_name", String.class); + metadata.register(descriptor); descriptor.addObjectProperty(metadata, "child_row", "ProfileRow", "child_list", type); + var context = new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata).build()); + mapper = new ObjectMapper().registerModule(new TeaQLModule(context)); + } + } + @Test public void modelProfileControlsOutputIncludingIdentityAndNamedRelations() throws Exception { + var f = new Fixture(profile); var row = f.mapper.readValue("{\"id\":1,\"version\":2,\"base_url\":\"fixed\",\"child_row\":{\"id\":2},\"child_list\":[]}", f.type); + var output = f.mapper.readTree(f.mapper.writeValueAsString(row)); + assertEquals(1L, output.path(profile.render("id")).asLong(-1)); + assertEquals(2L, output.path(profile.render("version")).asLong(-1)); + assertEquals("fixed", output.path(profile.render("base_url")).asText()); + assertTrue(output.has(profile.render("child_row"))); assertTrue(output.has(profile.render("child_list"))); + assertFalse(output.has("private_storage_column")); assertFalse(output.has("otherName")); + assertEquals(output, f.mapper.readTree(f.mapper.writeValueAsString(f.mapper.treeToValue(output, f.type)))); + } + @Test public void selectedWireNamesDecodeWithoutNativeOrStorageFallback() throws Exception { + var f = new Fixture(profile); var input = f.mapper.createObjectNode().put(profile.render("base_url"), "wire"); + var row = f.mapper.treeToValue(input, f.type); assertEquals("wire", row.baseUrl); + assertTrue(row.isPropertyLoaded("base_url")); assertFalse(row.isPropertyLoaded("other_name")); + assertTrue(row.getUpdatedProperties().isEmpty()); assertFalse(row.__internalHasMutationLedger()); + } + @Test public void declaredLegacyAliasIsInputOnlyAndCollisionsRejectEqualValues() throws Exception { + var f = new Fixture(profile); var row = f.mapper.readValue("{\"legacy_url\":\"old\"}", f.type); + var output = f.mapper.readTree(f.mapper.writeValueAsString(row)); + assertEquals("old", output.path(profile.render("base_url")).asText()); assertFalse(output.has("legacy_url")); + int count = f.constructed.get(); + var input = f.mapper.createObjectNode().put(profile.render("base_url"), "same").put("legacy_url", "same"); + assertThrows(JsonMappingException.class, () -> f.mapper.treeToValue(input, f.type)); assertEquals(count, f.constructed.get()); + } + @Test public void physicalColumnCannotEnterTheJsonVocabulary() { + var f = new Fixture(profile); + var error = assertThrows(JsonMappingException.class, () -> f.mapper.readValue("{\"private_storage_column\":\"PRIVATE_PROFILE_CANARY\"}", f.type)); + assertEquals(0, f.constructed.get()); assertFalse(error.getMessage().contains("PRIVATE_PROFILE_CANARY")); + } + @Test public void loadedNullAndMissingAreNotMergedByTheProfile() throws Exception { + var f = new Fixture(profile); var row = f.mapper.treeToValue(f.mapper.createObjectNode().putNull(profile.render("base_url")), f.type); + assertTrue(row.isPropertyLoaded("base_url")); assertNull(row.baseUrl); assertFalse(row.isPropertyLoaded("other_name")); + var output = f.mapper.readTree(f.mapper.writeValueAsString(row)); + assertTrue(output.get(profile.render("base_url")).isNull()); assertFalse(output.has(profile.render("other_name"))); + } + @Test public void duplicateLiteralKeysAreRejectedBeforeConstruction() { + var f = new Fixture(profile); String name = profile.render("base_url"); + var error = assertThrows(java.io.IOException.class, () -> f.mapper.readValue("{\"" + name + "\":\"same\",\"" + name + "\":\"same\"}", f.type)); + assertTrue(error.getMessage(), error.getMessage().contains("Duplicate")); + assertEquals(0, f.constructed.get()); + } + @Test public void unselectedNativeOrOtherProfileSpellingIsNotAnImplicitAlias() { + var f = new Fixture(profile); + String undeclared = profile == JsonFieldNamingProfile.CAMEL_CASE ? "BaseUrl" : "baseUrl"; + assertThrows(JsonMappingException.class, () -> f.mapper.treeToValue(f.mapper.createObjectNode().put(undeclared, "private"), f.type)); + assertEquals(0, f.constructed.get()); + } + @Test public void duplicateDetectionRestoresOnlyTheInvokingParsersPreviousFlag() throws Exception { + var f = new Fixture(profile); + for (boolean initiallyStrict : List.of(false, true)) { + try (var parser = f.mapper.createParser("{\"base_url\":null}")) { + parser.configure(com.fasterxml.jackson.core.JsonParser.Feature.STRICT_DUPLICATE_DETECTION, initiallyStrict); + f.mapper.readValue(parser, f.type); + assertEquals(initiallyStrict, parser.isEnabled(com.fasterxml.jackson.core.JsonParser.Feature.STRICT_DUPLICATE_DETECTION)); + } + } + assertFalse(f.mapper.getFactory().isEnabled(com.fasterxml.jackson.core.JsonParser.Feature.STRICT_DUPLICATE_DETECTION)); + } +} diff --git a/teaql-jackson/src/test/java/io/teaql/jackson/JsonScalarWireTest.java b/teaql-jackson/src/test/java/io/teaql/jackson/JsonScalarWireTest.java new file mode 100644 index 000000000..5716c3785 --- /dev/null +++ b/teaql-jackson/src/test/java/io/teaql/jackson/JsonScalarWireTest.java @@ -0,0 +1,160 @@ +package io.teaql.jackson; + +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.BaseEntity; +import io.teaql.core.FieldLayout; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.util.*; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import static org.junit.Assert.*; + +/** Exact logical values are a model boundary, not global Jackson coercion settings. */ +@RunWith(Parameterized.class) +public class JsonScalarWireTest { + @Parameterized.Parameters(name="{0}") public static Collection profiles() { + return List.of(new Object[]{JsonFieldNamingProfile.CAMEL_CASE}, new Object[]{JsonFieldNamingProfile.SNAKE_CASE}, new Object[]{JsonFieldNamingProfile.PASCAL_CASE}); + } + static final Map> TYPES = Map.of("id",Long.class,"version",Long.class,"long_value",Long.class, + "decimal_value",BigDecimal.class,"integer_value",Integer.class,"float_value",Float.class, + "double_value",Double.class,"boolean_value",Boolean.class,"string_value",String.class); + static FieldLayout layout(Class type, JsonFieldNamingProfile profile) { + var indexes=new LinkedHashMap(); var mappings=new LinkedHashMap>(); + for (var field : TYPES.keySet().stream().sorted().toList()) { indexes.put(field,indexes.size()); mappings.put(field,List.of(field,field)); } + return FieldLayout.installGenerated(FieldLayout.generated(type,"scalar-wire-v1",indexes,mappings,Set.of("child_row","child_list"),profile)); + } + public abstract static class Row extends BaseEntity { + final Map values=new HashMap<>(); + @Override public String typeName() { return "ScalarWireRow"; } + @Override public void __internalSet(String field,Object value) { + if (field.equals("id") || field.equals("version")) super.__internalSet(field,value); + else { markPropertyLoaded(field); values.put(field,value); } + } + @Override public Object __internalGet(String field) { + return field.equals("id") || field.equals("version") ? super.__internalGet(field) : values.get(field); + } + } + public static final class CamelRow extends Row { static final FieldLayout LAYOUT=layout(CamelRow.class,JsonFieldNamingProfile.CAMEL_CASE); } + public static final class SnakeRow extends Row { static final FieldLayout LAYOUT=layout(SnakeRow.class,JsonFieldNamingProfile.SNAKE_CASE); } + public static final class PascalRow extends Row { static final FieldLayout LAYOUT=layout(PascalRow.class,JsonFieldNamingProfile.PASCAL_CASE); } + private final JsonFieldNamingProfile profile; + private final ObjectMapper mapper; + private final Class type; + public JsonScalarWireTest(JsonFieldNamingProfile profile) { + this.profile=profile; + if(profile==JsonFieldNamingProfile.CAMEL_CASE){assertNotNull(CamelRow.LAYOUT);type=CamelRow.class;} + else if(profile==JsonFieldNamingProfile.SNAKE_CASE){assertNotNull(SnakeRow.LAYOUT);type=SnakeRow.class;} + else {assertNotNull(PascalRow.LAYOUT);type=PascalRow.class;} + var descriptor=new EntityDescriptor();descriptor.setType("ScalarWireRow");descriptor.setTargetType(type); + descriptor.setEntitySupplier(()->profile==JsonFieldNamingProfile.CAMEL_CASE?new CamelRow():profile==JsonFieldNamingProfile.SNAKE_CASE?new SnakeRow():new PascalRow()); + TYPES.forEach(descriptor::addSimpleProperty); + var metadata=new SimpleEntityMetaFactory();metadata.register(descriptor); + descriptor.addObjectProperty(metadata,"child_row","ScalarWireRow","child_list",type); + mapper=new ObjectMapper().registerModule(new TeaQLModule(new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata).build()))); + } + Row read(String field,String value) throws Exception { return mapper.readValue("{\""+profile.render(field)+"\":"+value+"}",type); } + void invalid(String field,String value) { + var error=assertThrows(JsonMappingException.class,()->read(field,value)); + assertEquals(1,error.getPath().size());assertEquals(profile.render(field),error.getPath().get(0).getFieldName()); + assertFalse(error.getMessage(),error.getMessage().contains("PRIVATE_SCALAR_CANARY")); + } + @Test public void exactLongIdentityAndVersionAreStringsWithoutChangingOrdinaryJacksonLongs() throws Exception { + var row=read("id","\"9223372036854775807\"");row.__internalSet("version",Long.MIN_VALUE);row.__internalSet("long_value",9007199254740993L); + var json=mapper.readTree(mapper.writeValueAsString(row)); + assertTrue(json.path(profile.render("id")).isTextual());assertEquals("9223372036854775807",json.path(profile.render("id")).textValue()); + assertEquals(Long.toString(Long.MIN_VALUE),json.path(profile.render("version")).textValue()); + assertEquals("9007199254740993",json.path(profile.render("long_value")).textValue()); + assertEquals("7",mapper.writeValueAsString(7L)); + } + @Test public void longStringEndpointsAndSafeNumericInputRemainExact() throws Exception { + for (long value : new long[]{Long.MIN_VALUE,Long.MAX_VALUE,9007199254740993L,0}) + assertEquals(value,read("long_value","\""+value+"\"").__internalGet("long_value")); + assertEquals(9007199254740991L,read("long_value","9007199254740991").__internalGet("long_value")); + assertEquals(-9007199254740991L,read("long_value","-9007199254740991").__internalGet("long_value")); + } + @Test public void unsafeLongNumbersAndWrongTypesRejectRatherThanCoerce() { + for(String value:List.of("9007199254740992","-9007199254740992","1.5","true","\"1.5\"","\" 1\"","\"+1\"","\"01\"","\"9223372036854775808\"","\"-9223372036854775809\"","\"PRIVATE_SCALAR_CANARY\"")) invalid("long_value",value); + } + @Test public void identityAndVersionFollowTheSameExactInputBoundary() { + for(String field:List.of("id","version"))for(String value:List.of("9007199254740992","1.5","true","\"9223372036854775808\""))invalid(field,value); + } + @Test public void decimalValuesAndScaleRoundTripThroughStrings() throws Exception { + for(String value:List.of("3.50","0.1","123456789012345678901234567890.123456789","1E+3","1E-1000")){ + var row=read("decimal_value","\""+value+"\"");var expected=new BigDecimal(value); + assertEquals(expected,row.__internalGet("decimal_value")); + var json=mapper.readTree(mapper.writeValueAsString(row));assertTrue(json.path(profile.render("decimal_value")).isTextual()); + var restored=mapper.treeToValue(json,type);assertEquals(expected,restored.__internalGet("decimal_value")); + } + } + @Test public void decimalNumericTokensAndInvalidTextRejectRatherThanLosePrecision() { + for(String value:List.of("0.1","1","true","\"NaN\"","\"Infinity\"","\" 3.50\"","\"PRIVATE_SCALAR_CANARY\""))invalid("decimal_value",value); + } + @Test public void integersStayNumbersAtBothSigned32BitEndpoints() throws Exception { + for(int value:new int[]{Integer.MIN_VALUE,Integer.MAX_VALUE,0}){ + var row=read("integer_value",Integer.toString(value));assertEquals(value,row.__internalGet("integer_value")); + var json=mapper.readTree(mapper.writeValueAsString(row));assertTrue(json.path(profile.render("integer_value")).isIntegralNumber());assertEquals(value,json.path(profile.render("integer_value")).intValue()); + } + } + @Test public void integerFractionsRangesAndCoercionsAreRejected() { + for(String value:List.of("2147483648","-2147483649","1.5","1.0","true","\"1\"","\"PRIVATE_SCALAR_CANARY\""))invalid("integer_value",value); + } + @Test public void floatFiniteValuesAndNegativeZeroKeepTheirNativeBits() throws Exception { + assertEquals(Float.floatToRawIntBits(-0.0f),Float.floatToRawIntBits((Float)read("float_value","-0.0").__internalGet("float_value"))); + assertEquals(1.5f,read("float_value","1.5").__internalGet("float_value")); + var row=read("float_value","1.5");assertTrue(mapper.readTree(mapper.writeValueAsString(row)).path(profile.render("float_value")).isNumber()); + } + @Test public void floatOverflowUnderflowAndTextAreRejected() { + for(String value:List.of("3.5e38","1e-50","true","\"1.5\"","\"NaN\"","\"PRIVATE_SCALAR_CANARY\""))invalid("float_value",value); + } + @Test public void doubleFiniteValuesAndNegativeZeroKeepTheirNativeBits() throws Exception { + assertEquals(Double.doubleToRawLongBits(-0.0d),Double.doubleToRawLongBits((Double)read("double_value","-0.0").__internalGet("double_value"))); + assertEquals(2.25d,read("double_value","2.25").__internalGet("double_value")); + } + @Test public void doubleOverflowUnderflowAndTextAreRejected() { + for(String value:List.of("1e400","1e-400","true","\"2.25\"","\"NaN\"","\"PRIVATE_SCALAR_CANARY\""))invalid("double_value",value); + } + @Test public void nonfiniteNativeValuesCannotBecomeJsonStringsOrNull() throws Exception { + for(var value:List.of(Float.NaN,Float.POSITIVE_INFINITY,Float.NEGATIVE_INFINITY,Double.NaN,Double.POSITIVE_INFINITY,Double.NEGATIVE_INFINITY)){ + String field=value instanceof Float?"float_value":"double_value";var row=read("string_value","\"safe\"");row.__internalSet(field,value); + var error=assertThrows(JsonMappingException.class,()->mapper.writeValueAsString(row)); + assertEquals(profile.render(field),error.getPath().get(0).getFieldName()); + } + } + @Test public void booleanAndStringTypesDoNotBorrowJacksonCoercions() { + for(String value:List.of("1","0","\"true\"","\"PRIVATE_SCALAR_CANARY\""))invalid("boolean_value",value); + for(String value:List.of("1","true","{}","[]"))invalid("string_value",value); + } + @Test public void nullAndNotLoadedRemainDistinctAndPassive() throws Exception { + var row=read("decimal_value","null");assertTrue(row.isPropertyLoaded("decimal_value"));assertNull(row.__internalGet("decimal_value")); + assertFalse(row.isPropertyLoaded("long_value"));assertFalse(row.__internalHasMutationLedger()); + var json=mapper.readTree(mapper.writeValueAsString(row));assertTrue(json.path(profile.render("decimal_value")).isNull());assertFalse(json.has(profile.render("long_value"))); + var string=read("string_value","\"\"");assertEquals("",string.__internalGet("string_value")); + assertEquals(false,read("boolean_value","false").__internalGet("boolean_value")); + } + @Test public void nestedScalarInputDiagnosticsRetainRelationAndArrayPaths() { + var direct=assertThrows(JsonMappingException.class,()->read("child_row","{\""+profile.render("long_value")+"\":9007199254740992}")); + assertEquals(List.of(profile.render("child_row"),profile.render("long_value")),direct.getPath().stream().map(JsonMappingException.Reference::getFieldName).toList()); + var array=assertThrows(JsonMappingException.class,()->read("child_list","[{\""+profile.render("long_value")+"\":9007199254740992}]")); + assertEquals(3,array.getPath().size());assertEquals(profile.render("child_list"),array.getPath().get(0).getFieldName()); + assertEquals(0,array.getPath().get(1).getIndex());assertEquals(profile.render("long_value"),array.getPath().get(2).getFieldName()); + } + @Test public void nestedNonfiniteOutputRetainsPathAndDoesNotPoisonTheNextWrite() throws Exception { + var child=read("float_value","1.5");child.__internalSet("float_value",Float.NaN); + var parent=read("string_value","\"safe\"");parent.__internalSet("child_list",SmartList.takeOwnership(List.of(child))); + var state=parent.__internalLoadState(); + var error=assertThrows(JsonMappingException.class,()->mapper.writeValueAsString(parent)); + assertEquals(3,error.getPath().size());assertEquals(profile.render("child_list"),error.getPath().get(0).getFieldName()); + assertEquals(0,error.getPath().get(1).getIndex());assertEquals(profile.render("float_value"),error.getPath().get(2).getFieldName()); + assertSame(state,parent.__internalLoadState());assertFalse(parent.__internalHasMutationLedger());assertFalse(child.__internalHasMutationLedger()); + child.__internalSet("float_value",1.5f); + var json=mapper.readTree(mapper.writeValueAsString(parent));assertEquals(1.5,json.path(profile.render("child_list")).get(0).path(profile.render("float_value")).doubleValue(),0); + } +} diff --git a/teaql-jackson/src/test/java/io/teaql/jackson/JsonTemporalWireTest.java b/teaql-jackson/src/test/java/io/teaql/jackson/JsonTemporalWireTest.java new file mode 100644 index 000000000..f6548e658 --- /dev/null +++ b/teaql-jackson/src/test/java/io/teaql/jackson/JsonTemporalWireTest.java @@ -0,0 +1,193 @@ +package io.teaql.jackson; + +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.BaseEntity; +import io.teaql.core.FieldLayout; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import java.time.*; +import java.util.*; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import static org.junit.Assert.*; + +/** Calendar Date and wall Time are not instants; Timestamp is UTC milliseconds. */ +@RunWith(Parameterized.class) +public class JsonTemporalWireTest { + @Parameterized.Parameters(name="{0}") public static Collection profiles() { + return List.of(new Object[]{JsonFieldNamingProfile.CAMEL_CASE},new Object[]{JsonFieldNamingProfile.SNAKE_CASE},new Object[]{JsonFieldNamingProfile.PASCAL_CASE}); + } + static final Map> TYPES=Map.of("id",Long.class,"version",Long.class,"date_value",LocalDate.class,"time_value",LocalTime.class,"timestamp_value",Instant.class,"local_datetime_value",LocalDateTime.class); + static FieldLayout layout(Class type,JsonFieldNamingProfile profile){ + var indexes=new LinkedHashMap();var mappings=new LinkedHashMap>(); + for(var field:TYPES.keySet().stream().sorted().toList()){indexes.put(field,indexes.size());mappings.put(field,List.of(field,field));} + return FieldLayout.installGenerated(FieldLayout.generated(type,"temporal-wire-v2",indexes,mappings,Set.of("child_row","child_list"),profile)); + } + public abstract static class Row extends BaseEntity { + final Map values=new HashMap<>(); + @Override public String typeName(){return "TemporalWireRow";} + @Override public void __internalSet(String field,Object value){ + if(field.equals("id")||field.equals("version"))super.__internalSet(field,value);else{markPropertyLoaded(field);values.put(field,value);} + } + @Override public Object __internalGet(String field){return field.equals("id")||field.equals("version")?super.__internalGet(field):values.get(field);} + } + public static final class CamelRow extends Row {static final FieldLayout LAYOUT=layout(CamelRow.class,JsonFieldNamingProfile.CAMEL_CASE);} + public static final class SnakeRow extends Row {static final FieldLayout LAYOUT=layout(SnakeRow.class,JsonFieldNamingProfile.SNAKE_CASE);} + public static final class PascalRow extends Row {static final FieldLayout LAYOUT=layout(PascalRow.class,JsonFieldNamingProfile.PASCAL_CASE);} + private final JsonFieldNamingProfile profile; + private final ObjectMapper mapper; + private final Class type; + public JsonTemporalWireTest(JsonFieldNamingProfile profile){ + this.profile=profile; + if(profile==JsonFieldNamingProfile.CAMEL_CASE){assertNotNull(CamelRow.LAYOUT);type=CamelRow.class;} + else if(profile==JsonFieldNamingProfile.SNAKE_CASE){assertNotNull(SnakeRow.LAYOUT);type=SnakeRow.class;} + else{assertNotNull(PascalRow.LAYOUT);type=PascalRow.class;} + var descriptor=new EntityDescriptor();descriptor.setType("TemporalWireRow");descriptor.setTargetType(type); + descriptor.setEntitySupplier(()->profile==JsonFieldNamingProfile.CAMEL_CASE?new CamelRow():profile==JsonFieldNamingProfile.SNAKE_CASE?new SnakeRow():new PascalRow()); + TYPES.forEach(descriptor::addSimpleProperty);var metadata=new SimpleEntityMetaFactory();metadata.register(descriptor); + descriptor.addObjectProperty(metadata,"child_row","TemporalWireRow","child_list",type); + var context=new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata).build()) { + @Override public LocalDateTime businessTime(){throw new AssertionError("Passive JSON must not consult Business Clock");} + }; + mapper=new ObjectMapper().registerModule(new TeaQLModule(context)); + } + Row read(String field,String value)throws Exception{return mapper.readValue("{\""+profile.render(field)+"\":"+value+"}",type);} + void invalid(String field,String value){ + var error=assertThrows(JsonMappingException.class,()->read(field,value)); + assertEquals(1,error.getPath().size());assertEquals(profile.render(field),error.getPath().get(0).getFieldName()); + assertFalse(error.getMessage(),error.getMessage().contains("PRIVATE_TEMPORAL_CANARY")); + } + @Test public void calendarDateRoundTripsWithoutJavaTimeModule()throws Exception{ + var row=read("date_value","\"2024-02-29\"");assertEquals(LocalDate.of(2024,2,29),row.__internalGet("date_value")); + var json=mapper.readTree(mapper.writeValueAsString(row));assertEquals("2024-02-29",json.path(profile.render("date_value")).textValue()); + assertEquals(row.__internalGet("date_value"),mapper.treeToValue(json,type).__internalGet("date_value")); + } + @Test public void invalidCalendarDatesDoNotNormalize() { + for(String value:List.of("2023-02-29","2024-02-30","2024-13-01","2024-00-01","PRIVATE_TEMPORAL_CANARY"))invalid("date_value","\""+value+"\""); + } + @Test public void dateRejectsNumericArrayAndTimestampCoercion(){ + for(String value:List.of("0","[2024,2,29]","true","\"2024-02-29T00:00:00Z\"","\"2024-02-29+08:00\""))invalid("date_value",value); + } + @Test public void calendarDateIgnoresTheMappersZone()throws Exception{ + String input="{\""+profile.render("date_value")+"\":\"2011-12-30\"}"; + for(String zone:List.of("UTC","Pacific/Apia","America/New_York")){ + var configured=mapper.copy().setTimeZone(TimeZone.getTimeZone(zone)); + assertEquals(LocalDate.of(2011,12,30),configured.readValue(input,type).__internalGet("date_value")); + } + } + @Test public void wallTimePreservesItsNativeNanoseconds()throws Exception{ + for(String value:List.of("00:00:00","12:30:00","23:59:59.123456789")){ + var row=read("time_value","\""+value+"\"");assertEquals(LocalTime.parse(value),row.__internalGet("time_value")); + var json=mapper.readTree(mapper.writeValueAsString(row));assertEquals(value,json.path(profile.render("time_value")).textValue()); + assertEquals(LocalTime.parse(value),mapper.treeToValue(json,type).__internalGet("time_value")); + } + } + @Test public void wallTimeRejectsRolloverZoneAndExcessPrecision(){ + for(String value:List.of("24:00:00","23:59:60","23:59:59.1234567891","12:30:00Z","12:30:00+08:00","2024-02-29T12:30:00","PRIVATE_TEMPORAL_CANARY"))invalid("time_value","\""+value+"\""); + } + @Test public void wallTimeRejectsArrayAndNumberCoercion(){for(String value:List.of("0","[12,30]","false"))invalid("time_value",value);} + @Test public void timestampNormalizesOffsetsToUtcMilliseconds()throws Exception{ + var expected=Instant.parse("2024-02-29T12:34:56.123Z"); + for(String value:List.of("2024-02-29T12:34:56.123Z","2024-02-29T20:34:56.123+08:00","2024-02-29T07:34:56.123-05:00")){ + var row=read("timestamp_value","\""+value+"\"");assertEquals(expected,row.__internalGet("timestamp_value")); + var json=mapper.readTree(mapper.writeValueAsString(row));assertEquals(expected.toString(),json.path(profile.render("timestamp_value")).textValue()); + } + } + @Test public void timestampBeforeEpochAndEpochRoundTripExactly()throws Exception{ + for(String value:List.of("1960-01-02T03:04:05.006Z","1970-01-01T00:00:00Z")){ + var row=read("timestamp_value","\""+value+"\"");var json=mapper.readTree(mapper.writeValueAsString(row)); + assertEquals(Instant.parse(value),mapper.treeToValue(json,type).__internalGet("timestamp_value")); + } + } + @Test public void timestampRequiresOffsetAndRejectsFinerThanMilliseconds(){ + for(String value:List.of("2024-02-29T12:34:56","2024-02-29","2024-02-29T12:34:56.123456Z","2016-12-31T23:59:60Z","PRIVATE_TEMPORAL_CANARY"))invalid("timestamp_value","\""+value+"\""); + } + @Test public void timestampRejectsNumericAndArrayCoercion(){for(String value:List.of("0","1709210096123","true","[2024,2,29,12,34,56]"))invalid("timestamp_value",value);} + @Test public void timestampOutputRejectsPrecisionLossAndKeepsTheDiagnosticPath()throws Exception{ + var row=read("id","1");row.__internalSet("timestamp_value",Instant.parse("2024-02-29T12:34:56.123456Z"));var state=row.__internalLoadState(); + var error=assertThrows(JsonMappingException.class,()->mapper.writeValueAsString(row));assertEquals(profile.render("timestamp_value"),error.getPath().get(0).getFieldName()); + assertSame(state,row.__internalLoadState());assertFalse(row.__internalHasMutationLedger()); + } + @Test public void nullAndMissingTemporalValuesStayDistinct()throws Exception{ + var row=read("date_value","null");assertTrue(row.isPropertyLoaded("date_value"));assertNull(row.__internalGet("date_value"));assertFalse(row.isPropertyLoaded("time_value")); + var json=mapper.readTree(mapper.writeValueAsString(row));assertTrue(json.path(profile.render("date_value")).isNull());assertFalse(json.has(profile.render("time_value"))); + assertFalse(row.__internalHasMutationLedger());assertTrue(row.getUpdatedProperties().isEmpty()); + } + @Test public void temporalPolicyDoesNotInstallGlobalJavaTimeSerializers(){ + assertThrows(JsonMappingException.class,()->mapper.writeValueAsString(LocalDate.of(2024,2,29))); + } + @Test public void nestedTemporalErrorsRetainParentsAndArrayIndices(){ + var error=assertThrows(JsonMappingException.class,()->read("child_list","[{\""+profile.render("date_value")+"\":\"PRIVATE_TEMPORAL_CANARY\"}]")); + assertEquals(3,error.getPath().size());assertEquals(profile.render("child_list"),error.getPath().get(0).getFieldName());assertEquals(0,error.getPath().get(1).getIndex()); + assertEquals(profile.render("date_value"),error.getPath().get(2).getFieldName());assertFalse(error.getMessage().contains("PRIVATE_TEMPORAL_CANARY")); + } + @Test public void registeredJavaTimeModuleCannotTurnModelDatesIntoArrays()throws Exception{ + var configured=mapper.copy().findAndRegisterModules(); + var row=configured.readValue("{\""+profile.render("date_value")+"\":\"2024-02-29\"}",type); + var json=configured.readTree(configured.writeValueAsString(row));assertEquals("2024-02-29",json.path(profile.render("date_value")).textValue()); + assertTrue(configured.isEnabled(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)); + assertTrue(configured.readTree(configured.writeValueAsString(LocalDate.of(2024,2,29))).isArray()); + } + @Test public void registeredJavaTimeModuleCannotTurnModelTimesIntoArrays()throws Exception{ + var configured=mapper.copy().findAndRegisterModules(); + var row=configured.readValue("{\""+profile.render("time_value")+"\":\"23:59:59.123456789\"}",type); + var json=configured.readTree(configured.writeValueAsString(row));assertEquals("23:59:59.123456789",json.path(profile.render("time_value")).textValue()); + } + @Test public void registeredJavaTimeModuleCannotTurnModelInstantsIntoEpochNumbers()throws Exception{ + var configured=mapper.copy().findAndRegisterModules(); + var row=configured.readValue("{\""+profile.render("timestamp_value")+"\":\"2024-02-29T12:34:56.123Z\"}",type); + var json=configured.readTree(configured.writeValueAsString(row));assertEquals("2024-02-29T12:34:56.123Z",json.path(profile.render("timestamp_value")).textValue()); + } + @Test public void localDateTimeRoundTripsWithoutJavaTimeModuleOrPrecisionLoss()throws Exception{ + for(String value:List.of("1960-02-29T00:00:00","2024-02-29T12:34:56.123","2024-02-29T12:34:56.123456789")){ + var row=read("local_datetime_value","\""+value+"\"");var expected=LocalDateTime.parse(value); + assertEquals(expected,row.__internalGet("local_datetime_value")); + var state=row.__internalLoadState();var json=mapper.readTree(mapper.writeValueAsString(row)); + assertEquals(value,json.path(profile.render("local_datetime_value")).textValue()); + assertEquals(expected,mapper.treeToValue(json,type).__internalGet("local_datetime_value")); + assertSame(state,row.__internalLoadState());assertFalse(row.__internalHasMutationLedger()); + } + } + @Test public void localDateTimeDoesNotInferAMapperOrSystemZone()throws Exception{ + String value="2024-03-10T02:30:00",input="{\""+profile.render("local_datetime_value")+"\":\""+value+"\"}"; + // This wall time is a DST gap in New York; it remains valid as a local + // value because decoding must not resolve it to an instant. + for(String zone:List.of("UTC","America/New_York","Asia/Shanghai")){ + var configured=mapper.copy().setTimeZone(TimeZone.getTimeZone(zone));var row=configured.readValue(input,type); + assertEquals(LocalDateTime.parse(value),row.__internalGet("local_datetime_value")); + assertEquals(value,configured.readTree(configured.writeValueAsString(row)).path(profile.render("local_datetime_value")).textValue()); + } + } + @Test public void localDateTimeRejectsOffsetsInvalidCalendarsAndCoercion(){ + for(String value:List.of("\"2024-02-29T12:34:56Z\"","\"2024-02-29T12:34:56+08:00\"","\"2023-02-29T12:34:56\"","\"2024-02-29T23:59:60\"","\"2024-02-29\"","\"PRIVATE_TEMPORAL_CANARY\"","0","true","[2024,2,29,12,34,56]"))invalid("local_datetime_value",value); + } + @Test public void localDateTimeNullAndNotLoadedStayDistinct()throws Exception{ + var row=read("local_datetime_value","null");assertTrue(row.isPropertyLoaded("local_datetime_value"));assertNull(row.__internalGet("local_datetime_value")); + assertFalse(row.isPropertyLoaded("timestamp_value"));var json=mapper.readTree(mapper.writeValueAsString(row)); + assertTrue(json.path(profile.render("local_datetime_value")).isNull());assertFalse(json.has(profile.render("timestamp_value"))); + assertFalse(row.__internalHasMutationLedger());assertTrue(row.getUpdatedProperties().isEmpty()); + } + @Test public void nestedLocalDateTimeErrorsRetainProfiledLocationWithoutInputLeakage(){ + var error=assertThrows(JsonMappingException.class,()->read("child_list","[{\""+profile.render("local_datetime_value")+"\":\"PRIVATE_TEMPORAL_CANARY\"}]")); + assertEquals(3,error.getPath().size());assertEquals(profile.render("child_list"),error.getPath().get(0).getFieldName());assertEquals(0,error.getPath().get(1).getIndex()); + assertEquals(profile.render("local_datetime_value"),error.getPath().get(2).getFieldName());assertFalse(error.getMessage().contains("PRIVATE_TEMPORAL_CANARY")); + } + @Test public void registeredJavaTimeModuleCannotTurnModelLocalDateTimeIntoAnArray()throws Exception{ + var configured=mapper.copy().findAndRegisterModules();String value="2024-02-29T12:34:56.123"; + var row=configured.readValue("{\""+profile.render("local_datetime_value")+"\":\""+value+"\"}",type); + assertEquals(value,configured.readTree(configured.writeValueAsString(row)).path(profile.render("local_datetime_value")).textValue()); + assertTrue(configured.isEnabled(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)); + assertTrue(configured.readTree(configured.writeValueAsString(LocalDateTime.parse(value))).isArray()); + } + @Test public void localDateTimeAndInstantRetainDifferentWireMeanings()throws Exception{ + var row=read("local_datetime_value","\"2024-02-29T20:34:56.123\"");row.__internalSet("timestamp_value",Instant.parse("2024-02-29T12:34:56.123Z")); + var json=mapper.readTree(mapper.writeValueAsString(row));assertEquals("2024-02-29T20:34:56.123",json.path(profile.render("local_datetime_value")).textValue()); + assertEquals("2024-02-29T12:34:56.123Z",json.path(profile.render("timestamp_value")).textValue()); + var decoded=mapper.treeToValue(json,type);assertEquals(LocalDateTime.class,decoded.__internalGet("local_datetime_value").getClass());assertEquals(Instant.class,decoded.__internalGet("timestamp_value").getClass()); + } +} diff --git a/teaql-jackson/src/test/java/io/teaql/jackson/TypedEntityJsonDeserializerTest.java b/teaql-jackson/src/test/java/io/teaql/jackson/TypedEntityJsonDeserializerTest.java index d9682ed99..814a2a40b 100644 --- a/teaql-jackson/src/test/java/io/teaql/jackson/TypedEntityJsonDeserializerTest.java +++ b/teaql-jackson/src/test/java/io/teaql/jackson/TypedEntityJsonDeserializerTest.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import io.teaql.core.BaseEntity; +import io.teaql.core.EntityKey; +import io.teaql.core.EntityStatus; import io.teaql.core.FieldLayout; import io.teaql.core.SmartList; import io.teaql.core.meta.EntityDescriptor; @@ -24,29 +26,34 @@ public static class Row extends BaseEntity { Map.of("id", List.of("id", "id"), "version", List.of("version", "version"), "name", List.of("name", "name"), "address", List.of("address", "address"), "count", List.of("count", "count"), "active", List.of("active", "active"), - "base_url", List.of("baseUrl", "legacy_url")), Set.of("child", "childList"))); + "base_url", List.of("baseUrl", "legacy_url")), Set.of("child", "child_list"), + io.teaql.core.checker.JsonFieldNamingProfile.CAMEL_CASE, Map.of("legacy_url", "base_url"))); String name, address, baseUrl, owner; Integer count; Boolean active; Row child; SmartList childList; + void updateName(String value) { + handleUpdate("name", name, value); + name = value; + } @Override public void __internalSet(String field, Object value) { markPropertyLoaded(field); switch (field) { case "name" -> name = (String) value; case "address" -> address = (String) value; - case "baseUrl" -> baseUrl = (String) value; + case "base_url" -> baseUrl = (String) value; case "count" -> count = (Integer) value; case "active" -> active = (Boolean) value; case "child" -> child = (Row) value; - case "childList" -> childList = (SmartList) value; + case "child_list" -> childList = (SmartList) value; default -> super.__internalSet(field, value); } } @Override public Object __internalGet(String field) { return switch (field) { - case "name" -> name; case "address" -> address; case "baseUrl" -> baseUrl; - case "count" -> count; case "active" -> active; case "child" -> child; case "childList" -> childList; + case "name" -> name; case "address" -> address; case "base_url" -> baseUrl; + case "count" -> count; case "active" -> active; case "child" -> child; case "child_list" -> childList; default -> super.__internalGet(field); }; } @@ -60,11 +67,43 @@ private static DefaultUserContext context(String owner, AtomicInteger constructe descriptor.addSimpleProperty("id", Long.class); descriptor.addSimpleProperty("version", Long.class); descriptor.addSimpleProperty("name", String.class); descriptor.addSimpleProperty("address", String.class); descriptor.addSimpleProperty("count", Integer.class); descriptor.addSimpleProperty("active", Boolean.class); - descriptor.addSimpleProperty("baseUrl", String.class); + descriptor.addSimpleProperty("base_url", String.class); metadata.register(descriptor); + descriptor.addObjectProperty(metadata, "child", "Row", "child_list", Row.class); return new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata).build()); } + @Test public void canonicalNamedRelationsRoundTripThroughNativeJsonWithoutChangingAvailability() throws Exception { + var constructed = new AtomicInteger(); + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", constructed))); + var row = mapper.readValue("{\"childList\":[{\"baseUrl\":\"\"}],\"_childList\":\"derived\"}", Row.class); + assertTrue(row.isPropertyLoaded("child_list")); + assertTrue(row.isPropertyLoaded("childList")); + assertEquals("", row.childList.first().baseUrl); + var state = row.__internalLoadState(); + var json = mapper.readTree(mapper.writeValueAsString(row)); + assertEquals("", json.get("childList").get(0).get("baseUrl").asText()); + assertEquals("derived", json.get("_childList").asText()); + assertFalse(json.has("child_list")); + assertSame(state, row.__internalLoadState()); + assertFalse(row.__internalHasMutationLedger()); + assertFalse(row.childList.first().__internalHasMutationLedger()); + assertEquals(json, mapper.readTree(mapper.writeValueAsString(mapper.treeToValue(json, Row.class)))); + for (String value : List.of("[]", "null")) { + var selected = mapper.readValue("{\"childList\":" + value + "}", Row.class); + var selectedJson = mapper.readTree(mapper.writeValueAsString(selected)); + assertTrue(selected.isPropertyLoaded("child_list")); + assertEquals(mapper.readTree(value), selectedJson.get("childList")); + } + var omitted = mapper.readValue("{}", Row.class); + assertFalse(omitted.isPropertyLoaded("child_list")); + assertFalse(mapper.readTree(mapper.writeValueAsString(omitted)).has("childList")); + int before = constructed.get(); + assertThrows(JsonMappingException.class, + () -> mapper.readValue("{\"childList\":[],\"child_list\":[]}", Row.class)); + assertEquals(before, constructed.get()); + } + @Test public void typedRoundTripPreservesLoadedNullOmissionAndFalsyValuesWithoutMutation() throws Exception { var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); var row = mapper.readValue("{\"id\":1,\"version\":7,\"name\":null,\"count\":0,\"active\":false,\"baseUrl\":\"\",\"_total\":null}", Row.class); @@ -81,6 +120,86 @@ private static DefaultUserContext context(String owner, AtomicInteger constructe assertFalse(restored.__internalHasMutationLedger()); assertFalse(restored.isPropertyLoaded("address")); } + @Test public void persistedIdentityIsCleanRegardlessOfJsonMemberOrder() throws Exception { + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); + for (String json : List.of("{\"id\":41,\"version\":7,\"name\":\"before\"}", + "{\"version\":7,\"name\":\"before\",\"id\":41}")) { + Row row = mapper.readValue(json, Row.class); + assertEquals(EntityStatus.PERSISTED, row.get$status()); + assertFalse(row.newItem()); assertFalse(row.needPersist()); + assertFalse(row.__internalHasMutationLedger()); assertTrue(row.getUpdatedProperties().isEmpty()); + assertEquals(Long.valueOf(7), row.getOriginalVersion()); + row.updateName("after"); + assertEquals(EntityStatus.UPDATED, row.get$status()); assertTrue(row.needPersist()); + assertEquals(Set.of("name"), Set.copyOf(row.getUpdatedProperties())); + assertEquals(Long.valueOf(7), row.getEntityMutationLedger().getOriginalVersion(new EntityKey(row.typeName(), 41L))); + assertFalse(row.isNew()); + } + } + + @Test public void deletedIdentityRequiresExplicitRecoveryRatherThanFreshInsertion() throws Exception { + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); + Row row = mapper.readValue("{\"id\":41,\"version\":-7,\"name\":\"before\"}", Row.class); + assertEquals(EntityStatus.PERSISTED_DELETED, row.get$status()); + assertFalse(row.needPersist()); assertFalse(row.__internalHasMutationLedger()); + assertEquals(Long.valueOf(-7), row.getOriginalVersion()); + assertThrows(io.teaql.core.TeaQLRuntimeException.class, () -> row.updateName("invalid")); + assertEquals("before", row.name); assertFalse(row.__internalHasMutationLedger()); + row.markAsRecover(); + assertEquals(EntityStatus.UPDATED_RECOVER, row.get$status()); assertTrue(row.needPersist()); + assertEquals(Long.valueOf(-7), row.getOriginalVersion()); assertFalse(row.isNew()); + } + + @Test public void independentDecodesShareAvailabilityButNeverMutationOwnership() throws Exception { + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); + String json = "{\"id\":41,\"version\":7,\"name\":\"before\"}"; + Row first = mapper.readValue(json, Row.class), second = mapper.readValue(json, Row.class); + assertSame(first.__internalLoadState(), second.__internalLoadState()); + assertFalse(first.needPersist()); assertFalse(second.needPersist()); + first.updateName("first"); + assertFalse(second.__internalHasMutationLedger()); assertEquals("before", second.name); + second.updateName("second"); + assertNotSame(first.getEntityMutationLedger(), second.getEntityMutationLedger()); + assertEquals(Long.valueOf(7), first.getOriginalVersion()); + assertEquals(Long.valueOf(7), second.getOriginalVersion()); + assertEquals("first", first.__internalGet("name")); assertEquals("second", second.__internalGet("name")); + } + + @Test public void nestedExistingIdentitiesStayCleanWithoutWideningPartialProjections() throws Exception { + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); + Row row = mapper.readValue("{\"id\":41,\"version\":7,\"name\":\"parent\"," + + "\"child\":{\"id\":42,\"version\":3},\"childList\":[{\"id\":43,\"version\":4}]}", Row.class); + for (Row value : List.of(row, row.child, row.childList.first())) { + assertEquals(EntityStatus.PERSISTED, value.get$status()); + assertFalse(value.needPersist()); assertFalse(value.__internalHasMutationLedger()); + } + assertFalse(row.child.isPropertyLoaded("name")); + row.updateName("updated parent"); + assertTrue(row.needPersist()); assertFalse(row.child.needPersist()); assertFalse(row.childList.first().needPersist()); + } + + @Test public void jsonWithoutPersistedVersionKeepsTheExistingNewObjectContract() throws Exception { + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); + for (String json : List.of("{}", "{\"name\":\"new\"}", "{\"id\":41,\"name\":\"new with supplied id\"}")) { + Row row = mapper.readValue(json, Row.class); + assertEquals(EntityStatus.NEW, row.get$status()); assertTrue(row.newItem()); + assertTrue(row.needPersist()); assertFalse(row.__internalHasMutationLedger()); + assertNull(row.getOriginalVersion()); + } + } + + @Test public void identityOnlyJsonRestoresAReadOnlyReferenceWithoutInventingANewEntity() throws Exception { + var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); + for (String json : List.of("{\"id\":41}", "{\"id\":41,\"version\":null}", "{\"id\":41,\"_total\":3}")) { + Row row = mapper.readValue(json, Row.class); + assertEquals(EntityStatus.REFER, row.get$status()); assertFalse(row.needPersist()); + assertFalse(row.__internalHasMutationLedger()); assertNull(row.getOriginalVersion()); + assertFalse(row.isPropertyLoaded("name")); + assertThrows(io.teaql.core.TeaQLRuntimeException.class, () -> row.updateName("must load a version first")); + assertFalse(row.__internalHasMutationLedger()); assertNull(row.name); + } + } + @Test public void sameShapesShareStateDespiteFieldOrderAliasesAndPrivateValues() throws Exception { var mapper = new ObjectMapper().registerModule(new TeaQLModule(context("A", new AtomicInteger()))); Row first = mapper.readValue("{\"id\":1,\"baseUrl\":null}", Row.class); diff --git a/teaql-mssql/pom.xml b/teaql-mssql/pom.xml index 840aa68b1..6a845acda 100644 --- a/teaql-mssql/pom.xml +++ b/teaql-mssql/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-mssql teaql-mssql diff --git a/teaql-mysql/pom.xml b/teaql-mysql/pom.xml index 282186e23..b1eb1d157 100644 --- a/teaql-mysql/pom.xml +++ b/teaql-mysql/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-mysql diff --git a/teaql-object-storage-s3/pom.xml b/teaql-object-storage-s3/pom.xml index c49ba3fad..7825c92f1 100644 --- a/teaql-object-storage-s3/pom.xml +++ b/teaql-object-storage-s3/pom.xml @@ -1,6 +1,6 @@ 4.0.0 - io.teaqlteaql-java-parent1.555-RELEASE + io.teaqlteaql-java-parent1.556-RELEASE teaql-object-storage-s3 S3-compatible provider for context-owned TeaQL binary object storage 2.55.16 @@ -10,5 +10,6 @@ software.amazon.awssdkapache5-client${aws.sdk.version} junitjunittest io.teaqlteaql-runtimetest + io.teaqlteaql-tool-http${project.version}test diff --git a/teaql-object-storage-s3/src/test/java/io/teaql/storage/s3/S3HttpCoexistenceTest.java b/teaql-object-storage-s3/src/test/java/io/teaql/storage/s3/S3HttpCoexistenceTest.java new file mode 100644 index 000000000..90c86b537 --- /dev/null +++ b/teaql-object-storage-s3/src/test/java/io/teaql/storage/s3/S3HttpCoexistenceTest.java @@ -0,0 +1,101 @@ +package io.teaql.storage.s3; + +import com.sun.net.httpserver.HttpServer; +import io.teaql.core.UserContext; +import io.teaql.core.http.HttpPropagation; +import io.teaql.core.http.HttpRequestService; +import io.teaql.core.storage.ObjectStorage; +import io.teaql.core.storage.ObjectStorageProvider; +import io.teaql.core.storage.StorageException; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.tools.http.HttpServiceProfile; +import io.teaql.tools.http.JdkHttpRequestService; +import java.net.InetSocketAddress; +import java.net.URI; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import org.junit.Test; +import static org.junit.Assert.*; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; +import software.amazon.awssdk.core.interceptor.Context; +import software.amazon.awssdk.core.interceptor.ExecutionAttributes; +import software.amazon.awssdk.core.interceptor.ExecutionInterceptor; +import software.amazon.awssdk.core.retry.RetryPolicy; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.S3Configuration; +import software.amazon.awssdk.services.s3.presigner.S3Presigner; + +/** The real SDK keeps its own signer, transport and retry policy. */ +public class S3HttpCoexistenceTest { + @Test public void signedSdkRequestIsNotWrappedRewrittenOrRetriedByRuntimeHttp() throws Exception { + var sdkRequests = new AtomicInteger(); var runtimeRequests = new AtomicInteger(); + var signedAuthorization = new AtomicReference(); var wireAuthorization = new AtomicReference(); + var sdkTrace = new AtomicReference(); var runtimeTrace = new AtomicReference(); + var server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0); + server.createContext("/", request -> { + request.getRequestBody().readAllBytes(); + if (request.getRequestMethod().equals("HEAD")) { + sdkRequests.incrementAndGet(); wireAuthorization.set(request.getRequestHeaders().getFirst("Authorization")); + sdkTrace.set(request.getRequestHeaders().getFirst("traceparent")); request.sendResponseHeaders(503, -1); + } else { + runtimeRequests.incrementAndGet(); runtimeTrace.set(request.getRequestHeaders().getFirst("traceparent")); + request.sendResponseHeaders(200, 0); + } + request.close(); + }); + server.start(); + URI endpoint = URI.create("http://127.0.0.1:" + server.getAddress().getPort()); + var credentials = StaticCredentialsProvider.create(AwsBasicCredentials.create("SDK_ACCESS_KEY_CANARY", "SDK_SECRET_CANARY")); + var configuration = S3Configuration.builder().pathStyleAccessEnabled(true).build(); + ExecutionInterceptor signed = new ExecutionInterceptor() { + @Override public void beforeTransmission(Context.BeforeTransmission context, ExecutionAttributes attributes) { + signedAuthorization.set(context.httpRequest().firstMatchingHeader("Authorization").orElse(null)); + } + }; + try (var provider = new S3ObjectStorage(S3Client.builder().endpointOverride(endpoint).region(Region.US_EAST_1) + .credentialsProvider(credentials).serviceConfiguration(configuration) + .overrideConfiguration(b -> b.retryPolicy(RetryPolicy.none()).apiCallTimeout(Duration.ofSeconds(3)) + .addExecutionInterceptor(signed)).build(), + S3Presigner.builder().endpointOverride(endpoint).region(Region.US_EAST_1).credentialsProvider(credentials) + .serviceConfiguration(configuration).build(), "bucket")) { + var profile = HttpServiceProfile.builder("orders", endpoint.resolve("/api/")) + .retry(3, Duration.ofMillis(1), Set.of(HttpRequestService.Method.GET)).build(); + var calls = new AtomicInteger(); var delegate = new JdkHttpRequestService(List.of(profile)); + HttpRequestService spy = (UserContext context, HttpRequestService.Call call) -> { + calls.incrementAndGet(); return delegate.execute(context, call); + }; + var context = new DefaultUserContext(null); + context.putAttribute(HttpRequestService.class.getName(), spy); + context.putAttribute(ObjectStorageProvider.class.getName(), provider); + String trace = "00-11111111111111111111111111111111-aaaaaaaaaaaaaaaa-01"; + context.putAttribute(HttpPropagation.class.getName(), (HttpPropagation) carrier -> carrier.put("traceparent", trace)); + var error = assertThrows(StorageException.class, + () -> context.objectStorage("verify SDK transport isolation").exists(new ObjectStorage.Key("SDK_OBJECT_CANARY"))); + assertEquals(StorageException.Code.UNAVAILABLE, error.code()); assertNull(error.getCause()); + assertEquals(1, sdkRequests.get()); assertEquals(0, calls.get()); assertEquals(0, runtimeRequests.get()); + assertNotNull(signedAuthorization.get()); assertTrue(signedAuthorization.get().startsWith("AWS4-HMAC-SHA256 ")); + assertTrue(signedAuthorization.get().contains("Credential=SDK_ACCESS_KEY_CANARY/")); + assertTrue(signedAuthorization.get().contains("Signature=")); assertEquals(signedAuthorization.get(), wireAuthorization.get()); + assertNull(sdkTrace.get()); assertFalse(error.toString().contains("CANARY")); + assertEquals(200, context.httpRequests().execute(context, HttpRequestService.Call.get("orders", "status", + "check runtime HTTP control", "prove the independent runtime transport remains usable")).status()); + assertEquals(1, calls.get()); assertEquals(1, runtimeRequests.get()); assertEquals(trace, runtimeTrace.get()); + var mapper = new com.fasterxml.jackson.databind.ObjectMapper(); + System.out.println("JAVA_HTTP_CONTRACT_CASE=" + mapper.writeValueAsString(Map.of("id", "HTTP-15", + "realAwsSdk", true, "sdkPhysicalRequests", 1, "runtimeCallsDuringSdk", 0, "runtimeControlCalls", 1, + "signedAuthorizationPreserved", true, "sdkTraceNotInjected", true))); + System.out.println("JAVA_HTTP_SOURCE_ORIGINS=" + mapper.writeValueAsString(Map.of( + "core", UserContext.class.getProtectionDomain().getCodeSource().getLocation().toString(), + "runtime", DefaultUserContext.class.getProtectionDomain().getCodeSource().getLocation().toString(), + "http", JdkHttpRequestService.class.getProtectionDomain().getCodeSource().getLocation().toString(), + "s3", S3ObjectStorage.class.getProtectionDomain().getCodeSource().getLocation().toString(), + "aws", S3Client.class.getProtectionDomain().getCodeSource().getLocation().toString()))); + } finally { server.stop(0); } + } +} diff --git a/teaql-opentelemetry/pom.xml b/teaql-opentelemetry/pom.xml index 98ba7eeec..dc04b83f1 100644 --- a/teaql-opentelemetry/pom.xml +++ b/teaql-opentelemetry/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-opentelemetry diff --git a/teaql-oracle/pom.xml b/teaql-oracle/pom.xml index 4ca116492..3095313e6 100644 --- a/teaql-oracle/pom.xml +++ b/teaql-oracle/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-oracle teaql-oracle diff --git a/teaql-postgres/pom.xml b/teaql-postgres/pom.xml index acb8f0fd1..ec7bdcbd5 100644 --- a/teaql-postgres/pom.xml +++ b/teaql-postgres/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-postgres teaql-postgres diff --git a/teaql-provider-jdbc/pom.xml b/teaql-provider-jdbc/pom.xml index ce07e33d3..0284b8dea 100644 --- a/teaql-provider-jdbc/pom.xml +++ b/teaql-provider-jdbc/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml @@ -15,6 +15,10 @@ Direct JDBC Execution Adapter provider for TeaQL + + io.teaql + teaql-utils + io.teaql teaql-data-service-sql diff --git a/teaql-provider-jdbc/src/main/java/io/teaql/provider/jdbc/JdbcSqlExecutor.java b/teaql-provider-jdbc/src/main/java/io/teaql/provider/jdbc/JdbcSqlExecutor.java index c433a51e5..ca157cc65 100644 --- a/teaql-provider-jdbc/src/main/java/io/teaql/provider/jdbc/JdbcSqlExecutor.java +++ b/teaql-provider-jdbc/src/main/java/io/teaql/provider/jdbc/JdbcSqlExecutor.java @@ -17,10 +17,19 @@ public class JdbcSqlExecutor implements SqlExecutionAdapter { + // Cap SQLite plain-text materialization before expanding exponent-form + // BigDecimal inputs. Model precision/scale checks remain separate. + private static final long MAX_SQLITE_DECIMAL_TEXT_LENGTH = 1_000_000L; + private final DataSource dataSource; // A held view retains only this token, not the executor, connection or DataSource. private final Object storageIdentity = new Object(); private final ThreadLocal transactionConnection = new ThreadLocal<>(); + private final ThreadLocal transactionCompletion = new ThreadLocal<>(); + private static final class TransactionCompletion { + final List commits = new ArrayList<>(), rollbacks = new ArrayList<>(); + boolean rollbackOnly; + } private final List> connectionInitializers = new CopyOnWriteArrayList<>(); public JdbcSqlExecutor(DataSource dataSource) { @@ -219,7 +228,7 @@ private record JdbcDataRow(ResultSet resultSet) implements io.teaql.core.DataRow @Override public Object get(int columnIndex) { try { - return resultSet.getObject(columnIndex); + return finiteColumn(resultSet, columnIndex); } catch (SQLException exception) { throw new RuntimeException("Failed to read JDBC column " + columnIndex, exception); } @@ -228,29 +237,33 @@ public Object get(int columnIndex) { @Override public V get(int columnIndex, Class type) { try { - Object value = resultSet.getObject(columnIndex); + Object value = finiteConversion(resultSet.getObject(columnIndex)); return convertColumn(type, value); } catch (SQLException exception) { throw new RuntimeException("Failed to read JDBC column " + columnIndex + " as " + type.getName(), exception); + } catch (ArithmeticException | IllegalArgumentException invalid) { + String label = null; + try { + label = resultSet.getMetaData().getColumnLabel(columnIndex); + } catch (SQLException ignored) { } + // NumberFormatException messages and causes can retain private + // text. Report the column/type, not the value or its exception. + throw io.teaql.dataservice.sql.SqlNumericConversions.invalidColumn(columnIndex, label, type); } } @SuppressWarnings("unchecked") private static V convertColumn(Class type, Object value) { - if (value == null || type.isInstance(value)) return (V) value; + if (value == null) return null; + // Check floating targets even when JDBC already returned the same + // boxed type; otherwise NaN/Infinity bypass validation entirely. + if (value instanceof Number number && (type == Float.class || type == Double.class)) { + return (V) io.teaql.dataservice.sql.SqlNumericConversions.convert(type, number); + } + if (type.isInstance(value)) return (V) value; if (value instanceof Number number) { - if (type == Long.class) return (V) Long.valueOf(number.longValue()); - if (type == Integer.class) return (V) Integer.valueOf(number.intValue()); - if (type == Double.class) return (V) Double.valueOf(number.doubleValue()); - if (type == Float.class) return (V) Float.valueOf(number.floatValue()); - if (type == Short.class) return (V) Short.valueOf(number.shortValue()); - if (type == Byte.class) return (V) Byte.valueOf(number.byteValue()); - if (type == java.math.BigDecimal.class) { - return (V) (number instanceof java.math.BigInteger integer - ? new java.math.BigDecimal(integer) - : java.math.BigDecimal.valueOf(number.doubleValue())); - } + if (io.teaql.dataservice.sql.SqlNumericConversions.supports(type)) return (V) io.teaql.dataservice.sql.SqlNumericConversions.convert(type, number); if (type == Boolean.class) return (V) Boolean.valueOf(number.longValue() != 0); } if (type == java.time.LocalDateTime.class && value instanceof java.sql.Timestamp timestamp) { @@ -281,6 +294,9 @@ private static V convertColumn(Class type, Object value) { return (V) java.time.LocalTime.parse(separator < 0 ? text : text.substring(separator + 1)); } if (type == String.class) return (V) String.valueOf(value); + if (type == java.math.BigDecimal.class && value instanceof CharSequence text) { + return (V) new java.math.BigDecimal(text.toString()); + } throw new IllegalArgumentException("Cannot convert JDBC value " + value.getClass().getName() + " to " + type.getName()); } @@ -289,10 +305,28 @@ private static V convertColumn(Class type, Object value) { private static JdbcColumnRow readColumnRow(ResultSet resultSet, JdbcColumnRow.Layout layout, int width) throws SQLException { Object[] values = new Object[width]; - for (int i = 0; i < width; i++) values[i] = resultSet.getObject(i + 1); + for (int i = 0; i < width; i++) values[i] = finiteColumn(resultSet, i + 1); return new JdbcColumnRow(layout, values); } + private static Object finiteColumn(ResultSet resultSet, int column) throws SQLException { + Object value = resultSet.getObject(column); + if (nonFiniteNumber(value)) + throw new SQLException("Non-finite JDBC numeric field " + resultSet.getMetaData().getColumnLabel(column)); + return value; + } + + private static Object finiteConversion(Object value) { + if (nonFiniteNumber(value)) + throw new IllegalArgumentException("JDBC numeric value is outside the finite target range"); + return value; + } + + private static boolean nonFiniteNumber(Object value) { + return value instanceof Double doubleValue && !Double.isFinite(doubleValue) + || value instanceof Float floatValue && !Float.isFinite(floatValue); + } + private static String[] columnLabels(ResultSet resultSet) throws SQLException { java.sql.ResultSetMetaData metadata = resultSet.getMetaData(); int columnCount = metadata.getColumnCount(); @@ -382,30 +416,62 @@ public int[] batchUpdate(String sql, List paramsList) { @Override public void executeInTransaction(Runnable action) { if (transactionConnection.get() != null) { - action.run(); + try { action.run(); } + catch (RuntimeException | Error failure) { + transactionCompletion.get().rollbackOnly = true; + throw failure; + } return; } + var completion = new TransactionCompletion(); + boolean committed = false; + Throwable failure = null; try (Connection connection = openConnection()) { boolean autoCommit = connection.getAutoCommit(); connection.setAutoCommit(false); transactionConnection.set(connection); + transactionCompletion.set(completion); try { action.run(); + if (completion.rollbackOnly) throw new IllegalStateException("JDBC transaction is rollback-only"); connection.commit(); - } catch (RuntimeException | Error failure) { - connection.rollback(); - throw failure; + committed = true; + } catch (RuntimeException | Error | SQLException error) { + try { connection.rollback(); } catch (SQLException rollback) { error.addSuppressed(rollback); } + throw error; } finally { transactionConnection.remove(); + transactionCompletion.remove(); connection.setAutoCommit(autoCommit); } - } catch (SQLException e) { - throw new RuntimeException("JDBC transaction failed", e); + } catch (RuntimeException | Error | SQLException error) { + failure = error; + } + // Never deliver audit while a connection is still marked active. A sink + // failure after successful commit must not manufacture a rollback. + var callbacks = committed ? completion.commits : completion.rollbacks; + for (int index = 0; index < callbacks.size(); index++) { + int selected = committed ? index : callbacks.size() - 1 - index; + try { callbacks.get(selected).run(); } + catch (RuntimeException | Error error) { + if (failure == null) failure = error; else if (failure != error) failure.addSuppressed(error); + } } + if (failure instanceof Error error) throw error; + if (failure instanceof RuntimeException error) throw error; + if (failure != null) throw new RuntimeException("JDBC transaction failed", failure); } @Override public boolean hasActiveTransaction() { return transactionConnection.get() != null; } + @Override public boolean registerTransactionSynchronization(Runnable committed, Runnable rolledBack) { + var completion = transactionCompletion.get(); + if (completion == null) return false; + completion.commits.add(java.util.Objects.requireNonNull(committed)); + completion.rollbacks.add(java.util.Objects.requireNonNull(rolledBack)); + return true; + } + static void bind(PreparedStatement statement, int index, Object value) throws SQLException { if (value == null) { // Let the driver infer the target column type. DB2 rejects the @@ -421,10 +487,27 @@ static void bind(PreparedStatement statement, int index, Object value) throws SQ } else if (value instanceof Byte number) { statement.setByte(index, number); } else if (value instanceof java.math.BigDecimal number) { - statement.setBigDecimal(index, number); + // SQLite's exact Decimal columns require canonical plain text. The + // driver binds exponent-form BigDecimal values (for example 1E-7) + // as exponent text, which the column CHECK correctly rejects. + // Keep native numeric binding for the other JDBC providers. + if (isSqlite(statement)) { + long precision = number.precision(); + long scale = number.scale(); + long plainLength = scale <= 0 + ? precision - scale + : Math.max(precision, scale + 1) + 1; + if (number.signum() < 0) plainLength++; + if (plainLength > MAX_SQLITE_DECIMAL_TEXT_LENGTH) { + throw new SQLException("SQLite Decimal plain-text representation exceeds safe length"); + } + statement.setString(index, number.toPlainString()); + } else statement.setBigDecimal(index, number); } else if (value instanceof Double number) { + if (!Double.isFinite(number)) throw new SQLException("Non-finite JDBC floating-point parameter " + index); statement.setDouble(index, number); } else if (value instanceof Float number) { + if (!Float.isFinite(number)) throw new SQLException("Non-finite JDBC floating-point parameter " + index); statement.setFloat(index, number); } else if (value instanceof Boolean booleanValue) { statement.setBoolean(index, booleanValue); @@ -438,7 +521,7 @@ static void bind(PreparedStatement statement, int index, Object value) throws SQ } } else if (value instanceof java.time.LocalDateTime dateTime) { if (isSqlite(statement)) { - statement.setString(index, java.sql.Timestamp.valueOf(dateTime).toString()); + statement.setString(index, io.teaql.core.utils.LocalDateTimeUtil.formatSql(dateTime)); } else { statement.setTimestamp(index, java.sql.Timestamp.valueOf(dateTime)); } diff --git a/teaql-provider-jdbc/src/main/java/module-info.java b/teaql-provider-jdbc/src/main/java/module-info.java index c284441ce..c208ad4c5 100644 --- a/teaql-provider-jdbc/src/main/java/module-info.java +++ b/teaql-provider-jdbc/src/main/java/module-info.java @@ -1,6 +1,7 @@ module io.teaql.provider.jdbc { requires io.teaql.core; requires io.teaql.dataservice.sql; + requires io.teaql.utils; requires java.sql; exports io.teaql.provider.jdbc; diff --git a/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/FiniteJdbcScalarTest.java b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/FiniteJdbcScalarTest.java new file mode 100644 index 000000000..d88b5562c --- /dev/null +++ b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/FiniteJdbcScalarTest.java @@ -0,0 +1,76 @@ +package io.teaql.provider.jdbc; + +import io.teaql.core.BaseEntity; +import io.teaql.core.CompiledRowMapper; +import java.lang.reflect.Proxy; +import java.sql.*; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; +import static org.junit.Assert.*; + +public class FiniteJdbcScalarTest { + @Test public void bindingRejectsEveryNonfiniteBeforeCallingTheDriverSetter() { + var calls = new AtomicInteger(); + var statement = (PreparedStatement)Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), + new Class[]{PreparedStatement.class}, (proxy, method, args) -> { calls.incrementAndGet(); return null; }); + for (Number number : List.of(Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, + Float.NaN, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY)) { + var error = assertThrows(SQLException.class, () -> JdbcSqlExecutor.bind(statement,1,number)); + assertEquals("Non-finite JDBC floating-point parameter 1",error.getMessage()); + assertEquals(0,calls.get()); + } + } + @Test public void finiteValuesNegativeZeroAndNullReachTheDriverWithoutNarrowing() throws Exception { + var values = new ArrayList(); + var statement = (PreparedStatement)Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), + new Class[]{PreparedStatement.class}, (proxy, method, args) -> { values.add(args[1]); return null; }); + var expected = Arrays.asList(null, -0.0d, Double.MIN_VALUE, Double.MAX_VALUE, -0.0f, Float.MIN_VALUE, Float.MAX_VALUE, Long.MAX_VALUE); + for (Object value : expected) JdbcSqlExecutor.bind(statement,1,value); + assertEquals(expected,values); + assertEquals(Double.doubleToRawLongBits(-0.0d),Double.doubleToRawLongBits((Double)values.get(1))); + } + static SQLiteDataSource database() { + var source = new SQLiteDataSource(); source.setUrl("jdbc:sqlite:file:finite-" + UUID.randomUUID() + "?mode=memory&cache=shared"); return source; + } + static void corrupt(Connection db, double value) throws SQLException { + db.createStatement().execute("CREATE TABLE numbers (id INTEGER PRIMARY KEY, amount REAL, version INTEGER)"); + try (var statement = db.prepareStatement("INSERT INTO numbers VALUES (1,?,1)")) { + statement.setDouble(1,value); statement.executeUpdate(); + } + } + static CompiledRowMapper numeric(Class type) { + return row -> { row.get(1,type); return new BaseEntity(); }; + } + static void unchanged(Connection db, double value) throws SQLException { + try (var statement = db.createStatement(); var rows = statement.executeQuery("SELECT amount,version FROM numbers")) { + assertTrue(rows.next()); assertEquals(Double.doubleToLongBits(value),Double.doubleToLongBits(rows.getDouble(1))); + assertEquals(1,rows.getLong(2)); assertFalse(rows.next()); + } + } + @Test public void corruptLegacyInfinityRejectsMapTypedAndStreamingReadsWithoutChangingStorage() throws Exception { + for (double number : new double[]{Double.POSITIVE_INFINITY,Double.NEGATIVE_INFINITY}) { + var source = database(); + try (var witness = source.getConnection()) { + corrupt(witness,number); var sql = new JdbcSqlExecutor(source); + assertThrows(RuntimeException.class, () -> sql.queryForList("SELECT amount FROM numbers",new Object[0])); + assertThrows(RuntimeException.class, () -> {try (var stream = sql.queryForStream("SELECT amount FROM numbers",new Object[0])) { stream.toList(); }}); + assertThrows(RuntimeException.class, () -> sql.query("SELECT amount FROM numbers",new Object[0],numeric(Double.class))); + assertThrows(RuntimeException.class, () -> {try (var stream = sql.queryForStream("SELECT amount FROM numbers",new Object[0],numeric(Double.class))) { stream.toList(); }}); + assertEquals(1,sql.queryForList("SELECT id FROM numbers",new Object[0]).size()); + unchanged(witness,number); + } + } + } + @Test public void finiteDoubleThatOverflowsFloatRejectsTypedNarrowing() throws Exception { + var source = database(); + try (var witness = source.getConnection()) { + double wide = 3.5e38; corrupt(witness,wide); var sql = new JdbcSqlExecutor(source); + assertEquals(wide,(Double)sql.queryForList("SELECT amount FROM numbers",new Object[0]).get(0).get("amount"),0); + assertThrows(RuntimeException.class, () -> sql.query("SELECT amount FROM numbers",new Object[0],numeric(Float.class))); + assertThrows(RuntimeException.class, () -> {try (var stream = sql.queryForStream("SELECT amount FROM numbers",new Object[0],numeric(Float.class))) { stream.toList(); }}); + unchanged(witness,wide); + } + } +} diff --git a/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcExactNumericReadTest.java b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcExactNumericReadTest.java new file mode 100644 index 000000000..df4c8b694 --- /dev/null +++ b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcExactNumericReadTest.java @@ -0,0 +1,166 @@ +package io.teaql.provider.jdbc; + +import io.teaql.core.BaseEntity; +import io.teaql.core.CompiledRowMapper; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Proxy; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.UUID; +import java.util.logging.Logger; +import java.util.stream.Stream; +import javax.sql.DataSource; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import static org.junit.Assert.*; + +/** Real JDBC values through the same typed DataRow used by compiled entity mappers. */ +@RunWith(Parameterized.class) +public class JdbcExactNumericReadTest { + private record Vector(String name, String expression, Class target, Object expected, boolean rejected) {} + private final String driver; + private final boolean streaming; + private final Vector vector; + private final List connections = new ArrayList<>(); + + public JdbcExactNumericReadTest(String name, String driver, boolean streaming, Vector vector) { + this.driver = driver; this.streaming = streaming; this.vector = vector; + } + + private static Vector good(String name, String sql, Class type, Object expected) { + return new Vector(name, sql, type, expected, false); + } + private static Vector bad(String name, String sql, Class type) { + return new Vector(name, sql, type, null, true); + } + @Parameterized.Parameters(name = "{0}") + public static Collection vectors() { + var common = List.of( + good("integer-zero", "CAST(0 AS BIGINT)", Integer.class, 0), + good("integer-maximum", "CAST(2147483647 AS BIGINT)", Integer.class, Integer.MAX_VALUE), + good("integer-minimum", "CAST(-2147483648 AS BIGINT)", Integer.class, Integer.MIN_VALUE), + good("long-maximum", "CAST(9223372036854775807 AS BIGINT)", Long.class, Long.MAX_VALUE), + good("long-minimum", "CAST(-9223372036854775808 AS BIGINT)", Long.class, Long.MIN_VALUE), + good("byte-maximum", "CAST(127 AS INTEGER)", Byte.class, Byte.MAX_VALUE), + good("byte-minimum", "CAST(-128 AS INTEGER)", Byte.class, Byte.MIN_VALUE), + good("short-maximum", "CAST(32767 AS INTEGER)", Short.class, Short.MAX_VALUE), + good("short-minimum", "CAST(-32768 AS INTEGER)", Short.class, Short.MIN_VALUE), + good("null-integer", "CAST(NULL AS INTEGER)", Integer.class, null), + good("null-long", "CAST(NULL AS BIGINT)", Long.class, null), + good("integral-decimal-long", "CAST(9007199254740993 AS DECIMAL(30,0))", Long.class, 9007199254740993L), + good("integral-double-large-exact-binary", "CAST(1152921504606846976 AS DOUBLE)", Long.class, 1152921504606846976L), + good("decimal-from-large-long", "CAST(9007199254740993 AS BIGINT)", BigDecimal.class, new BigDecimal("9007199254740993")), + good("decimal-from-minimum-long", "CAST(-9223372036854775808 AS BIGINT)", BigDecimal.class, new BigDecimal("-9223372036854775808")), + good("decimal-exact-text", "CAST('12345678901234567890.123456789' AS VARCHAR)", BigDecimal.class, new BigDecimal("12345678901234567890.123456789")), + good("finite-float", "CAST(3.50 AS DOUBLE)", Float.class, 3.50F), + good("finite-double", "CAST(2.25 AS DOUBLE)", Double.class, 2.25D), + good("approximate-float-remains-approximate", "CAST(0.1 AS DOUBLE)", Float.class, 0.1F), + bad("fraction-to-long", "CAST(1.9 AS DECIMAL(30,3))", Long.class), + bad("fraction-to-integer", "CAST(-1.9 AS DECIMAL(30,3))", Integer.class), + bad("fraction-to-short", "CAST(0.5 AS DECIMAL(30,3))", Short.class), + bad("fraction-to-byte", "CAST(-0.5 AS DECIMAL(30,3))", Byte.class), + bad("integer-upper-overflow", "CAST(2147483648 AS BIGINT)", Integer.class), + bad("integer-lower-overflow", "CAST(-2147483649 AS BIGINT)", Integer.class), + bad("short-upper-overflow", "CAST(32768 AS INTEGER)", Short.class), + bad("short-lower-overflow", "CAST(-32769 AS INTEGER)", Short.class), + bad("byte-upper-overflow", "CAST(128 AS INTEGER)", Byte.class), + bad("byte-lower-overflow", "CAST(-129 AS INTEGER)", Byte.class), + bad("float-overflow", "1e40", Float.class), + bad("double-positive-infinity", "1e999", Double.class), + bad("double-negative-infinity", "-1e999", Double.class), + bad("decimal-private-invalid-text", "CAST('PRIVATE-JDBC-VALUE-901' AS VARCHAR)", BigDecimal.class)); + var result = new ArrayList(); + for (String driver : List.of("h2", "sqlite")) { + var selected = new ArrayList<>(common); + if (driver.equals("h2")) selected.addAll(List.of( + bad("long-upper-overflow", "CAST(9223372036854775808 AS DECIMAL(40,0))", Long.class), + bad("long-lower-overflow", "CAST(-9223372036854775809 AS DECIMAL(40,0))", Long.class), + bad("long-upper-fraction", "CAST(9223372036854775807.5 AS DECIMAL(40,1))", Long.class), + bad("long-lower-fraction", "CAST(-9223372036854775808.5 AS DECIMAL(40,1))", Long.class), + bad("double-nan", "CAST('NaN' AS DOUBLE)", Double.class), + bad("float-nan", "CAST('NaN' AS DOUBLE)", Float.class))); + // SQLite has already rounded an out-of-range decimal SQL literal to + // a binary float. Test its observable upper limit, not lost digits. + else selected.add(bad("long-rounded-upper-overflow", "9223372036854775808.0", Long.class)); + for (boolean stream : List.of(false, true)) for (Vector vector : selected) { + result.add(new Object[]{driver + "/" + (stream ? "stream/" : "list/") + vector.name, driver, stream, vector}); + } + } + return result; + } + + @Test public void typedReadIsExactOrFailsBeforeReturningAnEntity() throws Exception { + String url = driver.equals("h2") ? "jdbc:h2:mem:exact_" + UUID.randomUUID() : "jdbc:sqlite::memory:"; + var source = new TrackingDataSource(url); + var adapter = new JdbcSqlExecutor(source); + String sql = "SELECT " + vector.expression + " AS required_numeric"; + // Calibrate the SQL and actual driver value independently. Unsupported + // SQL must be an error, not mistaken for successful conversion rejection. + // Bypass the adapter only for calibration: its untyped reads must also + // reject non-finite values, so they cannot serve as a raw-driver oracle. + try (var connection = source.getConnection(); + var statement = connection.createStatement(); + var raw = statement.executeQuery(sql)) { + assertEquals(1, raw.getMetaData().getColumnCount()); + assertTrue(raw.getMetaData().getColumnLabel(1).equalsIgnoreCase("required_numeric")); + assertTrue(raw.next()); + if (!vector.rejected && vector.expected == null) assertNull(raw.getObject(1)); + else assertNotNull(raw.getObject(1)); + assertFalse(raw.next()); + } + if (vector.rejected) { + var error = assertThrows(IllegalArgumentException.class, () -> read(adapter, sql, vector.target)); + assertTrue(error.getMessage(), error.getMessage().contains("column 1")); + assertTrue(error.getMessage(), error.getMessage().contains("required_numeric")); + assertTrue(error.getMessage(), error.getMessage().contains(vector.target.getName())); + assertFalse(error.toString(), error.toString().contains("PRIVATE-JDBC-VALUE-901")); + assertNull("conversion causes must not retain untrusted field values", error.getCause()); + } else assertEquals(vector.name, vector.expected, read(adapter, sql, vector.target)); + assertEquals("calibration plus typed query", 2, connections.size()); + assertClosed(); + assertEquals("same adapter recovers after a bad value", Integer.valueOf(7), read(adapter, "SELECT 7 AS required_numeric", Integer.class)); + assertEquals(3, connections.size()); assertClosed(); + } + + private Object read(JdbcSqlExecutor adapter, String sql, Class type) throws Exception { + CompiledRowMapper mapper = row -> { var entity = new ScalarRow(); entity.value = row.get(1, type); return entity; }; + if (!streaming) return adapter.query(sql, new Object[0], mapper).get(0).value; + try (Stream rows = adapter.queryForStream(sql, new Object[0], mapper)) { + try { return rows.findFirst().orElseThrow().value; } + catch (RuntimeException failure) { + // Check automatic failure cleanup before try-with-resources + // closes the stream; otherwise a cursor leak would be hidden. + assertClosed(); throw failure; + } + } + } + private void assertClosed() throws SQLException { for (Connection c : connections) assertTrue("query leaked its owned connection", c.isClosed()); } + private static final class ScalarRow extends BaseEntity { Object value; } + private final class TrackingDataSource implements DataSource { + private final String url; + TrackingDataSource(String url) { this.url = url; } + @Override public Connection getConnection() throws SQLException { + Connection delegate = DriverManager.getConnection(url); + Connection tracked = (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{Connection.class}, (p,m,a) -> { + try { return m.invoke(delegate, a); } catch (InvocationTargetException e) { throw e.getCause(); } + }); + connections.add(tracked); return tracked; + } + @Override public Connection getConnection(String u,String p) throws SQLException { return getConnection(); } + @Override public PrintWriter getLogWriter() { return null; } + @Override public void setLogWriter(PrintWriter out) {} + @Override public void setLoginTimeout(int seconds) {} + @Override public int getLoginTimeout() { return 0; } + @Override public Logger getParentLogger() throws SQLFeatureNotSupportedException { throw new SQLFeatureNotSupportedException(); } + @Override public T unwrap(Class iface) throws SQLException { throw new SQLException("not a wrapper"); } + @Override public boolean isWrapperFor(Class iface) { return false; } + } +} diff --git a/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcSqlExecutorTest.java b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcSqlExecutorTest.java index 7e3112673..1e734d90d 100644 --- a/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcSqlExecutorTest.java +++ b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcSqlExecutorTest.java @@ -18,6 +18,7 @@ import java.util.logging.Logger; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; public class JdbcSqlExecutorTest { @@ -162,6 +163,46 @@ public void testSqliteLocalDateParametersUseIsoTextOrdering() throws Exception { } } + @Test + public void sqliteDecimalBindingRejectsExponentExpansionBeforeMaterialization() throws Exception { + try (Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:"); + java.sql.PreparedStatement query = connection.prepareStatement("SELECT ?")) { + assertThrows(SQLException.class, () -> JdbcSqlExecutor.bind( + query, 1, new java.math.BigDecimal("1E-1000000000"))); + assertThrows(SQLException.class, () -> JdbcSqlExecutor.bind( + query, 1, new java.math.BigDecimal("1E+1000000000"))); + JdbcSqlExecutor.bind(query, 1, new java.math.BigDecimal("1E-7")); + try (ResultSet result = query.executeQuery()) { + assertTrue(result.next()); + assertEquals("0.0000001", result.getString(1)); + } + } + } + + @Test + public void sqliteDateTimeBoundaryKeepsDstGapWallTimeAndSqlLiteralAligned() throws Exception { + var zone = java.util.TimeZone.getDefault(); + var value = java.time.LocalDateTime.of(2024, 3, 10, 2, 30, 0, 123456789); + try { + for (var name : List.of("UTC", "America/New_York", "Asia/Shanghai")) { + java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone(name)); + Object[] effective = io.teaql.core.sql.portable.SqlTemporalPrecision.parameters(new Object[]{value}); + try (Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:"); + java.sql.PreparedStatement query = connection.prepareStatement("SELECT ?")) { + JdbcSqlExecutor.bind(query, 1, effective[0]); + try (ResultSet result = query.executeQuery()) { + assertTrue(result.next());assertEquals("2024-03-10 02:30:00.123", result.getString(1)); + } + try (ResultSet result = connection.createStatement().executeQuery( + io.teaql.dataservice.sql.SqlDataServiceExecutor.debugSql("SELECT ?", new Object[]{value}))) { + assertTrue(result.next());assertEquals("2024-03-10 02:30:00.123", result.getString(1)); + } + } + assertEquals(123456789, value.getNano()); + } + } finally { java.util.TimeZone.setDefault(zone); } + } + @Test public void testBatchUpdate() throws Exception { List batch = new ArrayList<>(); diff --git a/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcTransactionCompletionTest.java b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcTransactionCompletionTest.java new file mode 100644 index 000000000..bd516b21c --- /dev/null +++ b/teaql-provider-jdbc/src/test/java/io/teaql/provider/jdbc/JdbcTransactionCompletionTest.java @@ -0,0 +1,106 @@ +package io.teaql.provider.jdbc; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Completion belongs to the physical owner, never to an inner save call. */ +public class JdbcTransactionCompletionTest { + private record Source(String url) implements javax.sql.DataSource { + public java.sql.Connection getConnection() throws java.sql.SQLException { return java.sql.DriverManager.getConnection(url); } + public java.sql.Connection getConnection(String user, String password) throws java.sql.SQLException { return getConnection(); } + public java.io.PrintWriter getLogWriter() { return null; } + public void setLogWriter(java.io.PrintWriter value) {} + public void setLoginTimeout(int value) {} + public int getLoginTimeout() { return 0; } + public java.util.logging.Logger getParentLogger() { return java.util.logging.Logger.getGlobal(); } + public T unwrap(Class type) throws java.sql.SQLException { throw new java.sql.SQLException("Not a wrapper"); } + public boolean isWrapperFor(Class type) { return false; } + } + + private JdbcSqlExecutor fixture() { + var source = new Source("jdbc:h2:mem:" + UUID.randomUUID() + ";DB_CLOSE_DELAY=-1"); + var sql = new JdbcSqlExecutor(source); + sql.execute("CREATE TABLE completion_test(id INT PRIMARY KEY)"); + return sql; + } + + @Test public void noActiveTransactionCannotAcceptCallbacks() { + var sql = fixture(); + assertFalse(sql.registerTransactionSynchronization(() -> fail(), () -> fail())); + assertFalse(sql.hasActiveTransaction()); + } + + @Test public void nestedCallbacksWaitForPhysicalCommitAndRunOutsideIt() { + var sql = fixture(); var observed = new ArrayList(); + sql.executeInTransaction(() -> { + sql.update("INSERT INTO completion_test VALUES(?)", new Object[]{1}); + assertTrue(sql.registerTransactionSynchronization(() -> { + assertFalse(sql.hasActiveTransaction()); + assertEquals(1, sql.queryForList("SELECT id FROM completion_test", new Object[0]).size()); + observed.add("outer"); + }, () -> fail("unexpected rollback"))); + sql.executeInTransaction(() -> assertTrue(sql.registerTransactionSynchronization( + () -> observed.add("inner"), () -> fail("unexpected rollback")))); + assertTrue(observed.isEmpty()); + }); + assertEquals(List.of("outer", "inner"), observed); + assertFalse(sql.registerTransactionSynchronization(() -> fail(), () -> fail())); + } + + @Test public void rollbackCallbacksRunInReverseAndRetainOriginalFailure() { + var sql = fixture(); var observed = new ArrayList(); + var original = new IllegalArgumentException("intentional action failure"); + var actual = assertThrows(IllegalArgumentException.class, () -> sql.executeInTransaction(() -> { + sql.update("INSERT INTO completion_test VALUES(?)", new Object[]{1}); + sql.registerTransactionSynchronization(() -> fail(), () -> { assertFalse(sql.hasActiveTransaction()); observed.add(1); }); + sql.registerTransactionSynchronization(() -> fail(), () -> { observed.add(2); throw new IllegalStateException("rollback observer"); }); + sql.registerTransactionSynchronization(() -> fail(), () -> observed.add(3)); + throw original; + })); + assertSame(original, actual); assertEquals(1, actual.getSuppressed().length); + assertEquals(List.of(3, 2, 1), observed); + assertTrue(sql.queryForList("SELECT id FROM completion_test", new Object[0]).isEmpty()); + } + + @Test public void swallowedInnerFailureStillForcesOuterRollback() { + var sql = fixture(); var observed = new ArrayList(); + var actual = assertThrows(IllegalStateException.class, () -> sql.executeInTransaction(() -> { + sql.registerTransactionSynchronization(() -> observed.add("commit"), () -> observed.add("rollback")); + try { + sql.executeInTransaction(() -> { + sql.update("INSERT INTO completion_test VALUES(?)", new Object[]{1}); + throw new IllegalArgumentException("inner failure"); + }); + } catch (IllegalArgumentException expected) { /* the caller may not make partial DML committable */ } + })); + assertTrue(actual.getMessage().contains("rollback-only")); + assertEquals(List.of("rollback"), observed); + assertTrue(sql.queryForList("SELECT id FROM completion_test", new Object[0]).isEmpty()); + } + + @Test public void postCommitFailureCannotRollbackCommittedDataOrSkipOtherAudits() { + var sql = fixture(); var observed = new ArrayList(); + var actual = assertThrows(IllegalStateException.class, () -> sql.executeInTransaction(() -> { + sql.update("INSERT INTO completion_test VALUES(?)", new Object[]{1}); + sql.registerTransactionSynchronization(() -> { throw new IllegalStateException("audit unavailable"); }, () -> fail("already committed")); + sql.registerTransactionSynchronization(() -> observed.add("delivered"), () -> fail("already committed")); + })); + assertEquals("audit unavailable", actual.getMessage()); assertEquals(List.of("delivered"), observed); + assertEquals(1, sql.queryForList("SELECT id FROM completion_test", new Object[0]).size()); + assertFalse(sql.hasActiveTransaction()); + } + + @Test public void nextTransactionCannotReuseFailedScopeCallbacks() { + var sql = fixture(); var observed = new ArrayList(); + assertThrows(AssertionError.class, () -> sql.executeInTransaction(() -> { + sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("rollback")); + throw new AssertionError("intentional"); + })); + sql.executeInTransaction(() -> sql.registerTransactionSynchronization(() -> observed.add("commit"), () -> fail())); + assertEquals(List.of("rollback", "commit"), observed); + assertFalse(sql.hasActiveTransaction()); + } +} diff --git a/teaql-provider-spring-jdbc/pom.xml b/teaql-provider-spring-jdbc/pom.xml index 3dc9c064a..45946b04d 100644 --- a/teaql-provider-spring-jdbc/pom.xml +++ b/teaql-provider-spring-jdbc/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-provider-spring-jdbc/src/main/java/io/teaql/provider/springjdbc/SpringJdbcSqlExecutor.java b/teaql-provider-spring-jdbc/src/main/java/io/teaql/provider/springjdbc/SpringJdbcSqlExecutor.java index 7ad5a3f53..3e7bd7dd4 100644 --- a/teaql-provider-spring-jdbc/src/main/java/io/teaql/provider/springjdbc/SpringJdbcSqlExecutor.java +++ b/teaql-provider-spring-jdbc/src/main/java/io/teaql/provider/springjdbc/SpringJdbcSqlExecutor.java @@ -3,8 +3,6 @@ import io.teaql.dataservice.sql.SqlExecutionAdapter; import io.teaql.dataservice.sql.SqlRowMapper; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; -import org.springframework.transaction.support.TransactionTemplate; import java.util.List; import java.util.Map; @@ -16,13 +14,13 @@ public class SpringJdbcSqlExecutor implements SqlExecutionAdapter { private final NamedParameterJdbcTemplate jdbcTemplate; - private final TransactionTemplate transactionTemplate; + private final SpringTransactionCompletion transactionCompletion; public SpringJdbcSqlExecutor(NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; - this.transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager( + this.transactionCompletion = new SpringTransactionCompletion( Objects.requireNonNull(jdbcTemplate.getJdbcTemplate().getDataSource(), - "A DataSource is required for transactional SQL execution"))); + "A DataSource is required for transactional SQL execution")); } @Override @@ -95,7 +93,13 @@ public int[] batchUpdate(String sql, List paramsList) { @Override public void executeInTransaction(Runnable action) { - transactionTemplate.executeWithoutResult(status -> action.run()); + transactionCompletion.execute(action); + } + + @Override public boolean hasActiveTransaction() { return transactionCompletion.active(); } + + @Override public boolean registerTransactionSynchronization(Runnable committed, Runnable rolledBack) { + return transactionCompletion.register(committed, rolledBack); } private record SpringJdbcDataRow(ResultSet resultSet) implements io.teaql.core.DataRow { @@ -115,24 +119,23 @@ public V get(int columnIndex, Class type) { } catch (SQLException exception) { throw new IllegalStateException( "Failed to read JDBC column " + columnIndex + " as " + type.getName(), exception); + } catch (ArithmeticException | IllegalArgumentException invalid) { + String label = null; + try { label = resultSet.getMetaData().getColumnLabel(columnIndex); } + catch (SQLException ignored) { } + throw io.teaql.dataservice.sql.SqlNumericConversions.invalidColumn(columnIndex, label, type); } } @SuppressWarnings("unchecked") private static V convert(Class type, Object value) { - if (value == null || type.isInstance(value)) return (V) value; + if (value == null) return null; + if (value instanceof Number number && (type == Float.class || type == Double.class)) { + return (V) io.teaql.dataservice.sql.SqlNumericConversions.convert(type, number); + } + if (type.isInstance(value)) return (V) value; if (value instanceof Number number) { - if (type == Long.class) return (V) Long.valueOf(number.longValue()); - if (type == Integer.class) return (V) Integer.valueOf(number.intValue()); - if (type == Double.class) return (V) Double.valueOf(number.doubleValue()); - if (type == Float.class) return (V) Float.valueOf(number.floatValue()); - if (type == Short.class) return (V) Short.valueOf(number.shortValue()); - if (type == Byte.class) return (V) Byte.valueOf(number.byteValue()); - if (type == java.math.BigDecimal.class) { - return (V) (number instanceof java.math.BigInteger integer - ? new java.math.BigDecimal(integer) - : java.math.BigDecimal.valueOf(number.doubleValue())); - } + if (io.teaql.dataservice.sql.SqlNumericConversions.supports(type)) return (V) io.teaql.dataservice.sql.SqlNumericConversions.convert(type, number); if (type == Boolean.class) return (V) Boolean.valueOf(number.longValue() != 0); } if (type == java.time.LocalDateTime.class && value instanceof java.sql.Timestamp timestamp) { @@ -163,6 +166,9 @@ private static V convert(Class type, Object value) { return (V) java.time.LocalTime.parse(separator < 0 ? text : text.substring(separator + 1)); } if (type == String.class) return (V) String.valueOf(value); + if (type == java.math.BigDecimal.class && value instanceof CharSequence text) { + return (V) new java.math.BigDecimal(text.toString()); + } throw new IllegalArgumentException( "Cannot convert JDBC value " + value.getClass().getName() + " to " + type.getName()); } diff --git a/teaql-provider-spring-jdbc/src/main/java/io/teaql/provider/springjdbc/SpringTransactionCompletion.java b/teaql-provider-spring-jdbc/src/main/java/io/teaql/provider/springjdbc/SpringTransactionCompletion.java new file mode 100644 index 000000000..a0cedc50b --- /dev/null +++ b/teaql-provider-spring-jdbc/src/main/java/io/teaql/provider/springjdbc/SpringTransactionCompletion.java @@ -0,0 +1,160 @@ +package io.teaql.provider.springjdbc; + +import java.util.ArrayList; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Objects; +import javax.sql.DataSource; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.support.TransactionSynchronization; +import org.springframework.transaction.support.TransactionSynchronizationManager; +import org.springframework.transaction.support.TransactionTemplate; + +/** Provider-only completion bridge; mutation ledgers remain owned by their entity graphs. */ +final class SpringTransactionCompletion { + private final PhysicalTransactionManager manager; + private final TransactionTemplate transactions; + private final TransactionTemplate outsideTransaction; + + SpringTransactionCompletion(DataSource source) { + manager = new PhysicalTransactionManager(source); + transactions = new TransactionTemplate(manager); + outsideTransaction = new TransactionTemplate(manager); + outsideTransaction.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED); + } + + boolean active() { return manager.active(); } + + boolean register(Runnable committed, Runnable rolledBack) { + if (!active()) return false; + Objects.requireNonNull(committed, "committed"); + Objects.requireNonNull(rolledBack, "rolledBack"); + if (!TransactionSynchronizationManager.isSynchronizationActive()) { + // Never fall back to an immediate audit inside an unsynchronized physical transaction. + throw new IllegalStateException("Spring transaction synchronization is required for mutation completion"); + } + Completion completion = currentCompletion(); + if (completion == null) { + completion = new Completion(manager.getDataSource(), outsideTransaction); + TransactionSynchronizationManager.registerSynchronization(completion); + } + completion.callbacks.add(new Callbacks(committed, rolledBack)); + return true; + } + + void execute(Runnable action) { + Objects.requireNonNull(action, "action"); + if (active() && !TransactionSynchronizationManager.isSynchronizationActive()) { + // A participating REQUIRED template could otherwise create its own synchronization + // and publish completion while the unsynchronized physical owner is still pending. + throw new IllegalStateException("Spring transaction synchronization is required for mutation completion"); + } + var observed = new ArrayList(); + try { + transactions.executeWithoutResult(status -> { + try { action.run(); } + finally { + Completion completion = currentCompletion(); + if (completion != null) observed.add(completion); + } + }); + } catch (RuntimeException | Error failure) { + // Spring deliberately logs afterCompletion failures instead of replacing an action's error. + // For an adapter-owned invocation, retain that failure as a suppressed diagnostic as well. + for (Completion completion : observed) { + Throwable callbackFailure = completion.failure; + if (callbackFailure != null && callbackFailure != failure + && java.util.Arrays.stream(failure.getSuppressed()).noneMatch(v -> v == callbackFailure)) { + failure.addSuppressed(callbackFailure); + } + } + throw failure; + } + } + + private Completion currentCompletion() { + if (!TransactionSynchronizationManager.isSynchronizationActive()) return null; + for (TransactionSynchronization synchronization : TransactionSynchronizationManager.getSynchronizations()) { + if (synchronization instanceof Completion completion && completion.source == manager.getDataSource()) { + return completion; + } + } + return null; + } + + /** Use Spring's resource-specific transaction check, not merely a thread-wide active flag. */ + @SuppressWarnings("serial") + private static final class PhysicalTransactionManager extends DataSourceTransactionManager { + PhysicalTransactionManager(DataSource source) { super(source); } + boolean active() { return isExistingTransaction(doGetTransaction()); } + } + + private record Callbacks(Runnable committed, Runnable rolledBack) {} + + private static final class Completion implements TransactionSynchronization { + private final DataSource source; + private final TransactionTemplate outsideTransaction; + private final List callbacks = new ArrayList<>(); + private final IdentityHashMap savepoints = new IdentityHashMap<>(); + private Throwable failure; + private boolean completed; + + Completion(DataSource source, TransactionTemplate outsideTransaction) { + this.source = source; + this.outsideTransaction = outsideTransaction; + } + + @Override public void savepoint(Object savepoint) { savepoints.put(savepoint, callbacks.size()); } + + @Override public void savepointRollback(Object savepoint) { + // A first registration can occur after the savepoint was created. All callbacks in that + // newly registered group then belong to the savepoint and must be undone, not committed. + int start = savepoints.getOrDefault(savepoint, 0); + var abandoned = new ArrayList<>(callbacks.subList(start, callbacks.size())); + callbacks.subList(start, callbacks.size()).clear(); + // Equal positions include this savepoint and outer boundaries with no intervening + // callbacks. Keep them valid for nested and repeated rollbacks to the same boundary. + savepoints.entrySet().removeIf(entry -> entry.getValue() > start); + // Spring invokes this hook before the physical savepoint rollback. These framework-only + // rollback callbacks restore in-memory intent; they must not run new SQL or stop rollback. + invoke(abandoned, false); + } + + @Override public void beforeCommit(boolean readOnly) { rethrow(failure); } + + @Override public void afterCommit() { complete(true); } + + @Override public void afterCompletion(int status) { + // An earlier Spring synchronization may have thrown afterCommit. COMMITTED must still + // deliver our remaining committed audits, never run the rollback restorations instead. + if (!completed) complete(status == STATUS_COMMITTED); + } + + private void complete(boolean committed) { + completed = true; + var selected = new ArrayList<>(callbacks); + callbacks.clear(); savepoints.clear(); + // Spring still binds the completed connection during these hooks. Suspend it through + // supported propagation APIs so an observer cannot accidentally reuse uncommittable DML. + outsideTransaction.executeWithoutResult(status -> invoke(selected, committed)); + rethrow(failure); + } + + private void invoke(List selected, boolean committed) { + for (int i = 0; i < selected.size(); i++) { + Callbacks next = selected.get(committed ? i : selected.size() - i - 1); + try { (committed ? next.committed() : next.rolledBack()).run(); } + catch (RuntimeException | Error error) { + if (failure == null) failure = error; + else if (failure != error) failure.addSuppressed(error); + } + } + } + + private static void rethrow(Throwable failure) { + if (failure instanceof RuntimeException error) throw error; + if (failure instanceof Error error) throw error; + } + } +} diff --git a/teaql-provider-spring-jdbc/src/test/java/io/teaql/provider/springjdbc/SpringJdbcExactNumericReadTest.java b/teaql-provider-spring-jdbc/src/test/java/io/teaql/provider/springjdbc/SpringJdbcExactNumericReadTest.java new file mode 100644 index 000000000..98c11d40c --- /dev/null +++ b/teaql-provider-spring-jdbc/src/test/java/io/teaql/provider/springjdbc/SpringJdbcExactNumericReadTest.java @@ -0,0 +1,75 @@ +package io.teaql.provider.springjdbc; + +import io.teaql.core.BaseEntity; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.UUID; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.datasource.AbstractDataSource; +import static org.junit.Assert.*; + +/** The Spring provider must implement the same typed numeric boundary as JDBC. */ +@RunWith(Parameterized.class) +public class SpringJdbcExactNumericReadTest { + private record Vector(String name, String expression, Class target, Object expected, boolean rejected) {} + private final Vector vector; + private final List connections = new ArrayList<>(); + public SpringJdbcExactNumericReadTest(String name, Vector vector) { this.vector = vector; } + private static Vector good(String name, String sql, Class type, Object expected) { return new Vector(name,sql,type,expected,false); } + private static Vector bad(String name, String sql, Class type) { return new Vector(name,sql,type,null,true); } + @Parameterized.Parameters(name="{0}") public static Collection vectors() { + return List.of( + bad("integer-fraction","CAST(1.9 AS DECIMAL(30,3))",Integer.class), + bad("integer-overflow","CAST(2147483648 AS BIGINT)",Integer.class), + bad("long-fraction","CAST(-1.9 AS DECIMAL(30,3))",Long.class), + bad("long-overflow","CAST(9223372036854775808 AS DECIMAL(40,0))",Long.class), + good("decimal-large-long","CAST(9007199254740993 AS BIGINT)",BigDecimal.class,new BigDecimal("9007199254740993")), + good("decimal-minimum-long","CAST(-9223372036854775808 AS BIGINT)",BigDecimal.class,new BigDecimal("-9223372036854775808")), + good("decimal-exact-text","CAST('12345678901234567890.123456789' AS VARCHAR)",BigDecimal.class,new BigDecimal("12345678901234567890.123456789")), + bad("double-infinity","1e999",Double.class), + bad("float-overflow","1e40",Float.class), + bad("private-invalid-text","CAST('PRIVATE_SPRING_NUMERIC_901' AS VARCHAR)",BigDecimal.class), + good("integer-maximum","CAST(2147483647 AS INTEGER)",Integer.class,Integer.MAX_VALUE), + good("long-minimum","CAST(-9223372036854775808 AS BIGINT)",Long.class,Long.MIN_VALUE), + good("finite-float","CAST(1.25 AS DOUBLE)",Float.class,1.25f)) + .stream().map(v -> new Object[]{v.name,v}).toList(); + } + @Test public void typedReadIsExactOrRejectsWithoutPrivateValues() throws Exception { + String url="jdbc:h2:mem:spring_exact_"+UUID.randomUUID(); + var data = new AbstractDataSource() { + @Override public Connection getConnection() throws SQLException { var c=DriverManager.getConnection(url); connections.add(c); return c; } + @Override public Connection getConnection(String user,String password) throws SQLException { return getConnection(); } + }; + var adapter=new SpringJdbcSqlExecutor(new NamedParameterJdbcTemplate(data)); + String sql="SELECT "+vector.expression+" AS required_numeric"; + // SQL and the driver must succeed before a conversion rejection counts. + var calibrated=adapter.queryForList(sql,new Object[0]);assertEquals(1,calibrated.size());assertEquals(1,calibrated.get(0).size()); + if(vector.rejected){ + var error=assertThrows(IllegalArgumentException.class,()->read(adapter,sql,vector.target)); + assertTrue(error.getMessage(),error.getMessage().contains("column 1")); + assertTrue(error.getMessage(),error.getMessage().contains("required_numeric")); + assertTrue(error.getMessage(),error.getMessage().contains(vector.target.getName())); + assertFalse(error.toString().contains("PRIVATE_SPRING_NUMERIC_901"));assertNull(error.getCause()); + }else{ + Object value=null; + try { value=read(adapter,sql,vector.target); } + catch(RuntimeException failure){ fail("A valid typed numeric value was rejected: "+failure.getClass().getName()); } + assertEquals(vector.name,vector.expected,value); + } + assertEquals(2,connections.size());assertClosed(); + assertEquals(Long.valueOf(7),read(adapter,"SELECT 7 AS required_numeric",Long.class));assertEquals(3,connections.size());assertClosed(); + } + private Object read(SpringJdbcSqlExecutor adapter,String sql,Class target){ + return adapter.query(sql,new Object[0],row->{var entity=new ScalarRow();entity.value=row.get(1,target);return entity;}).get(0).value; + } + private void assertClosed() throws SQLException { for(var c:connections)assertTrue("typed read leaked its owned connection",c.isClosed()); } + private static final class ScalarRow extends BaseEntity { Object value; } +} diff --git a/teaql-provider-spring-jdbc/src/test/java/io/teaql/provider/springjdbc/SpringTransactionCompletionTest.java b/teaql-provider-spring-jdbc/src/test/java/io/teaql/provider/springjdbc/SpringTransactionCompletionTest.java new file mode 100644 index 000000000..0f2a84da3 --- /dev/null +++ b/teaql-provider-spring-jdbc/src/test/java/io/teaql/provider/springjdbc/SpringTransactionCompletionTest.java @@ -0,0 +1,329 @@ +package io.teaql.provider.springjdbc; + +import java.util.ArrayList; +import java.util.List; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.UnexpectedRollbackException; +import org.springframework.transaction.support.TransactionSynchronizationManager; +import org.springframework.transaction.support.TransactionTemplate; +import static org.junit.Assert.*; + +/** Completion belongs to the physical Spring owner, including an application-owned transaction. */ +public class SpringTransactionCompletionTest { + private EmbeddedDatabase source; + private SpringJdbcSqlExecutor sql; + + @Before public void prepare() { + source = new EmbeddedDatabaseBuilder().generateUniqueName(true).setType(EmbeddedDatabaseType.H2).build(); + sql = new SpringJdbcSqlExecutor(new NamedParameterJdbcTemplate(source)); + sql.execute("CREATE TABLE completion_test(id INT PRIMARY KEY)"); + } + + @After public void close() { if (source != null) source.shutdown(); } + + private TransactionTemplate external(int propagation) { + var template = new TransactionTemplate(new DataSourceTransactionManager(source)); + template.setPropagationBehavior(propagation); + return template; + } + + private void insert(int id) { sql.update("INSERT INTO completion_test VALUES(?)", new Object[]{id}); } + + private int physicalCount() { + try (var connection = source.getConnection(); var statement = connection.createStatement(); + var rows = statement.executeQuery("SELECT COUNT(*) FROM completion_test")) { + assertTrue(connection.getAutoCommit()); assertTrue(rows.next()); return rows.getInt(1); + } catch (java.sql.SQLException error) { throw new AssertionError(error); } + } + + private void outside() { + assertFalse(sql.hasActiveTransaction()); + assertFalse(TransactionSynchronizationManager.isActualTransactionActive()); + } + + @Test public void noActiveTransactionCannotAcceptCallbacks() { + assertFalse(sql.hasActiveTransaction()); + assertFalse(sql.registerTransactionSynchronization(() -> fail(), () -> fail())); + } + + @Test public void nestedCallbacksWaitForPhysicalCommitAndRunOutsideIt() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + assertTrue(sql.hasActiveTransaction()); insert(1); + assertTrue(sql.registerTransactionSynchronization(() -> { outside(); assertEquals(1, physicalCount()); observed.add("outer"); }, () -> fail())); + sql.executeInTransaction(() -> assertTrue(sql.registerTransactionSynchronization(() -> observed.add("inner"), () -> fail()))); + assertTrue(observed.isEmpty()); + }); + assertEquals(List.of("outer", "inner"), observed); outside(); + } + + @Test public void applicationOwnedCommitDoesNotDeliverAtInnerSaveReturn() { + var observed = new ArrayList(); + external(TransactionDefinition.PROPAGATION_REQUIRED).executeWithoutResult(status -> { + sql.executeInTransaction(() -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> { outside(); assertEquals(1, physicalCount()); observed.add("commit"); }, () -> fail())); + }); + assertTrue(observed.isEmpty()); assertEquals(0, physicalCount()); + }); + assertEquals(List.of("commit"), observed); outside(); + } + + @Test public void rollbackRunsInReverseAndPreservesTheOriginalFailure() { + var observed = new ArrayList(); var original = new IllegalArgumentException("intentional action failure"); + var actual = assertThrows(IllegalArgumentException.class, () -> sql.executeInTransaction(() -> { + insert(1); + assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> { outside(); observed.add(1); })); + assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> { observed.add(2); throw new IllegalStateException("rollback observer"); })); + assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add(3))); + throw original; + })); + assertSame(original, actual); assertEquals(1, actual.getSuppressed().length); + assertEquals(List.of(3, 2, 1), observed); assertEquals(0, physicalCount()); outside(); + } + + @Test public void applicationOwnedRollbackRestoresOnlyAtOuterCompletion() { + var observed = new ArrayList(); var original = new IllegalArgumentException("outer decision"); + assertSame(original, assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_REQUIRED).executeWithoutResult(status -> { + sql.executeInTransaction(() -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> { outside(); assertEquals(0, physicalCount()); observed.add("rollback"); })); + }); + assertTrue(observed.isEmpty()); throw original; + }))); + assertEquals(List.of("rollback"), observed); outside(); + } + + @Test public void swallowedInnerFailureStillForcesOuterRollback() { + var observed = new ArrayList(); + assertThrows(UnexpectedRollbackException.class, () -> sql.executeInTransaction(() -> { + assertTrue(sql.registerTransactionSynchronization(() -> observed.add("commit"), () -> observed.add("rollback"))); + try { sql.executeInTransaction(() -> { insert(1); throw new IllegalArgumentException("inner failure"); }); } + catch (IllegalArgumentException expected) { /* REQUIRED does not make partial DML committable. */ } + })); + assertEquals(List.of("rollback"), observed); assertEquals(0, physicalCount()); outside(); + } + + @Test public void postCommitFailureCannotRollbackDataOrSkipOtherAudits() { + var observed = new ArrayList(); var original = new IllegalStateException("audit unavailable"); + assertSame(original, assertThrows(IllegalStateException.class, () -> sql.executeInTransaction(() -> { + insert(1); + assertTrue(sql.registerTransactionSynchronization(() -> { outside(); throw original; }, () -> fail("already committed"))); + assertTrue(sql.registerTransactionSynchronization(() -> observed.add("delivered"), () -> fail("already committed"))); + }))); + assertEquals(List.of("delivered"), observed); assertEquals(1, physicalCount()); outside(); + } + + @Test public void assertionRollbackDoesNotLeakCallbacksIntoTheNextTransaction() { + var observed = new ArrayList(); + assertThrows(AssertionError.class, () -> sql.executeInTransaction(() -> { + assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("rollback"))); throw new AssertionError("action"); + })); + sql.executeInTransaction(() -> assertTrue(sql.registerTransactionSynchronization(() -> observed.add("commit"), () -> fail()))); + assertEquals(List.of("rollback", "commit"), observed); outside(); + } + + @Test public void commitObserverCanBeginAFreshIndependentTransaction() { + sql.executeInTransaction(() -> { + insert(1); + assertTrue(sql.registerTransactionSynchronization(() -> { + outside(); sql.executeInTransaction(() -> insert(2)); + }, () -> fail())); + }); + assertEquals(2, physicalCount()); outside(); + } + + @Test public void requiresNewKeepsPhysicalOwnersIndependent() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> observed.add("outer"), () -> fail())); + external(TransactionDefinition.PROPAGATION_REQUIRES_NEW).executeWithoutResult(status -> { + insert(2); assertTrue(sql.registerTransactionSynchronization(() -> { outside(); assertEquals(1, physicalCount()); observed.add("inner"); }, () -> fail())); + }); + assertEquals(List.of("inner"), observed); + }); + assertEquals(List.of("inner", "outer"), observed); assertEquals(2, physicalCount()); outside(); + } + + @Test public void anotherDataSourceTransactionCannotOwnTheseCallbacks() { + var other = new EmbeddedDatabaseBuilder().generateUniqueName(true).setType(EmbeddedDatabaseType.H2).build(); + try { + new TransactionTemplate(new DataSourceTransactionManager(other)).executeWithoutResult(status -> { + // A read can bind a nontransactional connection to this unrelated synchronization. + assertTrue(sql.queryForList("SELECT * FROM completion_test", new Object[0]).isEmpty()); + assertFalse(sql.hasActiveTransaction()); assertFalse(sql.registerTransactionSynchronization(() -> fail(), () -> fail())); + }); + } finally { other.shutdown(); } + outside(); + } + + @Test public void emptySynchronizationIsNotAPhysicalTransaction() { + TransactionSynchronizationManager.initSynchronization(); + try { assertFalse(sql.hasActiveTransaction()); assertFalse(sql.registerTransactionSynchronization(() -> fail(), () -> fail())); } + finally { TransactionSynchronizationManager.clearSynchronization(); } + } + + @Test public void savepointRollbackRemovesOnlyNestedAudits() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> observed.add("outer"), () -> observed.add("outer rollback"))); + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(status -> { + insert(2); assertTrue(sql.registerTransactionSynchronization(() -> fail("nested SQL rolled back"), () -> observed.add("nested rollback"))); + throw new IllegalArgumentException("nested failure"); + })); + assertEquals(List.of("nested rollback"), observed); + }); + assertEquals(List.of("nested rollback", "outer"), observed); assertEquals(1, physicalCount()); outside(); + } + + @Test public void firstRegistrationInsideAnExistingSavepointStillRollsBack() { + var observed = new ArrayList(); + external(TransactionDefinition.PROPAGATION_REQUIRED).executeWithoutResult(status -> { + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(nested -> { + sql.executeInTransaction(() -> { insert(1); assertTrue(sql.registerTransactionSynchronization(() -> fail("rolled back savepoint"), () -> observed.add("rollback"))); }); + throw new IllegalArgumentException("nested failure"); + })); + assertEquals(List.of("rollback"), observed); + }); + assertEquals(List.of("rollback"), observed); assertEquals(0, physicalCount()); outside(); + } + + @Test public void savepointRetryCannotDeliverTheAbandonedAudit() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(status -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> fail("abandoned"), () -> observed.add("restored"))); + throw new IllegalArgumentException("retry"); + })); + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> observed.add("retry commit"), () -> fail())); + }); + assertEquals(List.of("restored", "retry commit"), observed); assertEquals(1, physicalCount()); outside(); + } + + @Test public void adaptersSharingOneDataSourceSharePhysicalCallbackOrder() { + var other = new SpringJdbcSqlExecutor(new NamedParameterJdbcTemplate(source)); var observed = new ArrayList(); + assertThrows(IllegalArgumentException.class, () -> sql.executeInTransaction(() -> { + assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add(1))); + assertTrue(other.registerTransactionSynchronization(() -> fail(), () -> observed.add(2))); + assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add(3))); + throw new IllegalArgumentException("rollback both adapters"); + })); + assertEquals(List.of(3, 2, 1), observed); outside(); + } + + @Test public void nullCallbackCannotPartiallyRegister() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + assertThrows(NullPointerException.class, () -> sql.registerTransactionSynchronization(() -> fail(), null)); + assertTrue(sql.registerTransactionSynchronization(() -> observed.add("valid"), () -> fail())); + }); + assertEquals(List.of("valid"), observed); outside(); + } + + @Test public void suspendedTransactionCannotCaptureUnrelatedCallbacks() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + assertTrue(sql.registerTransactionSynchronization(() -> observed.add("outer"), () -> fail())); + external(TransactionDefinition.PROPAGATION_NOT_SUPPORTED).executeWithoutResult(status -> { + outside(); assertFalse(sql.registerTransactionSynchronization(() -> fail(), () -> fail())); + }); + }); + assertEquals(List.of("outer"), observed); outside(); + } + + @Test public void synchronizationDisabledOuterRejectsBeforeAction() { + var manager = new DataSourceTransactionManager(source); + manager.setTransactionSynchronization(org.springframework.transaction.support.AbstractPlatformTransactionManager.SYNCHRONIZATION_NEVER); + var called = new java.util.concurrent.atomic.AtomicBoolean(); + new TransactionTemplate(manager).executeWithoutResult(status -> { + assertThrows(IllegalStateException.class, () -> sql.executeInTransaction(() -> { + called.set(true); insert(1); + assertTrue(sql.registerTransactionSynchronization(() -> fail("outer has not committed"), () -> fail())); + })); + assertFalse(called.get()); + }); + assertEquals(0, physicalCount()); outside(); + } + + @Test public void earlierSynchronizationFailureStillDeliversCommittedAudits() { + var observed = new ArrayList(); var original = new IllegalStateException("earlier completion failed"); + assertSame(original, assertThrows(IllegalStateException.class, () -> sql.executeInTransaction(() -> { + insert(1); + TransactionSynchronizationManager.registerSynchronization(new org.springframework.transaction.support.TransactionSynchronization() { + @Override public void afterCommit() { throw original; } + }); + assertTrue(sql.registerTransactionSynchronization(() -> { outside(); observed.add("committed"); }, () -> fail("already committed"))); + }))); + assertEquals(List.of("committed"), observed); assertEquals(1, physicalCount()); outside(); + } + + @Test public void savepointRestorationFailureCannotStopRollbackOrPermitCommit() { + var observed = new ArrayList(); var failure = new IllegalStateException("restoration failed"); + assertSame(failure, assertThrows(IllegalStateException.class, () -> sql.executeInTransaction(() -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> fail("restoration failed"), () -> observed.add("outer rollback"))); + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(status -> { + insert(2); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> { observed.add("nested rollback"); throw failure; })); + throw new IllegalArgumentException("nested failure"); + })); + assertEquals(1, sql.queryForList("SELECT * FROM completion_test", new Object[0]).size()); + assertEquals(List.of("nested rollback"), observed); + }))); + assertEquals(List.of("nested rollback", "outer rollback"), observed); assertEquals(0, physicalCount()); outside(); + } + + @Test public void doublyNestedSavepointsRetainOnlyOuterAudit() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> observed.add("outer commit"), () -> fail())); + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(first -> { + insert(2); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("first rollback"))); + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(second -> { + insert(3); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("second rollback"))); + throw new IllegalArgumentException("second"); + })); + throw new IllegalArgumentException("first"); + })); + assertEquals(List.of("second rollback", "first rollback"), observed); + }); + assertEquals(List.of("second rollback", "first rollback", "outer commit"), observed); assertEquals(1, physicalCount()); outside(); + } + + @Test public void equalPositionNestedSavepointsCannotUndoOuterCallbacks() { + var observed = new ArrayList(); + sql.executeInTransaction(() -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> observed.add("outer commit"), () -> observed.add("outer rollback"))); + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(first -> { + // There is no callback between these two savepoint creations: both boundaries are1. + assertThrows(IllegalArgumentException.class, () -> external(TransactionDefinition.PROPAGATION_NESTED).executeWithoutResult(second -> { + insert(2); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("second rollback"))); + throw new IllegalArgumentException("second"); + })); + insert(3); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("first rollback"))); + throw new IllegalArgumentException("first"); + })); + assertEquals(List.of("second rollback", "first rollback"), observed); + }); + assertEquals(List.of("second rollback", "first rollback", "outer commit"), observed); assertEquals(1, physicalCount()); outside(); + } + + @Test public void repeatedRollbackToSameSavepointRetainsPrecedingCallbacks() { + var observed = new ArrayList(); + external(TransactionDefinition.PROPAGATION_REQUIRED).executeWithoutResult(status -> { + insert(1); assertTrue(sql.registerTransactionSynchronization(() -> observed.add("outer commit"), () -> observed.add("outer rollback"))); + var savepoint = status.createSavepoint(); + insert(2); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("first rollback"))); + status.rollbackToSavepoint(savepoint); + insert(3); assertTrue(sql.registerTransactionSynchronization(() -> fail(), () -> observed.add("second rollback"))); + status.rollbackToSavepoint(savepoint); + status.releaseSavepoint(savepoint); + assertEquals(List.of("first rollback", "second rollback"), observed); + }); + assertEquals(List.of("first rollback", "second rollback", "outer commit"), observed); assertEquals(1, physicalCount()); outside(); + } +} diff --git a/teaql-query-json/pom.xml b/teaql-query-json/pom.xml index ed154fd5a..9f94fc6fb 100644 --- a/teaql-query-json/pom.xml +++ b/teaql-query-json/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-query-json diff --git a/teaql-redis/pom.xml b/teaql-redis/pom.xml index 6ec5afeab..d9b04628e 100644 --- a/teaql-redis/pom.xml +++ b/teaql-redis/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-runtime-log/pom.xml b/teaql-runtime-log/pom.xml index c93c43048..f2f43050e 100644 --- a/teaql-runtime-log/pom.xml +++ b/teaql-runtime-log/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-runtime-log diff --git a/teaql-runtime/pom.xml b/teaql-runtime/pom.xml index 2acd8ff76..20f241008 100644 --- a/teaql-runtime/pom.xml +++ b/teaql-runtime/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-runtime diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/CanonicalMutationFields.java b/teaql-runtime/src/main/java/io/teaql/runtime/CanonicalMutationFields.java new file mode 100644 index 000000000..be665218b --- /dev/null +++ b/teaql-runtime/src/main/java/io/teaql/runtime/CanonicalMutationFields.java @@ -0,0 +1,102 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.core.checker.*; +import io.teaql.core.meta.*; +import io.teaql.data.dynamic.DynamicFieldMutation; +import java.util.*; + +/** Fixed model vocabulary at admission; never a native/wire alias converter. */ +final class CanonicalMutationFields { + private CanonicalMutationFields() {} + + static void validateGraph(UserContext context, EntityMetaFactory metadata, Entity root) { + var validation = new Validation(context, metadata); + validation.visit(root, null); + // Raw detached changes must not disappear when the runtime materializes + // commands. Reached typed keys already received their precise graph path. + for (var ledger : validation.ledgers) { + for (var entry : ledger.currentChangeSet().changes().entrySet()) { + if (ledger.isNew(entry.getKey()) && ledger.isMarkedAsDelete(entry.getKey())) continue; + if (!validation.representedKeys.contains(entry.getKey())) + validation.fields(entry.getKey().entity(), entry.getValue().keySet(), null); + } + } + validation.finish(); + } + + static void validatePlan(UserContext context, EntityMetaFactory metadata, MutationPlan plan) { + var validation = new Validation(context, metadata); + for (var operation : plan.operations()) { + for (var entry : operation.changedValues().entrySet()) { + // Persisted dynamic fields have a separate typed ledger channel. + // The normalized policy view names those intents with '#'. + if (entry.getValue() instanceof DynamicFieldMutation mutation + && entry.getKey().equals("#" + mutation.code())) continue; + validation.fields(operation.entity().entity(), List.of(entry.getKey()), null); + } + } + validation.finish(); + } + + private static final class Validation { + private final UserContext context; + private final EntityMetaFactory metadata; + // Per-type metadata, not a field-name set allocated on every row. + private final Map> modelFields = new IdentityHashMap<>(); + private final Set visited = Collections.newSetFromMap(new IdentityHashMap<>()); + private final Set ledgers = Collections.newSetFromMap(new IdentityHashMap<>()); + private final Set representedKeys = new HashSet<>(); + private List violations; + + private Validation(UserContext context, EntityMetaFactory metadata) { this.context = context; this.metadata = metadata; } + private Set names(String type) { + var descriptor = metadata.resolveEntityDescriptor(type); + if (descriptor == null) return Set.of(); + return modelFields.computeIfAbsent(descriptor, value -> { + Set names = new HashSet<>(); + for (var current = value; current != null; current = current.getParent()) + for (var property : current.getProperties()) names.add(property.getName()); + if (!names.isEmpty()) { names.add(BaseEntity.ID_PROPERTY); names.add(BaseEntity.VERSION_PROPERTY); } + return names; + }); + } + private void fields(String type, Iterable fields, ObjectLocation parent) { + Set names = names(type); + // Preserve manual legacy metadata that declares no field contract. + if (names.isEmpty()) return; + for (String field : fields) if (!names.contains(field)) { + var location = parent == null ? ObjectLocation.hashRoot(field) : parent.member(field); + var result = CheckResult.unknownField(location); result.setRootType(type); + context.translateCheckResult(result); + if (violations == null) violations = new ArrayList<>(); + violations.add(result); + } + } + private void visit(Entity entity, ObjectLocation location) { + if (!(entity instanceof BaseEntity base) || !visited.add(entity)) return; + if (base.isNew() && base.isMarkedAsDelete()) return; + var pending = base.getUpdatedProperties(); + fields(entity.typeName(), pending, location); + var ledger = base.getEntityMutationLedger(); ledgers.add(ledger); + var key = new EntityKey(entity.typeName(), entity.getId()); representedKeys.add(key); + var raw = ledger.currentChangeSet().changes().get(key); + if (raw != null) for (String field : raw.keySet()) + if (!pending.contains(field)) fields(entity.typeName(), List.of(field), location); + var descriptor = metadata.resolveEntityDescriptor(entity.typeName()); + for (var current = descriptor; current != null; current = current.getParent()) { + for (var property : current.getProperties()) { + if (!(property instanceof Relation)) continue; + var childLocation = location == null ? ObjectLocation.hashRoot(property.getName()) : location.member(property.getName()); + Object value = entity.getProperty(property.getName()); + if (value instanceof Entity child) visit(child, childLocation); + else if (value instanceof Iterable children) { + int index = 0; + for (Object child : children) { if (child instanceof Entity related) visit(related, childLocation.element(index)); index++; } + } + } + } + } + private void finish() { if (violations != null) throw new CheckException(violations); } + } +} diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/DefaultUserContext.java b/teaql-runtime/src/main/java/io/teaql/runtime/DefaultUserContext.java index 785c25580..f28d5b0dd 100644 --- a/teaql-runtime/src/main/java/io/teaql/runtime/DefaultUserContext.java +++ b/teaql-runtime/src/main/java/io/teaql/runtime/DefaultUserContext.java @@ -152,7 +152,7 @@ public T capability(Class capabilityType) { } } if (value == null && capabilityType == io.teaql.core.meta.EntityMetaFactory.class) { - value = runtime.getMetadata(); + value = runtime == null ? null : runtime.getMetadata(); } if (value == null && capabilityType == GeneratedSchemaBootstrap.class) { value = runtime.getGeneratedSchemaBootstrap(); diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/LogPrivacy.java b/teaql-runtime/src/main/java/io/teaql/runtime/LogPrivacy.java index e78cbeb0b..6cbc8cc2f 100644 --- a/teaql-runtime/src/main/java/io/teaql/runtime/LogPrivacy.java +++ b/teaql-runtime/src/main/java/io/teaql/runtime/LogPrivacy.java @@ -5,22 +5,17 @@ import io.teaql.core.SqlParameterLogPolicy; import io.teaql.core.utils.SqlLogRenderer; import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; /** Shared log projection boundary; execution and business event values are never mutated. */ public final class LogPrivacy { public static final String ENVIRONMENT = "TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS"; public static final String ACKNOWLEDGEMENT = "I_UNDERSTAND_SENSITIVE_DATA_MAY_BE_WRITTEN_TO_DISK"; public static final String REDACTED = "[REDACTED]"; - private static final AtomicBoolean WARNED = new AtomicBoolean(); private static final String DEBUG_LABEL = "-- TeaQL DEBUG PLAINTEXT; EXPLICIT OPT-IN\n"; private LogPrivacy() {} public static boolean plaintextEnabled() { - if (!ACKNOWLEDGEMENT.equals(System.getenv(ENVIRONMENT))) return false; - if (WARNED.compareAndSet(false, true)) System.err.println( - "[TeaQL WARNING] Sensitive plaintext logging enabled; business data may be written to disk. Credentials remain redacted."); - return true; + return io.teaql.core.utils.SensitiveValueProjection.plaintextEnabled(); } public static boolean credential(String name) { @@ -28,35 +23,11 @@ public static boolean credential(String name) { } public static boolean hasCredentials(Object value) { - if (value instanceof Map map) return map.entrySet().stream() - .anyMatch(e -> credential(String.valueOf(e.getKey())) || hasCredentials(e.getValue())); - if (value instanceof Iterable items) for (Object item : items) if (hasCredentials(item)) return true; - if (value != null && value.getClass().isArray()) - for (int i = 0; i < java.lang.reflect.Array.getLength(value); i++) - if (hasCredentials(java.lang.reflect.Array.get(value, i))) return true; - return false; - } - - private static void collect(Object value, List result) { - if (value == null) return; - if (value instanceof Map map) { map.values().forEach(item -> collect(item, result)); return; } - if (value instanceof Iterable items) { items.forEach(item -> collect(item, result)); return; } - if (value.getClass().isArray()) { - for (int i = 0; i < java.lang.reflect.Array.getLength(value); i++) - collect(java.lang.reflect.Array.get(value, i), result); - return; - } - String text = String.valueOf(value); - if (!text.isEmpty()) result.add(text); + return io.teaql.core.utils.SensitiveValueProjection.hasCredentials(value); } public static String scrub(String text, Collection values) { - if (text == null) return null; - List strings = new ArrayList<>(); - values.forEach(value -> collect(value, strings)); - strings.sort(Comparator.comparingInt(String::length).reversed()); - for (String value : strings) text = text.replace(value, REDACTED); - return text; + return io.teaql.core.utils.SensitiveValueProjection.scrub(text, values); } public static List trace(List nodes, Collection values) { diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/ReviewedMutationSnapshot.java b/teaql-runtime/src/main/java/io/teaql/runtime/ReviewedMutationSnapshot.java new file mode 100644 index 000000000..6fad2efe4 --- /dev/null +++ b/teaql-runtime/src/main/java/io/teaql/runtime/ReviewedMutationSnapshot.java @@ -0,0 +1,176 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.data.dynamic.DynamicFieldMutation; +import java.lang.reflect.Array; +import java.util.*; + +/** Invocation-local pin of the semantic values that customer policy reviewed. */ +final class ReviewedMutationSnapshot { + private final String requestKey, rootType, reason; + private final List operations; + private final Map> traces; + private final MutationPlan prepared; + + private ReviewedMutationSnapshot(MutationPlan plan,EntityMutationLedger ledger, + io.teaql.core.meta.EntityMetaFactory metadata) { + requestKey = plan.requestKey(); rootType = plan.rootEntityType(); + reason = plan.auditReason(); + operations = new ArrayList<>(plan.operations().size()); + traces = new LinkedHashMap<>(); + for (var operation : plan.operations()) { + operations.add(new Operation(operation.kind(),operation.entity(),operation.originalVersion(), + freeze(operation.changedValues(),new IdentityHashMap<>()))); + var chain = ledger.getTraceChain(operation.entity()); + traces.put(operation.entity(),chain == null ? null : List.copyOf(chain)); + } + // The customer receives the original policy view, not this detached + // provider payload. Mutable operands cannot rewrite the prepared writes. + prepared = metadata == null ? plan : detach(plan,metadata); + } + + static ReviewedMutationSnapshot capture(MutationPlan plan,EntityMutationLedger ledger) { + return new ReviewedMutationSnapshot(plan,ledger,null); + } + + static ReviewedMutationSnapshot capture(MutationPlan plan,EntityMutationLedger ledger, + io.teaql.core.meta.EntityMetaFactory metadata) { + return new ReviewedMutationSnapshot(plan,ledger,metadata); + } + + MutationPlan preparedPlan() { return prepared; } + + List traceChain(EntityKey key) { return traces.get(key); } + + void requireUnchanged(MutationPlan plan,EntityMutationLedger ledger) { + requireUnchanged(plan,ledger,false); + } + + void requireUnchanged(MutationPlan plan,EntityMutationLedger ledger,boolean providerCompleted) { + var live = capture(plan,ledger); + if (providerCompleted) { + // Executed requests use the prepared original version, never this + // live ledger value. Providers may now publish authoritative versions + // through a legacy materialized entity without changing write inputs. + Map reviewedVersions = new HashMap<>(); + operations.forEach(operation -> reviewedVersions.put(operation.key(),operation.version())); + for (int i=0;i copy = new ArrayList<>(); + for (var operation : plan.operations()) { + Map values = new LinkedHashMap<>(); + operation.changedValues().forEach((field,value) -> values.put(field,detachValue(value,metadata))); + copy.add(new MutationOperation(operation.kind(),operation.entity(),operation.originalVersion(),values)); + } + return new MutationPlan(plan.executionId(),plan.requestKey(),plan.rootEntityType(),plan.auditReason(),copy); + } + + private static Object detachValue(Object value,io.teaql.core.meta.EntityMetaFactory metadata) { + if (value instanceof Entity entity) { + var descriptor = metadata.resolveEntityDescriptor(entity.typeName()); + if (descriptor != null) try { + var reference = (BaseEntity)descriptor.createEntity(); + reference.__internalSet("id",entity.getId()); + reference.__internalSet("version",entity.getVersion()); + reference.set$status(EntityStatus.REFER); + return reference; + } catch (IllegalStateException noFactory) { /* Opaque custom provider reference. */ } + return value; + } + if (value instanceof DynamicFieldMutation mutation) + return new DynamicFieldMutation(mutation.code(),mutation.dataType(),mutation.kind(),detachValue(mutation.value(),metadata)); + if (value instanceof Date time) return time.clone(); + if (value instanceof java.util.concurrent.atomic.AtomicInteger number) return number.get(); + if (value instanceof java.util.concurrent.atomic.AtomicLong number) return number.get(); + if (value instanceof Map map) { + Map copy = new LinkedHashMap<>(); + map.forEach((key,item) -> copy.put(detachValue(key,metadata),detachValue(item,metadata))); + return Collections.unmodifiableMap(copy); + } + if (value instanceof Iterable items) { + Collection copy = value instanceof Set ? new LinkedHashSet<>() : new ArrayList<>(); + items.forEach(item -> copy.add(detachValue(item,metadata))); + return copy instanceof Set ? Collections.unmodifiableSet((Set)copy) : Collections.unmodifiableList((List)copy); + } + if (value != null && value.getClass().isArray()) { + int size = Array.getLength(value); + Object copy = Array.newInstance(value.getClass().getComponentType(),size); + if (value.getClass().getComponentType().isPrimitive()) System.arraycopy(value,0,copy,0,size); + else for (int i=0;i type,long millis,int nanos) {} + private record Dynamic(String code,Object type,Object kind,Object value) {} + private record ArrayValue(Class type,Object values) { + @Override public boolean equals(Object other) { + return other instanceof ArrayValue array && type.equals(array.type) && Objects.deepEquals(values,array.values); + } + @Override public int hashCode() { return 31*type.hashCode()+Arrays.deepHashCode(new Object[]{values}); } + } + + private static Object freeze(Object value,IdentityHashMap active) { + if (value instanceof Entity entity) return new Reference(entity.typeName(),entity.getId()); + if (value instanceof DynamicFieldMutation mutation) + return new Dynamic(mutation.code(),mutation.dataType(),mutation.kind(),freeze(mutation.value(),active)); + if (value instanceof Date time) { + // Date's virtual conversion preserves Timestamp nanoseconds without + // adding a JDBC/java.sql dependency to the domain-independent runtime. + int nanos = 0; + try { nanos = time.toInstant().getNano(); } + catch (UnsupportedOperationException dateOnly) { /* SQL Date/Time expose millis only. */ } + return new CalendarValue(value.getClass(),time.getTime(),nanos); + } + if (value instanceof java.util.concurrent.atomic.AtomicInteger number) return number.get(); + if (value instanceof java.util.concurrent.atomic.AtomicLong number) return number.get(); + boolean structured = value instanceof Map || value instanceof Iterable || value != null && value.getClass().isArray(); + // Native scalar values (String, boxed numerics, BigDecimal and java.time) + // are immutable. Opaque custom provider values keep their own equality contract. + if (!structured) return value; + if (active.put(value,Boolean.TRUE) != null) + throw new TeaQLRuntimeException("MUTATION_REVIEW_CYCLIC_VALUE: Cyclic container is not a mutation scalar"); + try { + if (value instanceof Map map) { + Map copy = new LinkedHashMap<>(); + map.forEach((key,item) -> copy.put(freeze(key,active),freeze(item,active))); + return Collections.unmodifiableMap(copy); + } + if (value instanceof Set items) { + Set copy = new HashSet<>(); + items.forEach(item -> copy.add(freeze(item,active))); + return Collections.unmodifiableSet(copy); + } + if (value instanceof Iterable items) { + List copy = new ArrayList<>(); + items.forEach(item -> copy.add(freeze(item,active))); + return Collections.unmodifiableList(copy); + } + int size = Array.getLength(value); + if (value.getClass().getComponentType().isPrimitive()) { + Object copy = Array.newInstance(value.getClass().getComponentType(),size); + System.arraycopy(value,0,copy,0,size); + return new ArrayValue(value.getClass(),copy); + } + Object[] copy = new Object[size]; + for (int i=0;i Stream executeForStreamResolved( throw new TeaQLRuntimeException( "Entity streams require entity rows; use an aggregation or projection result for aggregate/grouped queries"); } + request = entityProjectionRequest(request); EntityDescriptor descriptor = metadata.resolveEntityDescriptor(request.getTypeName()); String route = descriptor != null ? descriptor.getDataService() : null; if (route == null || route.isEmpty()) { @@ -387,6 +388,7 @@ private static void enforceMaterializedLimit(SearchRequest request, int hardL @SuppressWarnings("unchecked") private SmartList executeForListResolved( UserContext context, SearchRequest request, QueryIntent intent) { + request = entityProjectionRequest(request); EntityDescriptor descriptor = metadata.resolveEntityDescriptor(request.getTypeName()); String route = descriptor.getDataService(); if (route == null || route.isEmpty()) { @@ -421,6 +423,30 @@ private SmartList executeForListResolved( "Unsupported QueryResult type: " + queryResult.getClass().getName()); } + /** Entity rows always carry identity and optimistic version, even after a policy + * or a low-level caller removes their projections. Aggregate rows are not entities. + * Copy only the exceptional incomplete projection; never widen business fields or + * mutate a reusable caller request. */ + private static SearchRequest entityProjectionRequest(SearchRequest request) { + // An empty projection means provider-default full entity loading, not zero fields. + if (request.getProjections().isEmpty()) return request; + var aggregations = request.getAggregations(); + if (aggregations != null && (!aggregations.getAggregates().isEmpty() + || !aggregations.getSimpleDimensions().isEmpty() + || !aggregations.getComplexDimensions().isEmpty())) return request; + boolean id = false; + boolean version = false; + for (var projection : request.getProjections()) { + id |= BaseEntity.ID_PROPERTY.equals(projection.name()); + version |= BaseEntity.VERSION_PROPERTY.equals(projection.name()); + } + if (id && version) return request; + var normalized = new QueryRequestSnapshot(request, request.requestScope(), request.diagnosticSource()); + if (!id) normalized.selectProperty(BaseEntity.ID_PROPERTY); + if (!version) normalized.selectProperty(BaseEntity.VERSION_PROPERTY); + return normalized; + } + public AggregationResult aggregation(UserContext context, SearchRequest request) { QueryIntent intent = QueryIntent.of(request.comment(), request.purpose()); if (queryPolicy != null) { @@ -460,7 +486,14 @@ public void saveGraph(UserContext context, Entity entity) { "teaql.mutation.kind", "save"))); try { MutationIntent intent = MutationIntent.of(entity.getComment()); + if (entity instanceof BaseEntity root && root.isNew() && root.isMarkedAsDelete()) { + throw new TeaQLRuntimeException("CANCELLED_NEW_ROOT: A cancelled new root has no persisted entity to return"); + } + CanonicalMutationFields.validateGraph(context, metadata, entity); + io.teaql.runtime.mutation.MutationVersionAdmission.validateGraph(metadata, entity); checkAndFix(context, entity); + CanonicalMutationFields.validateGraph(context, metadata, entity); + io.teaql.runtime.mutation.MutationVersionAdmission.validateGraph(metadata, entity); // Get entity's own EntityMutationLedger EntityMutationLedger entityMutationLedger = ((BaseEntity) entity).getEntityMutationLedger(); @@ -510,10 +543,23 @@ public void saveGraph(UserContext context, Entity entity) { new PersistenceState( value.getVersion(), value.get$status(), value.isPropertyLoaded(BaseEntity.VERSION_PROPERTY)))); - MutationPlan mutationPlan = buildMutationPlan(entity, entityMutationLedger, realEntities, intent); + MutationPlan mutationPlan = buildMutationPlan(entity, entityMutationLedger, realEntities, intent, + UUID.randomUUID().toString()); requireSingleMutationRoute(mutationPlan, route); + // Inspect the complete post-Fix graph plan, not only the root's + // status: an untouched root can still own a dirty descendant. + // An actually empty plan needs no policy review or transaction. + if (mutationPlan.operations().isEmpty()) { + telemetryScope.success(); + return; + } + ReviewedMutationSnapshot reviewed = ReviewedMutationSnapshot.capture(mutationPlan, entityMutationLedger, metadata); MutationGovernanceSnapshot governance = reviewMutationPlan(context, mutationPlan); - var dynamicChanges = entityMutationLedger.currentChangeSet().dynamicChanges(); + Runnable requireReviewedPlan = () -> reviewed.requireUnchanged( + buildMutationPlan(entity, entityMutationLedger, realEntities, intent, mutationPlan.executionId()), + entityMutationLedger); + requireReviewedPlan.run(); + var dynamicChanges = preparedChanges(reviewed.preparedPlan()).dynamicChanges(); var dynamicRequests = new ArrayList(); dynamicChanges.forEach((key, mutations) -> { if (!entityMutationLedger.deletedKeys().contains(key)) mutations.values().forEach(mutation -> dynamicRequests.add( @@ -521,16 +567,23 @@ public void saveGraph(UserContext context, Entity entity) { realEntities.get(key).dynamicFields().metadata()))); }); Map dynamicReadbacks = dynamicRequests.isEmpty() ? Collections.emptyMap() : new HashMap<>(); + var completion = new GraphCompletion(); + Runnable rollback = captureGraphRollback(realEntities.values()); List completed; try { if (mutationExecutor instanceof TransactionExecutor transactionExecutor) { completed = transactionExecutor.executeInTransaction(context, () -> { + completion.synchronizedTransaction = transactionExecutor.registerTransactionSynchronization( + context, completion::deliver, rollback); io.teaql.data.dynamic.DynamicFieldsFacade dynamic = null; if (!dynamicRequests.isEmpty()) { dynamic = context.dynamicFields().comment(intent.comment()).purpose("runtime: persist audited graph extensions"); dynamic.prepareGraphMutations(transactionExecutor.transactionResource(), dynamicRequests); } - List results = executeLedgerPlan(context, entityMutationLedger, mutationExecutor, + // Transaction registration and dynamic preparation are extension + // points too; none may substitute an unreviewed pending plan. + requireReviewedPlan.run(); + List results = executeLedgerPlan(context, reviewed, mutationExecutor, realEntities, governance, intent, traceScopes, graphScope); if (dynamic != null) { dynamic.applyGraphMutations(transactionExecutor.transactionResource(), dynamicRequests); @@ -547,27 +600,37 @@ public void saveGraph(UserContext context, Entity entity) { dynamicReadbacks.put(entry.getKey(), value); } } + // Verify before graph completion changes versions/clears intent. + // A late provider edit must roll back this transaction instead. + reviewed.requireUnchanged( + buildMutationPlan(entity, entityMutationLedger, realEntities, intent, mutationPlan.executionId()), + entityMutationLedger, true); + if (completion.synchronizedTransaction) { + completeGraphPlan(context, results, dynamicReadbacks, realEntities, + entityMutationLedger, completion.audits); + } return results; }); } else { if (!dynamicRequests.isEmpty()) throw new TeaQLRuntimeException("DYNAMIC_FIELD_TRANSACTION_BINDING_REQUIRED: native graph executor has no transaction"); + requireReviewedPlan.run(); completed = executeLedgerPlan( - context, entityMutationLedger, mutationExecutor, realEntities, governance, intent, traceScopes, graphScope); + context, reviewed, mutationExecutor, realEntities, governance, intent, traceScopes, graphScope); + reviewed.requireUnchanged( + buildMutationPlan(entity, entityMutationLedger, realEntities, intent, mutationPlan.executionId()), + entityMutationLedger, true); } } catch (RuntimeException | Error failure) { - restoreGraphPersistenceState( + if (!completion.synchronizedTransaction) restoreGraphPersistenceState( entity, entityMutationLedger, persistenceStates, Collections.newSetFromMap(new IdentityHashMap<>())); throw failure; } - dynamicReadbacks.forEach((key, values) -> { - BaseEntity target = realEntities.get(key); - target.__internalHydrateDynamicFields(values, target.__internalLoadState().withDynamicSelection(values.selectedCodes())); - }); - completeLedgerPlan(context, completed); - entityMutationLedger.clearCurrentChangeSet(); + if (!completion.synchronizedTransaction) { + completeGraphPlan(context, completed, dynamicReadbacks, realEntities, entityMutationLedger, null); + } telemetryScope.success(); } catch (RuntimeException | Error error) { telemetryScope.failure(error); @@ -603,9 +666,9 @@ private void collectMutationTraceScopes(Entity entity, MutationTraceScope parent visitRelatedEntities(entity, child -> collectMutationTraceScopes(child, active, scopes, visited)); } - private List mutationTrace(EntityMutationLedger ledger, EntityKey key, + private List mutationTrace(ReviewedMutationSnapshot reviewed, EntityKey key, Map scopes, MutationTraceScope graphScope) { - List specific = ledger.getTraceChain(key); + List specific = reviewed.traceChain(key); if (specific != null && !specific.isEmpty()) return specific; MutationTraceScope scope = scopes.getOrDefault(key, graphScope); return scope.recover(); @@ -613,14 +676,27 @@ private List mutationTrace(EntityMutationLedger ledger, EntityKey key @SuppressWarnings({"rawtypes", "unchecked"}) private void checkAndFix(UserContext context, Entity entity) { - if (checkers.isEmpty()) return; + if (checkers.isEmpty()) { + var violations = io.teaql.core.checker.internal.FiniteScalarAdmission.collect(metadata, entity, true); + if (!violations.isEmpty()) { + context.translateCheckResults(violations); + throw new CheckException(violations); + } + return; + } try (var invocation = io.teaql.core.checker.internal.CheckerInvocation.openMutation(context)) { context.beginFixEvidence(); try { checkGraphMutations(context, entity, null, Collections.newSetFromMap(new IdentityHashMap<>())); List violations = (List) invocation.attribute(Checker.TEAQL_DATA_CHECK_RESULT); + var numeric = io.teaql.core.checker.internal.FiniteScalarAdmission.collect(metadata, entity, true); + if (!numeric.isEmpty()) { + if (violations == null) violations = new ArrayList<>(); + violations.addAll(numeric); + } if (violations != null && !violations.isEmpty()) { + context.translateCheckResults(violations); throw new CheckException(new ArrayList<>(violations)); } } finally { @@ -633,6 +709,7 @@ private void checkAndFix(UserContext context, Entity entity) { private void checkGraphMutations(UserContext context, Entity entity, io.teaql.core.checker.ObjectLocation location, Set visited) { if (!(entity instanceof BaseEntity base) || !visited.add(entity)) return; + if (base.isNew() && base.isMarkedAsDelete()) return; Checker checker = checkers.get(entity.runtimeType()); if (checker == null) checker = checkers.get(entity.typeName()); if (checker != null && checker.needCheck(context, base)) { @@ -672,6 +749,7 @@ private void assignMissingGraphIds( if (!(entity instanceof BaseEntity baseEntity) || !visited.add(entity)) { return; } + if (baseEntity.isNew() && baseEntity.isMarkedAsDelete()) return; if (entity.getId() == null && idGenerationService != null) { Long newId = idGenerationService.generateId(context, entity); @@ -707,6 +785,7 @@ private void recordGraphChanges( if (!(entity instanceof BaseEntity baseEntity) || !visited.add(entity)) { return; } + if (baseEntity.isNew() && baseEntity.isMarkedAsDelete()) return; // A relation reference may share the materialized entity's ledger after // graph composition. It has no authoritative field snapshot of its own; // replaying shared dirty names through the reference would overwrite @@ -798,7 +877,7 @@ private static BaseEntity preferMaterializedEntity( private MutationPlan buildMutationPlan( Entity rootEntity, EntityMutationLedger ledger, - Map realEntities, MutationIntent intent) { + Map realEntities, MutationIntent intent, String executionId) { EntityChangeSet changeSet = ledger.currentChangeSet(); Set deleted = ledger.deletedKeys(); Set created = ledger.newKeys(); @@ -810,6 +889,8 @@ private MutationPlan buildMutationPlan( List operations = new ArrayList<>(); for (EntityKey key : keys) { + // A never-inserted cancelled child is neither CREATE nor persisted DELETE. + if (created.contains(key) && deleted.contains(key)) continue; BaseEntity target = realEntities.get(key); MutationOperationKind kind; Map changes; @@ -831,7 +912,7 @@ private MutationPlan buildMutationPlan( operations.add(new MutationOperation(kind, key, originalVersion, changes)); } return new MutationPlan( - UUID.randomUUID().toString(), + executionId, rootEntity.typeName() + ".saveGraph", rootEntity.typeName(), intent.auditReason(), @@ -840,6 +921,21 @@ private MutationPlan buildMutationPlan( private MutationGovernanceSnapshot reviewMutationPlan( UserContext context, MutationPlan plan) { + CanonicalMutationFields.validatePlan(context, metadata, plan); + io.teaql.runtime.mutation.MutationVersionAdmission.validatePlan(plan); + List numericViolations = null; + for (var operation : plan.operations()) { + var violations = io.teaql.core.checker.internal.FiniteScalarAdmission.collect( + operation.entity().entity(), operation.changedValues()); + if (!violations.isEmpty()) { + if (numericViolations == null) numericViolations = new ArrayList<>(); + numericViolations.addAll(violations); + } + } + if (numericViolations != null) { + context.translateCheckResults(numericViolations); + throw new CheckException(numericViolations); + } Optional resolved = mutationPolicyRegistry.resolve(plan.requestKey()); MutationPolicySource source; MutationPolicyIdentity identity = null; @@ -908,15 +1004,25 @@ private void emitMutationGovernanceWarning( private List executeLedgerPlan( UserContext context, - EntityMutationLedger root, + ReviewedMutationSnapshot reviewed, MutationExecutor mutationExecutor, Map realEntities, MutationGovernanceSnapshot governance, MutationIntent intent, Map traceScopes, MutationTraceScope graphScope) { List completed = new ArrayList<>(); - EntityChangeSet changeSet = root.currentChangeSet(); - Set deletedKeys = root.deletedKeys(); - Set newKeys = root.newKeys(); + MutationPlan prepared = reviewed.preparedPlan(); + EntityChangeSet changeSet = preparedChanges(prepared); + Set deletedKeys = new HashSet<>(), newKeys = new HashSet<>(), recoveredKeys = new HashSet<>(); + Map versions = new HashMap<>(); + for (MutationOperation operation : prepared.operations()) { + versions.put(operation.entity(), operation.originalVersion()); + switch (operation.kind()) { + case DELETE -> deletedKeys.add(operation.entity()); + case CREATE -> newKeys.add(operation.entity()); + case RECOVER -> recoveredKeys.add(operation.entity()); + default -> { } + } + } var graphRedactions = new SqlIntentRedactions(); realEntities.values().forEach(value -> graphRedactions.captureEntity( value, metadata.resolveEntityDescriptor(value.typeName()))); @@ -956,15 +1062,14 @@ private List executeLedgerPlan( BaseEntity target = realEntities.get(key); BaseEntity deleteEntity = mutationEntity(descriptor, target); deleteEntity.__internalSet("id", key.id()); - Long originalVersion = root.getOriginalVersion(key); - if (originalVersion == null && target != null) originalVersion = target.getVersion(); + Long originalVersion = versions.get(key); if (originalVersion != null) deleteEntity.__internalSet("version", originalVersion); deleteEntity.set$status(io.teaql.core.EntityStatus.PERSISTED); deleteEntity.markForDeletion(); - if (root.getComment() != null) deleteEntity.setComment(root.getComment()); + deleteEntity.setComment(intent.comment()); EntityPersistenceMutation mutationRequest = new EntityPersistenceMutation( - deleteEntity, EntityPersistenceMutation.Action.DELETE, intent, mutationTrace(root, key, traceScopes, graphScope), target, graphRedactions); + deleteEntity, EntityPersistenceMutation.Action.DELETE, intent, mutationTrace(reviewed, key, traceScopes, graphScope), target, graphRedactions); requests.add(mutationRequest); targets.add(target == null ? deleteEntity : target); } @@ -982,7 +1087,7 @@ private List executeLedgerPlan( Set changedKeys = new TreeSet<>(changeSet.changes().keySet()); changedKeys.addAll(changeSet.dynamicChanges().keySet()); - changedKeys.addAll(root.recoveredKeys()); + changedKeys.addAll(recoveredKeys); for (EntityKey key : changedKeys) { if (deletedKeys.contains(key)) continue; @@ -1011,17 +1116,17 @@ private List executeLedgerPlan( BaseEntity target = realEntities.get(key); BaseEntity entity = mutationEntity(descriptor, target); entity.__internalSet("id", key.id()); - Long version = root.getOriginalVersion(key); + Long version = versions.get(key); if (version != null) { entity.__internalSet("version", version); } for (Map.Entry change : changes.entrySet()) { entity.__internalApplyRecordedMutation(change.getKey(), change.getValue()); } - if (root.getComment() != null) entity.setComment(root.getComment()); + entity.setComment(intent.comment()); EntityPersistenceMutation mutationRequest = new EntityPersistenceMutation( - entity, EntityPersistenceMutation.Action.SAVE, intent, mutationTrace(root, key, traceScopes, graphScope), target, graphRedactions); + entity, EntityPersistenceMutation.Action.SAVE, intent, mutationTrace(reviewed, key, traceScopes, graphScope), target, graphRedactions); requests.add(mutationRequest); targets.add(target == null ? entity : target); snapshots.add(snapshotChanges(changesWithDynamic(changeSet, key))); @@ -1050,13 +1155,12 @@ private List executeLedgerPlan( List targets = new ArrayList<>(); List> snapshots = new ArrayList<>(); for (EntityKey key : keys) { - if (root.recoveredKeys().contains(key) != recovering) continue; + if (recoveredKeys.contains(key) != recovering) continue; BaseEntity target = realEntities.get(key); Map changes = changeSet.changes().getOrDefault(key, Map.of()); BaseEntity entity = mutationEntity(descriptor, target); entity.__internalSet("id", key.id()); - Long version = root.getOriginalVersion(key); - if (version == null && target != null) version = target.getVersion(); + Long version = versions.get(key); if (version != null) { entity.__internalSet("version", version); } @@ -1065,10 +1169,10 @@ private List executeLedgerPlan( } if (changeSet.dynamicChanges().containsKey(key)) entity.__internalRequireVersionUpdate(); entity.set$status(recovering ? io.teaql.core.EntityStatus.UPDATED_RECOVER : io.teaql.core.EntityStatus.UPDATED); - if (root.getComment() != null) entity.setComment(root.getComment()); + entity.setComment(intent.comment()); EntityPersistenceMutation mutationRequest = new EntityPersistenceMutation( - entity, EntityPersistenceMutation.Action.SAVE, intent, mutationTrace(root, key, traceScopes, graphScope), target, graphRedactions); + entity, EntityPersistenceMutation.Action.SAVE, intent, mutationTrace(reviewed, key, traceScopes, graphScope), target, graphRedactions); requests.add(mutationRequest); targets.add(target == null ? entity : target); snapshots.add(snapshotChanges(changesWithDynamic(changeSet, key))); @@ -1085,16 +1189,119 @@ private List executeLedgerPlan( return completed; } - private void completeLedgerPlan(UserContext context, List completed) { + /** Provider operands are rebuilt only from the detached, reviewed plan. */ + private EntityChangeSet preparedChanges(MutationPlan prepared) { + var changes = new EntityChangeSet(); + for (var operation : prepared.operations()) { + if (operation.kind() == MutationOperationKind.DELETE) continue; + operation.changedValues().forEach((field, value) -> { + if (value instanceof io.teaql.data.dynamic.DynamicFieldMutation mutation + && field.equals("#" + mutation.code())) changes.setDynamic(operation.entity(), mutation); + else changes.set(operation.entity(), field, value); + }); + } + return changes; + } + + private static final class GraphCompletion { + boolean synchronizedTransaction; + final List audits = new ArrayList<>(); + void deliver() { + Throwable failure = null; + for (Runnable audit : audits) { + try { audit.run(); } + catch (RuntimeException | Error error) { + if (failure == null) failure = error; else if (failure != error) failure.addSuppressed(error); + } + } + if (failure instanceof Error error) throw error; + if (failure instanceof RuntimeException error) throw error; + } + } + + private Runnable captureGraphRollback(Collection entities) { + List targets = List.copyOf(entities); + List restore = new ArrayList<>(); + Set ledgers = Collections.newSetFromMap(new IdentityHashMap<>()); + Map byKey = new HashMap<>(); + for (BaseEntity target : targets) { + byKey.put(new EntityKey(target.typeName(), target.getId()), target); + Map values = new LinkedHashMap<>(); + for (var descriptor = metadata.resolveEntityDescriptor(target.typeName()); descriptor != null; descriptor = descriptor.getParent()) { + for (var property : descriptor.getProperties()) { + if (target.isPropertyLoaded(property.getName()) + || io.teaql.core.FieldLayout.forType(target.getClass()).findIndex(property.getName()) != null) { + Object value = target.getProperty(property.getName()); + if (!(value instanceof Iterable)) values.put(property.getName(), value); + } + } + } + Runnable state = target.__internalCaptureMutationRollback(); + restore.add(() -> { values.forEach(target::__internalSet); state.run(); }); + var ledger = target.getEntityMutationLedger(); + if (ledgers.add(ledger)) restore.add(ledger.__internalCaptureRollback()); + } + return () -> { + // Completion callbacks unwind newest-to-oldest. Capture later + // saved/unsaved intent before restoring an older snapshot, or the + // first save would silently erase every subsequent field edit. + Map> nativeInput = new IdentityHashMap<>(); + Map> dynamicInput = new IdentityHashMap<>(); + for (BaseEntity target : targets) { + Map fields = new LinkedHashMap<>(); + for (String field : target.getUpdatedProperties()) { + var change = target.__internalPropertyChange(field); + if (change != null) fields.put(field, change.getNewValue()); + } + nativeInput.put(target, fields); + dynamicInput.put(target, new LinkedHashMap<>(target.__internalDynamicMutations())); + } + List rawInput = new ArrayList<>(); + for (var ledger : ledgers) { + var changes = ledger.currentChangeSet(); + changes.changes().forEach((key, fields) -> fields.forEach((name, value) -> { + var target = byKey.get(key); + if (target == null || !nativeInput.get(target).containsKey(name)) { + // Raw keys are not generated updaters. Retain them as + // raw input for the next normal admission, including + // unknown keys and explicit NULL, without normalization. + rawInput.add(() -> (target == null ? ledger : target.getEntityMutationLedger()).set(key, name, value)); + } + })); + changes.dynamicChanges().forEach((key, fields) -> fields.forEach((name, value) -> { + var target = byKey.get(key); + if (target == null || !dynamicInput.get(target).containsKey(name)) { + rawInput.add(() -> (target == null ? ledger : target.getEntityMutationLedger()).setDynamic(key, value)); + } + })); + } + restore.forEach(Runnable::run); + for (BaseEntity target : targets) { + nativeInput.get(target).forEach(target::__internalReplayRetryNative); + dynamicInput.get(target).values().forEach(target::__internalReplayRetryDynamic); + } + rawInput.forEach(Runnable::run); + }; + } + + private void completeGraphPlan(UserContext context, List completed, + Map readbacks, + Map entities, EntityMutationLedger ledger, List deferredAudits) { + readbacks.forEach((key, values) -> { + BaseEntity target = entities.get(key); + target.__internalHydrateDynamicFields(values, target.__internalLoadState().withDynamicSelection(values.selectedCodes())); + }); for (PendingMutation mutation : completed) { applyPersistedEntity(mutation.descriptor(), mutation.target(), mutation.result()); - emitAuditEvent( + Runnable audit = prepareAuditEvent( context, mutation.target(), mutation.auditKind(), mutation.changedValues(), mutation.governance(), mutation.intent(), mutation.traceChain(), mutation.redactions()); + if (deferredAudits == null) audit.run(); else deferredAudits.add(audit); mutation.target().clearUpdatedProperties(); // A committed delete supersedes any staged extension edits too. mutation.target().__internalClearDynamicMutations(); } + ledger.clearCurrentChangeSet(); } private Map snapshotChanges(Map changes) { @@ -1158,7 +1365,20 @@ private void applyPersistedEntity( for (EntityDescriptor current = descriptor; current != null; current = current.getParent()) { for (PropertyDescriptor property : current.getProperties()) { if (!persisted.isPropertyLoaded(property.getName())) continue; - target.__internalSet(property.getName(), persisted.getProperty(property.getName())); + Object value = persisted.getProperty(property.getName()); + if (property instanceof io.teaql.core.meta.Relation + && value instanceof BaseEntity reference + && reference.get$status() == io.teaql.core.EntityStatus.REFER + && target.getProperty(property.getName()) instanceof Entity materialized + && reference.getId() != null + && reference.typeName().equals(materialized.typeName()) + && reference.getId().equals(materialized.getId())) { + // A provider's FK-only readback confirms identity; it must + // not replace the already materialized graph member with a + // stub and orphan that member's next pending mutation. + value = materialized; + } + target.__internalSet(property.getName(), value); } } target.set$status(((BaseEntity) persisted).get$status()); @@ -1230,7 +1450,7 @@ private List mutateBatchWithTelemetry( } } - private void emitAuditEvent( + private Runnable prepareAuditEvent( UserContext context, Entity entity, MutationAuditKind kind, @@ -1270,11 +1490,15 @@ private void emitAuditEvent( java.time.Instant.now(), governance); + return () -> deliverAuditEvent(context, rawEvent, redactions); + } + + private void deliverAuditEvent(UserContext context, RawAuditEvent rawEvent, SqlIntentRedactions redactions) { RuntimeTelemetry.Scope telemetryScope = RuntimeTelemetry.startSafely(telemetry, - new RuntimeTelemetry.Operation("audit", entity.typeName() + ".audit", Map.of( - "teaql.entity.type", entity.typeName(), - "teaql.mutation.kind", kind.name().toLowerCase(Locale.ROOT), - "teaql.audit.changed_field_count", changes.size()))); + new RuntimeTelemetry.Operation("audit", rawEvent.entityType() + ".audit", Map.of( + "teaql.entity.type", rawEvent.entityType(), + "teaql.mutation.kind", rawEvent.kind().name().toLowerCase(Locale.ROOT), + "teaql.audit.changed_field_count", rawEvent.changes().size()))); try { // The standard sink is server-owned by TeaQLRuntime and cannot be replaced by @@ -1337,12 +1561,7 @@ private SafeAuditEvent buildSafeAuditEvent(RawAuditEvent event, SqlIntentRedacti } static String maskAuditValue(String value) { - if (value == null || value.isEmpty()) return value; - int length = value.codePointCount(0, value.length()); - if (length < 8 || value.codePoints().allMatch(c -> c >= '0' && c <= '9')) return "*".repeat(length); - return value.substring(0, value.offsetByCodePoints(0, 2)) - + "*".repeat(length - 4) - + value.substring(value.offsetByCodePoints(0, length - 2)); + return io.teaql.core.utils.SensitiveValueProjection.maskAuditValue(value); } static String limitAuditValue(String value, int maxLength) { diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/memory/CriteriaFilter.java b/teaql-runtime/src/main/java/io/teaql/runtime/memory/CriteriaFilter.java index e86369d1b..1d40912c7 100644 --- a/teaql-runtime/src/main/java/io/teaql/runtime/memory/CriteriaFilter.java +++ b/teaql-runtime/src/main/java/io/teaql/runtime/memory/CriteriaFilter.java @@ -116,10 +116,13 @@ public boolean twoOperatorCriteria(T entity, TwoOperatorCriteria twoOperatorsCri propertyValue = ((BaseEntity) propertyValue).getId(); } - int compare = 0; - if (!ArrayUtil.isArray(value)) { - compare = ObjectUtil.compare((Comparable) propertyValue, (Comparable) value); - } + // A multi-value Parameter is normalized to a List. It is not a scalar + // Comparable, and string/membership operators do not need an ordering. + int compare = switch ((Operator) operator) { + case EQUAL, NOT_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, GREATER_THAN, GREATER_THAN_OR_EQUAL -> + ObjectUtil.compare((Comparable) propertyValue, (Comparable) value); + default -> 0; + }; switch (((Operator) operator)) { case EQUAL -> { return compare == 0; @@ -158,37 +161,32 @@ public boolean twoOperatorCriteria(T entity, TwoOperatorCriteria twoOperatorsCri return !StrUtil.endWith((String) propertyValue, (String) value); } case IN, IN_LARGE -> { - if (ArrayUtil.isArray(value)) { - int length = ArrayUtil.length(value); - for (int i = 0; i < length; i++) { - Object o = ArrayUtil.get(value, i); - compare = ObjectUtil.compare((Comparable) propertyValue, (Comparable) o); - if (compare == 0) { - return true; - } - } - return false; - } - throw new TeaQLRuntimeException("operator in/in large should have the array parameter"); + return membership(propertyValue, value, false); } case NOT_IN, NOT_IN_LARGE -> { - if (ArrayUtil.isArray(value)) { - int length = ArrayUtil.length(value); - for (int i = 0; i < length; i++) { - Object o = ArrayUtil.get(value, i); - compare = ObjectUtil.compare((Comparable) propertyValue, (Comparable) o); - if (compare == 0) { - return false; - } - } - return true; - } - throw new TeaQLRuntimeException("operator not in/not in large should have the array parameter"); + return membership(propertyValue, value, true); } } return false; } + @SuppressWarnings("unchecked") + private boolean membership(Object propertyValue, Object candidates, boolean negated) { + int length; + if (candidates instanceof List list) length = list.size(); + else if (ArrayUtil.isArray(candidates)) length = ArrayUtil.length(candidates); + else throw new TeaQLRuntimeException("memory membership requires a list or array parameter"); + if (length == 0) return negated; + if (propertyValue == null) return false; + boolean hasNull = false; + for (int i = 0; i < length; i++) { + Object candidate = candidates instanceof List list ? list.get(i) : ArrayUtil.get(candidates, i); + if (candidate == null) { hasNull = true; continue; } + if (ObjectUtil.compare((Comparable) propertyValue, (Comparable) candidate) == 0) return !negated; + } + return negated && !hasNull; + } + public boolean oneOperatorCriteria(T entity, OneOperatorCriteria oneOperatorCriteria) { PropertyFunction operator = oneOperatorCriteria.getOperator(); Expression firstExpression = oneOperatorCriteria.first(); diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryAggregations.java b/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryAggregations.java new file mode 100644 index 000000000..89f965279 --- /dev/null +++ b/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryAggregations.java @@ -0,0 +1,100 @@ +package io.teaql.runtime.memory; + +import io.teaql.core.*; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +/** Numeric aggregation for the existing memory provider, without SQL or I/O. */ +final class MemoryAggregations { + private MemoryAggregations() {} + + static AggregationResult calculate(Aggregations request, List rows) { + if (request == null || request.getSelectedExpressions().isEmpty()) return null; + // Validate before scanning rows: unsupported expressions cannot appear to + // work simply because an empty input never visits an operand. + for (var selected : request.getAggregates()) aggregate(selected.getExpression()); + for (var dimension : request.getDimensions()) dimension(dimension.getExpression()); + + var groups = new LinkedHashMap, List>(); + if (request.getDimensions().isEmpty()) groups.put(List.of(), new ArrayList<>(rows)); + else for (var row : rows) { + // Stream.toList permits a real null dimension; List.copyOf does not. + var key = request.getDimensions().stream().map(d -> value(dimension(d.getExpression()), row)).toList(); + groups.computeIfAbsent(key, ignored -> new ArrayList<>()).add(row); + } + var data = new ArrayList(); + groups.forEach((key, members) -> { + var item = new AggregationItem(); + for (int i = 0; i < key.size(); i++) item.addDimension(request.getDimensions().get(i), key.get(i)); + for (var selected : request.getAggregates()) item.addValue(selected, evaluate(aggregate(selected.getExpression()), members)); + data.add(item); + }); + var result = new AggregationResult(); result.setName(request.getName()); result.setData(data); return result; + } + + private static AggrExpression aggregate(Expression expression) { + if (!(expression instanceof AggrExpression aggregate) || aggregate.getExpressions().size() != 1) + throw unsupported(expression); + if (aggregate.getOperator() != AggrFunction.COUNT && aggregate.getOperator() != AggrFunction.SUM) + throw unsupported(aggregate.getOperator()); + operand(aggregate.first()); + if (aggregate.getOperator() == AggrFunction.SUM && star(aggregate.first())) throw unsupported("SUM(*)"); + return aggregate; + } + + private static Expression dimension(Expression expression) { + if (expression instanceof AggrExpression aggregate) { + if (aggregate.getOperator() != AggrFunction.SELF || aggregate.getExpressions().size() != 1) + throw unsupported(aggregate.getOperator()); + expression = aggregate.first(); + } + operand(expression); + if (star(expression)) throw unsupported("group by *"); + return expression; + } + + private static void operand(Expression expression) { + if (!(expression instanceof PropertyReference) && !(expression instanceof Parameter)) throw unsupported(expression); + } + + private static boolean star(Expression expression) { + return expression instanceof PropertyReference property && "*".equals(property.getPropertyName()); + } + + private static Object value(Expression expression, Entity row) { + Object value = expression instanceof PropertyReference property ? row.getProperty(property.getPropertyName()) : ((Parameter) expression).getValue(); + return value instanceof Entity entity ? entity.getId() : value; + } + + private static Object evaluate(AggrExpression aggregate, List rows) { + if (aggregate.getOperator() == AggrFunction.COUNT) { + if (star(aggregate.first())) return (long) rows.size(); + long count = 0; for (var row : rows) if (value(aggregate.first(), row) != null) count++; return count; + } + BigDecimal sum = null; + for (var row : rows) { + var value = value(aggregate.first(), row); + if (value == null) continue; + var term = decimal(value); sum = sum == null ? term : sum.add(term); + } + // A nullable exact number, not an empty-list default and not a string. + return sum; + } + + private static BigDecimal decimal(Object value) { + if (value instanceof BigDecimal decimal) return decimal; + if (value instanceof BigInteger integer) return new BigDecimal(integer); + if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long) + return BigDecimal.valueOf(((Number) value).longValue()); + if (value instanceof Float number && Float.isFinite(number)) return new BigDecimal(Float.toString(number)); + if (value instanceof Double number && Double.isFinite(number)) return BigDecimal.valueOf(number); + throw new TeaQLRuntimeException("Memory SUM requires a finite numeric value, not " + value.getClass().getName()); + } + + private static TeaQLRuntimeException unsupported(Object expression) { + return new TeaQLRuntimeException("Unsupported memory aggregate expression: " + expression); + } +} diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryDataService.java b/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryDataService.java index 6720c130d..1a7a0868f 100644 --- a/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryDataService.java +++ b/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryDataService.java @@ -12,7 +12,6 @@ public class MemoryDataService implements DataServiceExecutor, QueryExecutor, Mu private final String name; private final DataServiceCapabilities capabilities; private final Map database = new ConcurrentHashMap<>(); - private final CriteriaFilter filter = new CriteriaFilter<>(); private final int maxEntriesPerType; private static class TypeStorage { @@ -39,6 +38,7 @@ public MemoryDataService(String name, int maxEntriesPerType) { this.capabilities = new DataServiceCapabilities(); this.capabilities.setQuery(true); this.capabilities.setMutation(true); + this.capabilities.setAggregation(true); } @Override @@ -57,21 +57,18 @@ public QueryResult query(UserContext context, QueryRequest request) { throw new TeaQLRuntimeException("Unsupported QueryRequest in MemoryDataService"); } SearchRequest searchRequest = ((DefaultQueryRequest) request).getSearchRequest(); - String typeName = searchRequest.getTypeName(); - TypeStorage storage = database.computeIfAbsent(typeName, k -> new TypeStorage(maxEntriesPerType)); + return new MemoryQueries(context, this::rows).execute(searchRequest); + } - SmartList result = new SmartList<>(); + /** Snapshot membership under the lock; nested requests never execute while it is held. */ + private List rows(String typeName) { + TypeStorage storage = database.computeIfAbsent(typeName, k -> new TypeStorage(maxEntriesPerType)); storage.lock.readLock().lock(); try { - for (Entity entity : storage.data.values()) { - if (filter.accept(entity, searchRequest.getSearchCriteria())) { - result.add(entity); - } - } + return new ArrayList<>(storage.data.values()); } finally { storage.lock.readLock().unlock(); } - return new DefaultQueryResult(result); } @Override @@ -81,6 +78,11 @@ public MutationResult mutate(UserContext context, PersistenceMutation request) { } EntityPersistenceMutation mutation = (EntityPersistenceMutation) request; Entity entity = mutation.getEntity(); + var kind = mutation.getAction() == EntityPersistenceMutation.Action.DELETE ? MutationOperationKind.DELETE + : entity.newItem() ? MutationOperationKind.CREATE + : entity.recoverItem() ? MutationOperationKind.RECOVER : MutationOperationKind.UPDATE; + // Validate before publishing a row into storage or changing its state. + long nextVersion = MutationVersions.next(kind, entity.getVersion()); String typeName = entity.typeName(); TypeStorage storage = database.computeIfAbsent(typeName, k -> new TypeStorage(maxEntriesPerType)); @@ -91,12 +93,13 @@ public MutationResult mutate(UserContext context, PersistenceMutation request) { throw new TeaQLRuntimeException("Entity ID must be allocated before save"); } storage.data.put(entity.getId(), entity); - ((BaseEntity) entity).__internalSet("version", entity.getVersion() == null ? 1L : entity.getVersion() + 1); + ((BaseEntity) entity).__internalSet("version", nextVersion); if (entity instanceof BaseEntity) { ((BaseEntity) entity).gotoNextStatus(EntityAction.PERSIST); } } else if (mutation.getAction() == EntityPersistenceMutation.Action.DELETE) { storage.data.remove(entity.getId()); + ((BaseEntity) entity).__internalSet("version", nextVersion); if (entity instanceof BaseEntity) { ((BaseEntity) entity).gotoNextStatus(EntityAction.PERSIST); } diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryQueries.java b/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryQueries.java new file mode 100644 index 000000000..0eecfc63a --- /dev/null +++ b/teaql-runtime/src/main/java/io/teaql/runtime/memory/MemoryQueries.java @@ -0,0 +1,188 @@ +package io.teaql.runtime.memory; + +import io.teaql.core.*; +import io.teaql.core.criteria.*; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.runtime.DefaultQueryResult; +import java.util.*; +import java.util.function.Function; + +/** Execution-local memory query materialization. Stored rows are never result carriers. */ +final class MemoryQueries { + private final UserContext context; + private final Function> rows; + private final CriteriaFilter filter = new CriteriaFilter<>(); + + MemoryQueries(UserContext context, Function> rows) { + this.context = context; + this.rows = rows; + } + + DefaultQueryResult execute(SearchRequest request) { + SearchCriteria criteria = resolveCriteria(request.getSearchCriteria(), request); + var members = new ArrayList(); + for (Entity row : rows.apply(request.getTypeName())) if (filter.accept(row, criteria)) members.add(row); + var aggregation = MemoryAggregations.calculate(request.getAggregations(), members); + if (aggregation != null) return new DefaultQueryResult(new SmartList<>(), aggregation); + + sort(members, request); + var result = new SmartList(); + Slice slice = request.getSlice(); + int start = slice == null ? 0 : Math.min(members.size(), Math.max(0, slice.getOffset())); + int end = slice == null ? members.size() : (int) Math.min(members.size(), (long) start + Math.max(0, slice.getSize())); + var states = new HashMap(); + for (Entity source : members.subList(start, end)) { + BaseEntity row = materialize(source, request); + var state = row.__internalLoadState().withDynamicPropertyMetadata(request.getDynamicPropertyMetadata()); + row.__internalUseLoadState(states.computeIfAbsent(state, ignored -> state)); + result.add(row); + } + attachAggregates(result, request); + attachFacets(result, members, request); + return new DefaultQueryResult(result, null); + } + + private static Object scalar(Object value) { + return value instanceof Entity entity ? entity.getId() : value; + } + + private SearchCriteria resolveCriteria(SearchCriteria criteria, SearchRequest owner) { + if (criteria instanceof SubQuerySearchCriteria sub) { + var query = child(owner, sub.getDependsOn(), null, "subquery"); + query.setAggregations(new Aggregations()); + query.groupBy("membership", sub.getDependsOnPropertyName()); + // A grouped aggregate describes full membership, independent of a page slice. + var values = context.internalAggregation(query).toList().stream() + .map(value -> value.get("membership")).filter(Objects::nonNull).toList(); + return new TwoOperatorCriteria(Operator.IN, new PropertyReference(sub.getPropertyName()), + new Parameter("membership", values, Operator.IN)); + } + if (criteria instanceof AND and) return new AND(and.getExpressions().stream() + .map(value -> resolveCriteria((SearchCriteria) value, owner)).toArray(SearchCriteria[]::new)); + if (criteria instanceof OR or) return new OR(or.getExpressions().stream() + .map(value -> resolveCriteria((SearchCriteria) value, owner)).toArray(SearchCriteria[]::new)); + if (criteria instanceof NOT not) return new NOT(resolveCriteria((SearchCriteria) not.first(), owner)); + if (criteria instanceof VersionSearchCriteria version) + return new VersionSearchCriteria(resolveCriteria(version.getSearchCriteria(), owner)); + return criteria; + } + + private static QueryRequestSnapshot child(SearchRequest owner, SearchRequest template, + QueryOperation operation, String name) { + var parent = QueryRequestScope.capture(owner); + if (operation != null) parent = parent.deriveOperation(owner.getTypeName(), operation); + return new QueryRequestSnapshot<>(template, parent.deriveChild(name, template.comment())); + } + + private static String property(Expression expression) { + if (expression instanceof AggrExpression aggregate && aggregate.getOperator() == AggrFunction.SELF) + expression = aggregate.first(); + if (expression instanceof PropertyReference reference) return reference.getPropertyName(); + throw new TeaQLRuntimeException("Unsupported memory property expression: " + expression); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private static void sort(List members, SearchRequest request) { + if (request.getOrderBy() == null) return; + Comparator comparator = null; + for (OrderBy order : request.getOrderBy().getOrderBys()) { + String name = property(order.getExpression()); + if (!"ASC".equals(order.getDirection()) && !"DESC".equals(order.getDirection())) + throw new TeaQLRuntimeException("Unsupported memory sort direction"); + Comparator next = Comparator.comparing(row -> (Comparable) scalar(row.getProperty(name)), + Comparator.nullsLast(Comparator.naturalOrder())); + if ("DESC".equals(order.getDirection())) next = next.reversed(); + comparator = comparator == null ? next : comparator.thenComparing(next); + } + if (comparator != null) members.sort(comparator); + } + + private BaseEntity materialize(Entity source, SearchRequest request) { + if (!(request.internalNewEntity() instanceof BaseEntity row)) + throw new TeaQLRuntimeException("Memory query requires a BaseEntity hydration factory"); + var selected = new LinkedHashMap(); + if (request.getProjections().isEmpty()) { + EntityDescriptor descriptor = EntityMetaFactory.requireFrom(context).resolveEntityDescriptor(request.getTypeName()); + for (; descriptor != null; descriptor = descriptor.getParent()) + for (var field : descriptor.getOwnProperties()) selected.put(field.getName(), field.getName()); + } else for (var field : request.getProjections()) selected.put(field.name(), property(field.getExpression())); + selected.put(BaseEntity.ID_PROPERTY, BaseEntity.ID_PROPERTY); + selected.put(BaseEntity.VERSION_PROPERTY, BaseEntity.VERSION_PROPERTY); + for (var field : selected.entrySet()) { + Object value = source.getProperty(field.getValue()); + if (value instanceof Entity reference) { + // An FK is loaded, but its unrequested detail is not. Never expose the stored graph. + var descriptor = EntityMetaFactory.requireFrom(context).resolveEntityDescriptor(reference.typeName()); + if (!(descriptor.createEntity() instanceof BaseEntity refer)) + throw new TeaQLRuntimeException("Memory relation requires a BaseEntity hydration factory"); + refer.__internalSet("id", reference.getId()); + refer.set$status(EntityStatus.REFER); + value = refer; + } + row.__internalHydrate(field.getKey(), value, BaseEntity.loadedPropertyIndex(row.getClass(), field.getKey())); + } + row.set$status(row.getVersion() != null && row.getVersion() < 0 ? EntityStatus.PERSISTED_DELETED : EntityStatus.PERSISTED); + row.setTraceChain(QueryRequestScope.capture(request).traceChain()); + return row; + } + + private void attachAggregates(SmartList parents, SearchRequest request) { + for (SimpleAggregation attribute : request.getDynamicAggregateAttributes()) { + var template = attribute.getAggregateRequest(); + String partition = template.getPartitionProperty(); + if (partition == null || partition.isBlank()) throw new TeaQLRuntimeException("Memory related aggregate requires a partition property"); + var query = child(request, template, attribute.getOperation(), template.getTypeName()); + if (query.getAggregations().getAggregates().isEmpty()) query.count(attribute.getName()); + if (attribute.isSingleNumber() && query.getAggregations().getAggregates().size() != 1) + throw new TeaQLRuntimeException("Memory scalar related aggregate requires exactly one aggregate"); + query.groupBy(partition); + query.appendSearchCriteria(query.createBasicSearchCriteria(partition, Operator.IN, parents.mapById().keySet())); + var calculated = context.internalAggregation(query); + var byId = parents.mapById(); + if (attribute.isSingleNumber()) { + var selected = query.getAggregations().getAggregates().get(0); + var expression = selected.getExpression(); + Object empty = expression instanceof AggrExpression aggregate && aggregate.getOperator() == AggrFunction.COUNT ? 0L : null; + for (Entity parent : parents) parent.addDynamicProperty(attribute.getName(), empty); + for (var values : calculated.toList()) { + var parent = byId.get(values.get(partition)); + if (parent != null) parent.addDynamicProperty(attribute.getName(), values.get(selected.name())); + } + } else for (var values : calculated.toList()) { + var parent = byId.get(values.remove(partition)); + if (parent != null) parent.appendDynamicProperty(attribute.getName(), values); + } + } + } + + private void attachFacets(SmartList result, List members, SearchRequest request) { + for (FacetRequest facet : request.getFacetRequests()) { + var target = child(request, facet.getRequest(), facet.getOperation(), facet.getRequest().getTypeName()); + var counts = new LinkedHashMap(); + for (Entity member : members) { + Object id = scalar(member.getProperty(facet.getRelationName())); + if (id != null) counts.merge(id, 1L, Long::sum); + } + var aliases = new ArrayList(); + for (var selected : target.getAggregations().getAggregates()) { + if (!(selected.getExpression() instanceof AggrExpression aggregate) || aggregate.getOperator() != AggrFunction.COUNT) + throw new TeaQLRuntimeException("Memory facet counts require COUNT expressions"); + aliases.add(selected.name()); + } + if (aliases.isEmpty()) aliases.add("count"); + target.setAggregations(new Aggregations()); + var memberIds = members.stream().map(Entity::getId).toList(); + for (var aggregate : target.getDynamicAggregateAttributes()) { + var contribution = aggregate.getAggregateRequest(); + if (contribution.getTypeName().equals(request.getTypeName())) + contribution.appendSearchCriteria(target.createBasicSearchCriteria("id", Operator.IN, memberIds)); + } + if (facet.isMergeCriteria()) target.appendSearchCriteria(target.createBasicSearchCriteria("id", Operator.IN, counts.keySet())); + SmartList options = context.internalExecuteForList(target); + for (Entity option : options) for (String alias : aliases) + option.addDynamicProperty(alias, counts.getOrDefault(option.getId(), 0L)); + result.addFacet(facet.getFacetName(), options); + } + } +} diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/mutation/MutationPlanner.java b/teaql-runtime/src/main/java/io/teaql/runtime/mutation/MutationPlanner.java index fb13b0620..2e4a0fffa 100644 --- a/teaql-runtime/src/main/java/io/teaql/runtime/mutation/MutationPlanner.java +++ b/teaql-runtime/src/main/java/io/teaql/runtime/mutation/MutationPlanner.java @@ -34,6 +34,7 @@ public MutationPlanner(EntityMetaFactory metadata, InternalIdGenerationService i * 3. Tracking property changes in the entity root */ public EntityMutationLedger prepareEntity(UserContext ctx, Entity entity) { + MutationVersionAdmission.validateGraph(metadata, entity); EntityMutationLedger entityRoot = ((BaseEntity) entity).getEntityMutationLedger(); mergeRelatedEntityRoots(entity, entityRoot); @@ -58,6 +59,7 @@ public EntityMutationLedger prepareEntity(UserContext ctx, Entity entity) { */ public void executePlan(UserContext ctx, EntityMutationLedger entityRoot, Entity entity, MutationExecutor mutationExecutor) { + MutationVersionAdmission.validateGraph(metadata, entity); Map realEntities = new HashMap<>(); collectRealEntities(entity, realEntities); executeLedgerPlan(ctx, entityRoot, mutationExecutor, realEntities); diff --git a/teaql-runtime/src/main/java/io/teaql/runtime/mutation/MutationVersionAdmission.java b/teaql-runtime/src/main/java/io/teaql/runtime/mutation/MutationVersionAdmission.java new file mode 100644 index 000000000..2c6774027 --- /dev/null +++ b/teaql-runtime/src/main/java/io/teaql/runtime/mutation/MutationVersionAdmission.java @@ -0,0 +1,136 @@ +package io.teaql.runtime.mutation; + +import io.teaql.core.*; +import io.teaql.core.checker.*; +import io.teaql.core.meta.*; +import io.teaql.core.utils.NamingCase; +import java.util.*; + +/** Inspect the entire unexecuted graph before any customer callback or I/O. */ +public final class MutationVersionAdmission { + private MutationVersionAdmission() {} + + @FrameworkInternal("Mutation planning admission only, not post-write live-ledger replay") + public static void validateGraph(EntityMetaFactory metadata, Entity root) { + var validation = new Validation(metadata); + validation.visit(root, null); + for (var ledger : validation.ledgers) { + var changes = ledger.currentChangeSet(); + Set keys = new TreeSet<>(changes.changes().keySet()); + keys.addAll(changes.dynamicChanges().keySet()); + keys.addAll(ledger.deletedKeys()); keys.addAll(ledger.recoveredKeys()); + for (EntityKey key : keys) { + if (ledger.isNew(key) && ledger.isMarkedAsDelete(key)) continue; + if (validation.represented.contains(key)) continue; + var kind = ledger.isMarkedAsDelete(key) ? MutationOperationKind.DELETE + : ledger.isNew(key) ? MutationOperationKind.CREATE + : ledger.recoveredKeys().contains(key) ? MutationOperationKind.RECOVER : MutationOperationKind.UPDATE; + validation.check(kind, ledger.getOriginalVersion(key), key.entity(), null); + } + } + validation.finish(); + } + + @FrameworkInternal("Admission of the complete, still-unexecuted mutation plan") + public static void validatePlan(MutationPlan plan) { + var validation = new Validation(null); + for (var operation : plan.operations()) + validation.check(operation.kind(), operation.originalVersion(), operation.entity().entity(), null); + validation.finish(); + } + + private static final class Validation { + final EntityMetaFactory metadata; + final Set visited = Collections.newSetFromMap(new IdentityHashMap<>()); + final Set ledgers = Collections.newSetFromMap(new IdentityHashMap<>()); + final Set represented = new HashSet<>(); + final List violations = new ArrayList<>(); + List cancelledNewBranches; + MutationVersionException firstCause; + Validation(EntityMetaFactory metadata) { this.metadata = metadata; } + + void check(MutationOperationKind kind, Long version, String type, ObjectLocation parent) { + try { MutationVersions.next(kind, version); } + catch (MutationVersionException cause) { + var result = new CheckResult(); + result.setRuleId(CheckResult.RuleId.valueOf(cause.code().name())); + result.setRootType(type); + result.setLocation(parent == null ? ObjectLocation.hashRoot("version") : parent.member("version")); + result.setNaturalLanguageStatement(cause.getMessage()); + violations.add(result); + if (firstCause == null) firstCause = cause; + } + } + + void visit(Entity entity, ObjectLocation location) { + if (!(entity instanceof BaseEntity base) || !visited.add(entity)) return; + if (base.isNew() && base.isMarkedAsDelete()) { + if (cancelledNewBranches == null) cancelledNewBranches = new ArrayList<>(); + cancelledNewBranches.add(base); + return; + } + var ledger = base.getEntityMutationLedger(); ledgers.add(ledger); + var key = new EntityKey(entity.typeName(), entity.getId()); + if (base.get$status() != EntityStatus.REFER) { + represented.add(key); + var changes = ledger.currentChangeSet(); + MutationOperationKind kind = base.deleteItem() || ledger.isMarkedAsDelete(key) ? MutationOperationKind.DELETE + : base.newItem() || ledger.isNew(key) ? MutationOperationKind.CREATE + : base.recoverItem() || ledger.recoveredKeys().contains(key) ? MutationOperationKind.RECOVER + : base.updateItem() || !base.getUpdatedProperties().isEmpty() + || changes.changes().containsKey(key) || changes.dynamicChanges().containsKey(key) ? MutationOperationKind.UPDATE : null; + if (kind != null) { + Long version = base.getOriginalVersion(); + check(kind, version == null ? base.getVersion() : version, entity.typeName(), location); + } + } + for (var descriptor = metadata.resolveEntityDescriptor(entity.typeName()); descriptor != null; descriptor = descriptor.getParent()) { + for (var property : descriptor.getProperties()) { + if (!(property instanceof Relation)) continue; + String name = NamingCase.toUnderlineCase(property.getName()); + var childLocation = location == null ? ObjectLocation.hashRoot(name) : location.member(name); + Object value = entity.getProperty(property.getName()); + if (value instanceof Entity child) visit(child, childLocation); + else if (value instanceof Iterable children) { + int index = 0; + for (Object child : children) { if (child instanceof Entity related) visit(related, childLocation.element(index)); index++; } + } + } + } + } + + void finish() { + if (!violations.isEmpty()) { + var error = new CheckException(violations); error.initCause(firstCause); throw error; + } + if (cancelledNewBranches != null) { + // Do not guess whether to discard pending descendant intent or + // cascade cancellation. An ambiguous branch must never write + // orphan records. Explicitly reached live objects remain live; + // a different same-ID view/reference does not authorize adoption. + Set active = Collections.newSetFromMap(new IdentityHashMap<>()); + active.addAll(visited); + for (var branch : cancelledNewBranches) active.remove(branch); + Set seen = Collections.newSetFromMap(new IdentityHashMap<>()); + for (var branch : cancelledNewBranches) inspectCancelledBranch(branch, active, seen); + } + } + + private void inspectCancelledBranch(Entity entity, Set active, Set seen) { + if (!(entity instanceof BaseEntity base) || active.contains(entity) || !seen.add(entity)) return; + if (!(base.isNew() && base.isMarkedAsDelete()) + && (base.needPersist() || !base.getUpdatedProperties().isEmpty())) { + throw new TeaQLRuntimeException("CANCELLED_NEW_BRANCH_HAS_PENDING_DESCENDANTS: Explicitly cancel or reattach pending descendants before saving"); + } + for (var descriptor = metadata.resolveEntityDescriptor(entity.typeName()); descriptor != null; descriptor = descriptor.getParent()) { + for (var property : descriptor.getProperties()) { + if (!(property instanceof Relation)) continue; + Object value = entity.getProperty(property.getName()); + if (value instanceof Entity child) inspectCancelledBranch(child, active, seen); + else if (value instanceof Iterable children) + for (Object child : children) if (child instanceof Entity related) inspectCancelledBranch(related, active, seen); + } + } + } + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/CancelledNewGraphTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/CancelledNewGraphTest.java new file mode 100644 index 000000000..1b7197d3d --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/CancelledNewGraphTest.java @@ -0,0 +1,152 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import java.util.List; +import org.junit.Test; +import static io.teaql.runtime.GraphTraceChainTest.*; +import static org.junit.Assert.*; + +/** ML-12: cancellation is intent; save owns the graph's persistence decision. */ +public class CancelledNewGraphTest { + private static GraphEntity fresh(String type, long id) { + var entity = new GraphEntity(type); + entity.__internalInitializeNewEntityId(id); + entity.updateProperty("name", type + " new"); + return entity; + } + + @Test public void cancelledNewRootRecordsIntentAndRejectsOnlyAtSave() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var context = new DefaultUserContext(runtime); + var root = fresh("CustomerOrder", 100L); + assertSame(root, root.markForDeletion()); + assertTrue(root.isNew()); assertTrue(root.isMarkedAsDelete()); + assertTrue(provider.requests.isEmpty()); + root.markForDeletion(); + root.updateProperty("name", "editing does not undo cancellation"); + var error = assertThrows(TeaQLRuntimeException.class, + () -> root.auditAs("cancel before first persistence").save(context)); + assertTrue(error.getMessage().contains("CANCELLED_NEW_ROOT")); + assertTrue(provider.requests.isEmpty()); + assertNull(root.getVersion()); assertEquals(Long.valueOf(100), root.getId()); + assertTrue(root.isNew()); assertTrue(root.isMarkedAsDelete()); + } + + @Test public void cancelledNewChildDoesNotSuppressItsLiveSiblingOrParent() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var context = new DefaultUserContext(runtime); + var root = fresh("CustomerOrder", 100L); + var cancelled = fresh("OrderItem", 201L); + var live = fresh("OrderItem", 202L); + cancelled.markForDeletion(); + root.updateProperty("children", List.of(cancelled, live)); + root.auditAs("omit only a cancelled new child").save(context); + assertEquals(2, provider.requests.size()); + assertTrue(provider.requests.stream().noneMatch(v -> Long.valueOf(201).equals(v.getEntity().getId()))); + assertTrue(provider.requests.stream().anyMatch(v -> Long.valueOf(100).equals(v.getEntity().getId()))); + assertTrue(provider.requests.stream().anyMatch(v -> Long.valueOf(202).equals(v.getEntity().getId()))); + assertNull(cancelled.getVersion()); + assertTrue(cancelled.isNew()); assertTrue(cancelled.isMarkedAsDelete()); + var error = assertThrows(TeaQLRuntimeException.class, + () -> cancelled.auditAs("cancelled child cannot be resurrected after parent save").save(context)); + assertTrue(error.getMessage().contains("CANCELLED_NEW_ROOT")); + assertEquals(2, provider.requests.size()); + } + + @Test public void anIncompleteCancelledChildIsNotValidatedOrWritten() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var root = fresh("CustomerOrder", 100L); + var cancelled = fresh("OrderItem", 201L); + cancelled.updateProperty("name", Double.NaN); + root.updateProperty("children", List.of(cancelled)); + cancelled.markForDeletion(); + root.auditAs("discard unfinished child before save").save(new DefaultUserContext(runtime)); + assertEquals(1, provider.requests.size()); + assertEquals(Long.valueOf(100), provider.requests.get(0).getEntity().getId()); + assertNull(cancelled.getVersion()); + } + + @Test public void cancellationAfterCompositionCannotBecomeAPersistedDelete() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var root = fresh("CustomerOrder", 100L); + var cancelled = fresh("OrderItem", 201L); + root.updateProperty("children", List.of(cancelled)); + cancelled.setEntityMutationLedger(root.getEntityMutationLedger()); + root.getEntityMutationLedger().markAsNew(new EntityKey("OrderItem", 201L)); + cancelled.markForDeletion(); + // Editing after cancellation must not silently undo PendingDeletion. + cancelled.updateProperty("name", "still cancelled"); + assertTrue(cancelled.isMarkedAsDelete()); + root.auditAs("retain precomposed cancellation intent").save(new DefaultUserContext(runtime)); + assertEquals(1, provider.requests.size()); + assertEquals(Long.valueOf(100), provider.requests.get(0).getEntity().getId()); + assertNull(cancelled.getVersion()); + } + + @Test public void cancellingOneChildDoesNotDisableValidationOfALiveSibling() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var root = fresh("CustomerOrder", 100L); + var cancelled = fresh("OrderItem", 201L); + var live = fresh("OrderItem", 202L); + cancelled.updateProperty("name", Double.NaN); + cancelled.markForDeletion(); + live.updateProperty("name", Double.NaN); + root.updateProperty("children", List.of(cancelled, live)); + assertThrows(io.teaql.core.checker.CheckException.class, + () -> root.auditAs("live sibling still requires valid values").save(new DefaultUserContext(runtime))); + assertTrue(provider.requests.isEmpty()); + assertTrue(cancelled.isMarkedAsDelete()); + // Standalone checking remains distinct from mutation-only graph admission. + assertFalse(io.teaql.core.checker.internal.FiniteScalarAdmission.collect(cancelled).isEmpty()); + } + + @Test public void pendingDescendantsOfACancelledBranchCannotLeakIntoTheSavePlan() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var root = fresh("CustomerOrder", 100L); + var cancelled = fresh("OrderItem", 201L); + var descendant = fresh("Payment", 301L); + cancelled.updateProperty("children", List.of(descendant)); + cancelled.markForDeletion(); + root.updateProperty("children", List.of(cancelled)); + var error = assertThrows(TeaQLRuntimeException.class, + () -> root.auditAs("do not persist an orphan from a cancelled branch").save(new DefaultUserContext(runtime))); + assertTrue(error.getMessage().contains("CANCELLED_NEW_BRANCH_HAS_PENDING_DESCENDANTS")); + assertTrue(provider.requests.isEmpty()); + assertNull(root.getVersion()); assertNull(descendant.getVersion()); + } + + @Test public void anExplicitLiveAliasOfTheDescendantKeepsItsOwnIntent() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var root = fresh("CustomerOrder", 100L); + var cancelled = fresh("OrderItem", 201L); + var descendant = fresh("Payment", 301L); + cancelled.updateProperty("children", List.of(descendant)); + cancelled.markForDeletion(); + root.updateProperty("children", List.of(cancelled, descendant)); + root.auditAs("retain the descendant explicitly reached through a live branch").save(new DefaultUserContext(runtime)); + assertEquals(2, provider.requests.size()); + assertTrue(provider.requests.stream().noneMatch(v -> Long.valueOf(201).equals(v.getEntity().getId()))); + assertTrue(provider.requests.stream().anyMatch(v -> Long.valueOf(301).equals(v.getEntity().getId()))); + } + + @Test public void sameNumericIdAndABackReferenceDoNotCancelTheLiveRoot() { + var provider = new Provider(); + var runtime = TeaQLRuntime.builder().metadata(metadata()).dataService("fixture", provider).build(); + var root = fresh("CustomerOrder", 1L); + var cancelled = fresh("OrderItem", 1L); + cancelled.updateProperty("children", List.of(root)); + cancelled.markForDeletion(); + root.updateProperty("children", List.of(cancelled)); + root.auditAs("preserve the distinct live root through a cyclic reference").save(new DefaultUserContext(runtime)); + assertEquals(1, provider.requests.size()); + assertEquals("CustomerOrder", provider.requests.get(0).getEntity().typeName()); + assertNull(cancelled.getVersion()); assertTrue(cancelled.isMarkedAsDelete()); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/CanonicalMutationFieldControlsTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/CanonicalMutationFieldControlsTest.java new file mode 100644 index 000000000..432c9a457 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/CanonicalMutationFieldControlsTest.java @@ -0,0 +1,76 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import io.teaql.core.meta.EntityDescriptor; +import java.util.*; +import org.junit.Test; +import static io.teaql.runtime.CanonicalMutationFieldsTest.*; +import static org.junit.Assert.*; + +public class CanonicalMutationFieldControlsTest { + @Test public void canonicalNamesAreAcceptedWithoutRenamingThem() { + var fixture = new Fixture(true, null); var entity = fixture.entity(false); + entity.auditAs("calibrate native admission").save(fixture.context); + assertEquals(1, fixture.checkerCalls); assertEquals(1, fixture.policyCalls); assertEquals(1, fixture.ids); + assertEquals(1, fixture.provider.mutations); assertEquals(1, fixture.provider.begins); assertEquals(1, fixture.audits); + } + @Test public void explicitModelFieldMayLegitimatelyEndInId() { + var fixture = new Fixture(true, null); fixture.descriptor.getProperties().add(property("type_platform_id")); + var entity = fixture.entity(false); entity.updateProperty("type_platform_id", 4L); + entity.auditAs("preserve explicitly modeled suffix").save(fixture.context); assertEquals(1, fixture.provider.mutations); + } + @Test public void emptyLegacyMetadataDoesNotInventAFieldContract() { + var fixture = new Fixture(false, null); fixture.descriptor.setProperties(List.of()); + var entity = fixture.entity(false); entity.updateProperty("requiredString", "legacy"); + entity.auditAs("preserve manual empty metadata").save(fixture.context); assertEquals(1, fixture.provider.mutations); + } + @Test public void inheritedCanonicalPropertiesRemainValid() { + var fixture = new Fixture(true, null); var parent = new EntityDescriptor(); parent.setType("BaseProbe"); + parent.setProperties(List.of(property("inherited_name"))); fixture.descriptor.setParent(parent); + var entity = fixture.entity(false); entity.updateProperty("inherited_name", "inherited"); + entity.auditAs("use inherited model field").save(fixture.context); assertEquals(1, fixture.provider.mutations); + } + @Test public void invalidDescendantIsRejectedBeforeAnyGraphHook() { + var fixture = new Fixture(true, null); var parent = fixture.entity(false); var child = fixture.entity(false); + child.updateProperty("requiredString", "PRIVATE_BAD_CHILD"); parent.updateProperty("children", List.of(child)); + var error = assertThrows(CheckException.class, () -> parent.auditAs("reject bad descendant").save(fixture.context)); + assertEquals("children[0].requiredString", error.getViolates().get(0).getLocation().modelPath()); + assertEquals(0, fixture.checkerCalls); assertEquals(0, fixture.provider.mutations); assertEquals(0, fixture.ids); + } + @Test public void failureDoesNotPoisonIndependentSaveOnTheSameContext() { + var fixture = new Fixture(true, null); var bad = fixture.entity(false); bad.updateProperty("typePlatform", 1L); + assertThrows(CheckException.class, () -> bad.auditAs("reject bad first graph").save(fixture.context)); + var good = fixture.entity(false); good.auditAs("save independent valid graph").save(fixture.context); + assertEquals(1, fixture.provider.mutations); assertEquals(1, fixture.policyCalls); assertEquals(1, fixture.audits); + } + @Test public void detachedLedgerChangesCannotBypassEarlyAdmission() { + var fixture = new Fixture(true, null); var entity = fixture.entity(false); + entity.getEntityMutationLedger().set(new EntityKey("NameProbe", 900L), "typePlatform", 1L); + assertThrows(CheckException.class, () -> entity.auditAs("reject detached alias").save(fixture.context)); + assertEquals(0, fixture.ids); assertEquals(0, fixture.checkerCalls); assertEquals(0, fixture.policyCalls); + assertEquals(0, fixture.provider.begins); assertEquals(0, fixture.provider.mutations); + } + @Test public void planAdmissionRejectsAliasesButAllowsOnlyTypedDynamicIntents() { + var fixture = new Fixture(false, null); + for (var name : List.of("storage", "native", "scalar", "unknown", "equal", "unequal")) { + var plan = new MutationPlan("canonical-plan", "NameProbe.saveGraph", "NameProbe", "inspect canonical plan", + List.of(new MutationOperation(MutationOperationKind.UPDATE, new EntityKey("NameProbe", 1L), 1L, invalid(name)))); + assertThrows(CheckException.class, () -> CanonicalMutationFields.validatePlan(fixture.context, fixture.metadata, plan)); + } + var dynamic = io.teaql.data.dynamic.DynamicFieldMutation.set("rating", io.teaql.data.dynamic.DynamicDataType.NUMBER, 3); + var plan = new MutationPlan("typed-dynamic", "NameProbe.saveGraph", "NameProbe", "inspect typed extension", + List.of(new MutationOperation(MutationOperationKind.UPDATE, new EntityKey("NameProbe", 1L), 1L, Map.of("#rating", dynamic)))); + CanonicalMutationFields.validatePlan(fixture.context, fixture.metadata, plan); + var untyped = new MutationPlan("untyped-dynamic", "NameProbe.saveGraph", "NameProbe", "reject untyped extension", + List.of(new MutationOperation(MutationOperationKind.UPDATE, new EntityKey("NameProbe", 1L), 1L, Map.of("#rating", 3)))); + assertThrows(CheckException.class, () -> CanonicalMutationFields.validatePlan(fixture.context, fixture.metadata, untyped)); + } + @Test public void fixedLedgerDoesNotAcquireTheTypedDynamicChannelByPrefix() { + var fixture = new Fixture(true, null); var entity = fixture.entity(true); + var dynamic = io.teaql.data.dynamic.DynamicFieldMutation.set("rating", io.teaql.data.dynamic.DynamicDataType.NUMBER, 3); + entity.getEntityMutationLedger().set(new EntityKey("NameProbe", 1L), "#rating", dynamic); + assertThrows(CheckException.class, () -> entity.auditAs("reject wrong ledger channel").save(fixture.context)); + assertEquals(0, fixture.provider.mutations); assertEquals(0, fixture.checkerCalls); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/CanonicalMutationFieldsTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/CanonicalMutationFieldsTest.java new file mode 100644 index 000000000..b3c2df7f2 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/CanonicalMutationFieldsTest.java @@ -0,0 +1,117 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.core.checker.*; +import io.teaql.core.meta.*; +import java.util.*; +import java.util.function.Consumer; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import static org.junit.Assert.*; + +/** Runtime admission tests; real generated SQLite acceptance is a separate gate. */ +@RunWith(Parameterized.class) +public class CanonicalMutationFieldsTest { + @Parameterized.Parameters(name = "{0}, update={1}") + public static Collection cases() { + var cases = new ArrayList(); + for (String name : List.of("storage", "native", "scalar", "unknown", "equal", "unequal")) + for (boolean update : new boolean[] {false, true}) cases.add(new Object[] {name, update}); + return cases; + } + private final String name; + private final boolean update; + public CanonicalMutationFieldsTest(String name, boolean update) { this.name = name; this.update = update; } + static Map invalid(String name) { + var fields = new LinkedHashMap(); + switch (name) { + case "storage" -> fields.put("type_platform_id", 1L); + case "native" -> fields.put("typePlatform", 1L); + case "scalar" -> fields.put("requiredString", "PRIVATE_BAD_ALIAS"); + case "unknown" -> fields.put("unknown_field", "PRIVATE_BAD_UNKNOWN"); + default -> { fields.put("type_platform", 1L); fields.put("type_platform_id", name.equals("equal") ? 1L : 2L); } + } + return fields; + } + @Test public void rejectsPendingFieldsBeforeCheckerPolicyAndProvider() { + var fixture = new Fixture(true, null); var entity = fixture.entity(update); + invalid(name).forEach(entity::updateProperty); + rejected(fixture, entity, 0); + } + @Test public void rejectsRawLedgerKeysEvenWithoutLocalPropertyChanges() { + var fixture = new Fixture(true, null); var entity = fixture.entity(update); + if (!update) entity.__internalInitializeNewEntityId(1L); + invalid(name).forEach((field, value) -> entity.getEntityMutationLedger().set(new EntityKey("NameProbe", 1L), field, value)); + rejected(fixture, entity, 0); + } + @Test public void rejectsBadFixOutputBeforePolicyIdAllocationOrProvider() { + var fixture = new Fixture(true, entity -> invalid(name).forEach(entity::updateProperty)); + rejected(fixture, fixture.entity(update), 1); + } + @Test public void admissionDoesNotDependOnCustomCheckerPresence() { + var fixture = new Fixture(false, null); var entity = fixture.entity(update); + invalid(name).forEach(entity::updateProperty); + rejected(fixture, entity, 0); + } + static void rejected(Fixture fixture, Probe entity, int checkerCalls) { + var error = assertThrows(CheckException.class, () -> entity.auditAs("reject malformed model fields").save(fixture.context)); + assertFalse(error.getViolates().isEmpty()); + for (var violation : error.getViolates()) { + assertEquals("UNKNOWN_FIELD", violation.getRuleId().name()); assertEquals("NameProbe", violation.getRootType()); + assertNull(violation.getInputValue()); assertNotNull(violation.getLocation()); + } + assertFalse(error.getMessage().contains("PRIVATE_BAD")); + assertEquals(checkerCalls, fixture.checkerCalls); assertEquals(0, fixture.policyCalls); + assertEquals(0, fixture.ids); assertEquals(0, fixture.provider.mutations); assertEquals(0, fixture.provider.begins); assertEquals(0, fixture.audits); + } + static final class Probe extends BaseEntity { + final Map values = new HashMap<>(); + @Override public String typeName() { return "NameProbe"; } + @Override public Object __internalGet(String field) { return field.equals("id") || field.equals("version") ? super.__internalGet(field) : values.get(field); } + @Override public void __internalSet(String field, Object value) { + if (field.equals("id") || field.equals("version")) super.__internalSet(field, value); else values.put(field, value); + } + } + static PropertyDescriptor property(String name) { var property = new PropertyDescriptor(); property.setName(name); return property; } + static final class Fixture { + final SimpleEntityMetaFactory metadata = new SimpleEntityMetaFactory(); + final EntityDescriptor descriptor = new EntityDescriptor(); + final Provider provider = new Provider(); + final DefaultUserContext context; + int checkerCalls, policyCalls, ids, audits; + Fixture(boolean installChecker, Consumer fix) { + descriptor.setType("NameProbe"); descriptor.setDataService("fixture"); descriptor.setTargetType(Probe.class); descriptor.setEntitySupplier(Probe::new); + var children = new Relation(); children.setName("children"); children.setOwner(descriptor); + descriptor.setProperties(new ArrayList<>(List.of(property("id"), property("version"), property("required_string"), property("type_platform"), children))); + metadata.register(descriptor); + var policy = new MutationPolicy() { + public MutationPolicyIdentity identity() { return new MutationPolicyIdentity("canonical-fields", "1", "sha256:canonical-fields"); } + public MutationDecision review(UserContext caller, MutationPlan plan) { policyCalls++; return MutationDecision.allow(); } + }; + var runtime = TeaQLRuntime.builder().metadata(metadata).dataService("fixture", provider).executionLogging(false) + .idGenerationService((caller, entity) -> { ids++; return 100L + ids; }) + .mutationPolicyRegistry(key -> Optional.of(policy)).build(); + if (installChecker) runtime.install(RuntimeModule.of().withCheckers(new Checker() { + public String type() { return "NameProbe"; } + public void checkAndFix(UserContext caller, Probe entity, ObjectLocation location) { + checkerCalls++; markAsChecked(caller, entity); if (fix != null) fix.accept(entity); + } + })); + context = new DefaultUserContext(runtime); + context.putAttribute(AppAuditEventSink.class.getName(), (AppAuditEventSink) (caller, event) -> audits++); + } + Probe entity(boolean update) { + var entity = new Probe(); + if (update) { entity.__internalSet("id", 1L); entity.__internalSet("version", 1L); entity.set$status(EntityStatus.PERSISTED); } + entity.updateProperty("required_string", "valid"); entity.updateProperty("type_platform", 1L); return entity; + } + } + static final class Provider implements MutationExecutor, TransactionExecutor { + int mutations, begins; + public MutationResult mutate(UserContext context, PersistenceMutation request) { mutations++; return new DefaultMutationResult(((EntityPersistenceMutation) request).getEntity()); } + public T executeInTransaction(UserContext context, TransactionCallback callback) { begins++; return callback.doInTransaction(); } + public String name() { return "fixture"; } + public DataServiceCapabilities capabilities() { return new DataServiceCapabilities(); } + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/CheckerCachedPresentationTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/CheckerCachedPresentationTest.java new file mode 100644 index 000000000..1eafc9264 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/CheckerCachedPresentationTest.java @@ -0,0 +1,74 @@ +package io.teaql.runtime; + +import static org.junit.Assert.*; +import io.teaql.core.checker.CheckResult; +import io.teaql.core.checker.ObjectLocation; +import java.util.List; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +/** Cached diagnostic presentation must retain its pre-mask validation length. */ +public class CheckerCachedPresentationTest { + @Rule public TestWatcher receipt = new TestWatcher() { + @Override protected void succeeded(Description d) { System.out.println("JAVA_CHECKER_PRESENTATION_CASE="+d.getMethodName()+":passed"); } + @Override protected void failed(Throwable e, Description d) { System.out.println("JAVA_CHECKER_PRESENTATION_CASE="+d.getMethodName()+":failed"); } + }; + + @Test public void cachedAutomaticMessageFollowsTheCurrentLocale() { + var context=new DefaultUserContext(null); + var result=CheckResult.required(ObjectLocation.hashRoot("product_name")); + context.translateCheckResult(result); + String english=result.getNaturalLanguageStatement(); + context.setLocaleCode("zh-CN").translateCheckResults(List.of(result)); + assertNotEquals(english,result.getNaturalLanguageStatement()); + assertEquals(context.i18nCatalog().render(result,context.locale()),result.getNaturalLanguageStatement()); + } + + @Test public void cachedAutomaticMessageFollowsItsRelocatedCanonicalPath() { + var context=new DefaultUserContext(null); + var result=CheckResult.min(ObjectLocation.hashRoot("unit_price"),2,1); + context.translateCheckResult(result); + result.setLocation(ObjectLocation.hashRoot("order_item_list").element(2).member("unit_price")); + context.translateCheckResults(List.of(result)); + assertEquals(context.i18nCatalog().render(result,context.locale()),result.getNaturalLanguageStatement()); + assertTrue(result.getNaturalLanguageStatement(),result.getNaturalLanguageStatement().contains("order_item_list")); + } + + @Test public void retranslationKeepsTheActualLengthNotTheRedactedSentinelLength() { + var context=new DefaultUserContext(null); + var result=CheckResult.minStr(ObjectLocation.hashRoot("password"),12,"密钥🔑abc"); + context.translateCheckResult(result); + assertEquals("[REDACTED]",result.getInputValue()); + result.setLocation(ObjectLocation.hashRoot("order_item_list").element(2).member("password")); + context.setLocaleCode("zh-CN").translateCheckResults(List.of(result)); + assertEquals(context.i18nCatalog().render(result,context.locale(),7),result.getNaturalLanguageStatement()); + assertEquals(12,result.getSystemValue()); + assertFalse(result.getNaturalLanguageStatement().contains("密钥🔑abc")); + result.setInputValue("short"); + context.translateCheckResults(List.of(result)); + assertEquals(context.i18nCatalog().render(result,context.locale(),5),result.getNaturalLanguageStatement()); + assertEquals("[REDACTED]",result.getInputValue()); + } + + @Test public void replacingAnAutomaticMessageWithCustomerTextStopsAutomaticRerendering() { + var context=new DefaultUserContext(null); + var result=CheckResult.required(ObjectLocation.hashRoot("product_name")); + context.translateCheckResult(result); + result.setNaturalLanguageStatement("Customer-owned explanation"); + result.setLocation(ObjectLocation.hashRoot("order_item_list").element(2).member("product_name")); + context.setLocaleCode("zh-CN").translateCheckResults(List.of(result)); + assertEquals("Customer-owned explanation",result.getNaturalLanguageStatement()); + } + + @Test public void presentationCachePayloadContainsOnlyFingerprintsAndCounters() throws Exception { + Class entry=Class.forName("io.teaql.core.checker.internal.CheckerPresentationCache$Entry"); + int fields=0; + for (var field : entry.getDeclaredFields()) if (!java.lang.reflect.Modifier.isStatic(field.getModifiers())) { + assertTrue(field.toString(),field.getType() == int.class || field.getType() == byte[].class); + fields++; + } + assertEquals(3,fields); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/CheckerDiagnosticPrivacyTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/CheckerDiagnosticPrivacyTest.java new file mode 100644 index 000000000..117d2151b --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/CheckerDiagnosticPrivacyTest.java @@ -0,0 +1,232 @@ +package io.teaql.runtime; + +import static org.junit.Assert.*; +import io.teaql.core.BaseEntity; +import io.teaql.core.UserContext; +import io.teaql.core.checker.*; +import io.teaql.core.checker.internal.CheckerInvocation; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.concurrent.TimeUnit; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +/** Real context Checker boundaries, without a database or generated model. */ +public class CheckerDiagnosticPrivacyTest { + private static final String SECRET = "private-contact-314159"; + @Rule public TestWatcher receipt = new TestWatcher() { + @Override protected void succeeded(Description d) { System.out.println("JAVA_CHECKER_PRIVACY_CASE=" + d.getMethodName() + ":passed"); } + @Override protected void failed(Throwable e, Description d) { System.out.println("JAVA_CHECKER_PRIVACY_CASE=" + d.getMethodName() + ":failed"); } + }; + private static UserContext context() { + var descriptor = new EntityDescriptor(); descriptor.setType("OrderItem"); + descriptor.setAuditMaskFields(List.of("contactPhone")); + var metadata = new SimpleEntityMetaFactory(); metadata.register(descriptor); + return new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata).build()); + } + private static Checker checker() { + return new Checker<>() { + public String type() { return "OrderItem"; } + public void checkAndFix(UserContext context, BaseEntity entity, ObjectLocation location) {} + }; + } + private static CheckResult invalid(String field, Object value) { + var result = CheckResult.invalidType(ObjectLocation.hashRoot(field), "Invalid supplied value"); + result.setInputValue(value); result.setRootType("OrderItem"); return result; + } + @SuppressWarnings("unchecked") private static List results(UserContext context) { + return (List) CheckerInvocation.attribute(context, Checker.TEAQL_DATA_CHECK_RESULT); + } + @Test public void modelMaskProtectsWireExceptionAndToString() throws Exception { + var context = context(); var result = invalid("contact_phone", SECRET); + checker().appendResult(context, result); + assertEquals("pr******************59", result.getInputValue()); + for (String text : List.of(result.toString(), new CheckException(List.of(result)).toString(), + new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(result.toWire(JsonFieldNamingProfile.CAMEL_CASE)))) + assertFalse(text, text.contains(SECRET)); + } + @Test public void credentialsAndStructuredCredentialsNeedNoDeclaredMask() { + var context = context(); + for (var result : List.of(invalid("password", SECRET), invalid("profile", Map.of("access_token", SECRET)))) { + checker().appendResult(context, result); assertEquals("[REDACTED]", result.getInputValue()); + } + } + @Test public void originalValidationLengthSurvivesCredentialRedactionInBothLocales() { + var context = context(); String input = "密钥🔑abc"; + for (String locale : List.of("en-US", "zh-CN")) { + context.setLocaleCode(locale); + var result = CheckResult.minStr(ObjectLocation.hashRoot("password"), 12, input); + checker().appendResult(context, result); + assertEquals("[REDACTED]", result.getInputValue()); + // Preserve the existing Java checker unit (UTF-16), not the mask length. + assertTrue(result.getNaturalLanguageStatement(), result.getNaturalLanguageStatement().contains("7")); + assertFalse(result.getNaturalLanguageStatement().contains(input)); + assertEquals(12, result.getSystemValue()); + } + } + @Test public void nestedPathsAliasesAndProfilesAreUnchanged() { + var context = context(); var result = invalid("contact_phone", SECRET); + var location = ObjectLocation.hashRoot("order_item_list").element(2).member("contact_phone"); + result.setLocation(location); result.setSourceInstancePath("/items/2/legacy~0phone"); + checker().appendResult(context, result); + assertNotEquals(SECRET, result.getInputValue()); assertSame(location, result.getLocation()); + assertEquals("OrderItem", result.getRootType()); + assertEquals("/orderItemList/2/contactPhone", result.toWire(JsonFieldNamingProfile.CAMEL_CASE).instancePath()); + assertEquals("/order_item_list/2/contact_phone", result.toWire(JsonFieldNamingProfile.SNAKE_CASE).instancePath()); + assertEquals("/OrderItemList/2/ContactPhone", result.toWire(JsonFieldNamingProfile.PASCAL_CASE).instancePath()); + assertEquals("/items/2/legacy~0phone", result.getSourceInstancePath()); + } + @Test public void ordinaryValuesBoundsAndCustomerExplanationRemainIntact() { + var context = context(); var numeric = CheckResult.min(ObjectLocation.hashRoot("quantity"), 2, 1); + checker().appendResult(context, numeric); + assertEquals(1, numeric.getInputValue()); assertEquals(2, numeric.getSystemValue()); + var custom = invalid("name", "ordinary"); custom.setNaturalLanguageStatement("customer-owned explanation"); + checker().appendResult(context, custom); + assertEquals("ordinary", custom.getInputValue()); + assertEquals("customer-owned explanation", custom.getNaturalLanguageStatement()); + } + @Test public void numericShortUnicodeAndNullUseTheExistingAuditAlgorithm() { + var context = context(); + for (Object[] pair : new Object[][] {{12345L,"*****"},{"短🔑文","***"},{null,null}}) { + var result = invalid("contact_phone", pair[0]); checker().appendResult(context, result); + assertEquals(pair[1], result.getInputValue()); + } + } + @Test public void dynamicFieldIsMaskedWithoutChangingItsIdentity() { + var result = invalid("#extra", SECRET); checker().appendResult(context(), result); + assertNotEquals(SECRET, result.getInputValue()); assertEquals("#extra", result.getLocation().modelPath()); + } + @Test public void maskedCollectionsDoNotMutateTheInputAndAreIdempotent() { + var source = new ArrayList<>(List.of(SECRET, "short")); + var context = context(); var result = invalid("contact_phone", source); + checker().appendResult(context, result); + assertEquals(List.of(SECRET, "short"), source); + assertFalse(String.valueOf(result.getInputValue()).contains(SECRET)); + Object safe = result.getInputValue(); String message = result.getNaturalLanguageStatement(); + context.translateCheckResult(result); + assertEquals(safe, result.getInputValue()); assertEquals(message, result.getNaturalLanguageStatement()); + } + @Test public void batchTranslationScrubsEarlierAndLaterCustomMessages() { + var a = invalid("name", "ordinary"); a.setNaturalLanguageStatement("Please fix " + SECRET + " first"); + var b = invalid("contact_phone", SECRET); b.setNaturalLanguageStatement("Contact " + SECRET + " was rejected"); + context().translateCheckResults(List.of(a,b)); + assertEquals("Please fix [REDACTED] first", a.getNaturalLanguageStatement()); + assertEquals("Contact [REDACTED] was rejected", b.getNaturalLanguageStatement()); + } + @Test public void invocationScrubsSiblingMessagesRegardlessOfRuleOrder() { + for (boolean sensitiveFirst : List.of(true,false)) { + var context = context(); + try (var invocation = CheckerInvocation.open(context)) { + var a = invalid("name", "ordinary"); a.setNaturalLanguageStatement("Please fix " + SECRET + " first"); + var b = invalid("contact_phone", SECRET); + checker().appendResult(context, sensitiveFirst ? b : a); + checker().appendResult(context, sensitiveFirst ? a : b); + assertEquals("Please fix [REDACTED] first", a.getNaturalLanguageStatement()); + } + } + } + @Test public void nestedIndependentInvocationDoesNotBorrowOuterSecrets() { + var context = context(); + try (var outer = CheckerInvocation.open(context)) { + checker().appendResult(context, invalid("contact_phone", SECRET)); + try (var inner = CheckerInvocation.open(context)) { + var result = invalid("name", "ordinary"); result.setNaturalLanguageStatement("Separate " + SECRET); + checker().appendResult(context, result); assertEquals("Separate " + SECRET, result.getNaturalLanguageStatement()); + } + var result = invalid("name", "ordinary"); result.setNaturalLanguageStatement("Outer " + SECRET); + checker().appendResult(context, result); assertEquals("Outer [REDACTED]", result.getNaturalLanguageStatement()); + } + var outside = invalid("name", "ordinary"); outside.setNaturalLanguageStatement("Outside " + SECRET); + checker().appendResult(context, outside); assertEquals("Outside " + SECRET, outside.getNaturalLanguageStatement()); + } + @Test public void invalidTypeHelperCannotRestoreTheRawMessageAfterTranslation() { + var context = context(); + try (var invocation = CheckerInvocation.open(context)) { + checker().appendResult(context, invalid("contact_phone", SECRET)); + checker().invalidTypeCheck(context, ObjectLocation.hashRoot("name"), "Bad input " + SECRET); + assertEquals("Bad input [REDACTED]", results(context).get(1).getNaturalLanguageStatement()); + } + } + @Test public void credentialsInExpectedConstraintsAreRedactedButNumericBoundsRemain() { + var context = context(); var result = invalid("password", SECRET); + result.setSystemValue("private-expected-password"); checker().appendResult(context, result); + assertEquals("[REDACTED]", result.getSystemValue()); + var numeric = CheckResult.minStr(ObjectLocation.hashRoot("password"), 12, SECRET); + checker().appendResult(context,numeric); assertEquals(12,numeric.getSystemValue()); + } + @Test public void credentialAncestorIsProtectedWithoutRewritingThePath() { + var result = invalid("value", SECRET); + result.setLocation(ObjectLocation.hashRoot("credentials").member("password").member("value")); + checker().appendResult(context(), result); assertEquals("[REDACTED]",result.getInputValue()); + assertEquals("credentials.password.value",result.getLocation().modelPath()); + } + @Test public void shortCredentialCannotCorruptGeneratedNumericBoundsOrLengths() { + var context = context(); + try (var invocation = CheckerInvocation.open(context)) { + var result = CheckResult.minStr(ObjectLocation.hashRoot("password"),12,"1"); + checker().appendResult(context,result); + String message = result.getNaturalLanguageStatement(); + assertTrue(message,message.contains("12")); assertTrue(message,message.endsWith("is 1")); + checker().appendResult(context,invalid("password","2")); + assertEquals(message,result.getNaturalLanguageStatement()); + } + } + @Test public void batchKeepsTheCustomerLocalizationHookWithoutLettingItRestoreSecrets() { + var delegate=context(); int[] calls={0}; + UserContext customized=(UserContext)java.lang.reflect.Proxy.newProxyInstance( + UserContext.class.getClassLoader(),new Class[]{UserContext.class},(proxy,method,args) -> { + if (method.getName().equals("translateCheckResults")) + return java.lang.reflect.InvocationHandler.invokeDefault(proxy,method,args); + if (method.getName().equals("translateCheckResult")) { + calls[0]++; var result=(CheckResult)args[0]; + assertNotEquals(SECRET,result.getInputValue()); + result.setInputValue(SECRET); result.setNaturalLanguageStatement("Custom locale: "+SECRET); + return result; + } + try { return method.invoke(delegate,args); } + catch (java.lang.reflect.InvocationTargetException error) { throw error.getCause(); } + }); + var result=invalid("contact_phone",SECRET); + customized.translateCheckResults(List.of(result)); + assertEquals(1,calls[0]); assertNotEquals(SECRET,result.getInputValue()); + assertEquals("Custom locale: [REDACTED]",result.getNaturalLanguageStatement()); + } + @Test public void debugSwitchMustMatchExactlyAndNeverExposeCredentials() throws Exception { + for (String value : List.of("ABSENT", "true", LogPrivacy.ACKNOWLEDGEMENT)) { + var process = new ProcessBuilder(Path.of(System.getProperty("java.home"),"bin","java").toString(), + "-ea","-cp",childClasspath(), + CheckerDiagnosticPrivacyTest.class.getName(), value.equals(LogPrivacy.ACKNOWLEDGEMENT)?"debug":"safe"); + process.environment().remove(LogPrivacy.ENVIRONMENT); + if (!value.equals("ABSENT")) process.environment().put(LogPrivacy.ENVIRONMENT,value); + var output = Files.createTempFile("checker-privacy-child-", ".log"); Process child = null; + try { + child = process.redirectErrorStream(true).redirectOutput(output.toFile()).start(); + assertTrue("child timed out",child.waitFor(30,TimeUnit.SECONDS)); + assertEquals(Files.readString(output),0,child.exitValue()); + } finally { + if (child != null && child.isAlive()) { child.destroyForcibly(); child.waitFor(); } + Files.deleteIfExists(output); + } + } + } + private static String childClasspath() throws Exception { + var paths = new ArrayList(); + paths.add(System.getProperty("surefire.test.class.path",System.getProperty("java.class.path"))); + for (Class type : List.of(CheckerDiagnosticPrivacyTest.class, LogPrivacy.class, BaseEntity.class, + io.teaql.core.utils.SensitiveLogNames.class,io.teaql.data.dynamic.DynamicFieldsFacade.class)) + paths.add(Path.of(type.getProtectionDomain().getCodeSource().getLocation().toURI()).toString()); + return String.join(java.io.File.pathSeparator,paths); + } + public static void main(String[] args) { + var context=context();var business=invalid("contact_phone",SECRET); + checker().appendResult(context,business);assertEquals(args[0].equals("debug"),SECRET.equals(business.getInputValue())); + var password=invalid("password","private-auth-271828");password.setSystemValue("expected-auth-271828"); + checker().appendResult(context,password);assertEquals("[REDACTED]",password.getInputValue()); + assertEquals("[REDACTED]",password.getSystemValue()); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/EntityQueryProjectionTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/EntityQueryProjectionTest.java new file mode 100644 index 000000000..99aa8c440 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/EntityQueryProjectionTest.java @@ -0,0 +1,177 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; +import org.junit.Test; +import static org.junit.Assert.*; + +public class EntityQueryProjectionTest { + private static class RecordingExecutor implements QueryExecutor, StreamingQueryExecutor { + final List> requests = new ArrayList<>(); + boolean fail; + int closed; + private void record(QueryRequest request) { + requests.add(((DefaultQueryRequest) request).getSearchRequest()); + if (fail) throw new IllegalStateException("provider failed"); + } + @Override public QueryResult query(UserContext context, QueryRequest request) { + record(request); + return new DefaultQueryResult(new SmartList<>()); + } + @Override public Stream queryForStream(UserContext context, QueryRequest request) { + record(request); + return Stream.empty().onClose(() -> closed++); + } + @Override public String name() { return "dummy"; } + @Override public DataServiceCapabilities capabilities() { return null; } + } + + private BaseRequest request() { + var request = new BaseRequest(TeaQLRuntimeTest.DummyEntity.class) { + { + internalComment("load a sparse entity"); + internalPurpose("verify mandatory identity and version"); + } + @Override public String getTypeName() { return "Dummy"; } + @Override public SearchRequest diagnosticSource() { return this; } + }; + request.selectProperty("name"); + request.offset(0, 3); + return request; + } + private TeaQLRuntime runtime(RecordingExecutor executor) { + return TeaQLRuntime.builder().metadata(new TeaQLRuntimeTest.DummyMetaFactory()) + .dataService("dummy", executor).build(); + } + private List fields(SearchRequest request) { + return request.getProjections().stream().map(SimpleNamedExpression::name).toList(); + } + private void mandatory(SearchRequest request) { + assertEquals(3, fields(request).size()); + assertTrue(fields(request).containsAll(List.of("id", "version", "name"))); + assertFalse(fields(request).contains("active")); + } + + @Test public void listRestoresTechnicalFieldsWithoutWideningOrMutatingCaller() { + var executor = new RecordingExecutor(); var runtime = runtime(executor); var caller = request(); + runtime.executeForList(new DefaultUserContext(runtime), caller); + assertEquals(1, executor.requests.size()); mandatory(executor.requests.get(0)); + assertEquals(List.of("name"), fields(caller)); + assertEquals(caller.comment(), executor.requests.get(0).comment()); + assertEquals(caller.purpose(), executor.requests.get(0).purpose()); + assertSame(caller, executor.requests.get(0).diagnosticSource()); + } + + @Test public void restoresOnlyMissingFieldAndDoesNotDuplicateExistingProjections() { + for (String existing : List.of("id", "version")) { + var executor = new RecordingExecutor(); var runtime = runtime(executor); var caller = request(); + caller.selectProperty(existing); + runtime.executeForList(new DefaultUserContext(runtime), caller); + mandatory(executor.requests.get(0)); + assertEquals(List.of("name", existing), fields(caller)); + } + } + + @Test public void emptyProjectionRetainsProviderDefaultFullEntityLoading() { + var executor = new RecordingExecutor(); var runtime = runtime(executor); var caller = request(); + caller.getProjections().clear(); + runtime.executeForList(new DefaultUserContext(runtime), caller); + assertTrue(executor.requests.get(0).getProjections().isEmpty()); + assertTrue(caller.getProjections().isEmpty()); + } + + @Test public void policyCannotRemoveMandatoryEntityFields() { + var executor = new RecordingExecutor(); + var runtime = TeaQLRuntime.builder().metadata(new TeaQLRuntimeTest.DummyMetaFactory()) + .dataService("dummy", executor).queryPolicy(new QueryPolicy() { + @Override public void enforceSelect(UserContext context, SearchRequest query) { + ((BaseRequest) query).unselectProperty("id"); + ((BaseRequest) query).unselectProperty("version"); + } + }).build(); + var caller = request(); caller.selectProperty("id"); caller.selectProperty("version"); + runtime.executeForList(new DefaultUserContext(runtime), caller); + mandatory(executor.requests.get(0)); + } + + @Test public void internalListPreservesScopeAndCompleteProjections() { + var executor = new RecordingExecutor(); var runtime = runtime(executor); var caller = request(); + var root = QueryRequestScope.capture(caller); + var scope = root.deriveChild("children", "load selected children"); + var nested = new QueryRequestSnapshot<>(caller, scope); + runtime.internalExecuteForList(new DefaultUserContext(runtime), nested); + mandatory(executor.requests.get(0)); + assertSame(scope, executor.requests.get(0).requestScope()); + assertSame(caller, executor.requests.get(0).diagnosticSource()); + assertEquals(List.of("name"), fields(nested)); + nested.selectProperty("id"); nested.selectProperty("version"); + runtime.internalExecuteForList(new DefaultUserContext(runtime), nested); + assertEquals(fields(nested), fields(executor.requests.get(1))); + assertSame(scope, executor.requests.get(1).requestScope()); + } + + @Test public void publicAndInternalStreamsRestoreFieldsAndCloseProviderStreams() { + var executor = new RecordingExecutor(); var runtime = runtime(executor); var caller = request(); + var context = new DefaultUserContext(runtime); + try (var stream = runtime.executeForStream(context, caller)) { assertEquals(0L, stream.count()); } + var scope = QueryRequestScope.capture(caller).deriveChild("children", "load child stream"); + var nested = new QueryRequestSnapshot<>(caller, scope); + try (var stream = runtime.internalExecuteForStream(context, nested)) { assertEquals(0L, stream.count()); } + assertEquals(2, executor.closed); + executor.requests.forEach(this::mandatory); + assertSame(scope, executor.requests.get(1).requestScope()); + assertEquals(List.of("name"), fields(caller)); + assertEquals(List.of("name"), fields(nested)); + } + + @Test public void scalarProjectionStaysSparseAndGroupedEntityListsAreRejectedBeforeExecution() { + for (int shape = 0; shape < 3; shape++) { + var executor = new RecordingExecutor(); var runtime = runtime(executor); var caller = request(); + var expression = new SimpleNamedExpression("_value", new PropertyReference("name")); + var aggregations = caller.getAggregations(); + switch (shape) { + case 0 -> aggregations.getAggregates().add(expression); + case 1 -> aggregations.getSimpleDimensions().add(expression); + case 2 -> aggregations.getComplexDimensions().add(expression); + } + var context = new DefaultUserContext(runtime); + if (shape == 0) { + runtime.executeForList(context, caller); + assertEquals(List.of("name"), fields(executor.requests.get(0))); + } else { + var error = assertThrows(TeaQLRuntimeException.class, + () -> runtime.executeForList(context, caller)); + assertTrue(error.getMessage().contains("aggregation result boundary")); + assertTrue(executor.requests.isEmpty()); + } + assertEquals(List.of("name"), fields(caller)); + } + } + + @Test public void scalarAndGroupedEntityStreamsAreRejectedWithoutCallingProvider() { + for (int shape = 0; shape < 3; shape++) { + var executor = new RecordingExecutor(); var runtime = runtime(executor); var caller = request(); + var expression = new SimpleNamedExpression("_value", new PropertyReference("name")); + switch (shape) { + case 0 -> caller.getAggregations().getAggregates().add(expression); + case 1 -> caller.getAggregations().getSimpleDimensions().add(expression); + case 2 -> caller.getAggregations().getComplexDimensions().add(expression); + } + assertThrows(TeaQLRuntimeException.class, + () -> runtime.executeForStream(new DefaultUserContext(runtime), caller)); + assertTrue(executor.requests.isEmpty()); + assertEquals(0, executor.closed); + assertEquals(List.of("name"), fields(caller)); + } + } + + @Test public void providerFailureDoesNotChangeCallerProjection() { + var executor = new RecordingExecutor(); executor.fail = true; + var runtime = runtime(executor); var caller = request(); + assertThrows(IllegalStateException.class, () -> runtime.executeForList(new DefaultUserContext(runtime), caller)); + assertEquals(List.of("name"), fields(caller)); + mandatory(executor.requests.get(0)); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/FiniteScalarMutationTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/FiniteScalarMutationTest.java new file mode 100644 index 000000000..d67f40af9 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/FiniteScalarMutationTest.java @@ -0,0 +1,100 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.core.checker.*; +import io.teaql.core.meta.SimplePropertyType; +import java.util.*; +import java.util.function.Consumer; +import org.junit.Test; +import static io.teaql.runtime.CanonicalMutationFieldsTest.*; +import static org.junit.Assert.*; + +public class FiniteScalarMutationTest { + static final List FIELDS = List.of("required_float", "optional_float", "required_double", "optional_double"); + static Object number(String field, double value) { + if (field.endsWith("float")) return Float.valueOf((float) value); + return Double.valueOf(value); + } + static Fixture fixture(boolean checker, Consumer fix) { + var f = new Fixture(checker, fix); + for (String field : FIELDS) { + var p = property(field); p.setType(new SimplePropertyType(field.endsWith("float") ? Float.class : Double.class)); + f.descriptor.getProperties().add(p); + } + return f; + } + static CheckException rejected(Fixture f, Probe row, String field) { + var failure = assertThrows(CheckException.class, () -> row.auditAs("Reject non-finite mutation").save(f.context)); + assertTrue(failure.getViolates().stream().anyMatch(v -> v.getRuleId() == CheckResult.RuleId.INVALID_TYPE + && v.getLocation().modelPath().endsWith(field) && "NameProbe".equals(v.getRootType()) && v.getInputValue() == null)); + assertEquals(0, f.policyCalls); assertEquals(0, f.ids); assertEquals(0, f.provider.mutations); + assertEquals(0, f.provider.begins); assertEquals(0, f.audits); + return failure; + } + static void invalid(boolean checker) { + for (boolean update : List.of(false, true)) for (String field : FIELDS) + for (double bad : new double[]{Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY}) { + var f = fixture(checker, null); var row = f.entity(update); row.updateProperty(field, number(field, bad)); + var expected = row.getProperty(field); rejected(f, row, field); + assertEquals(expected, row.getProperty(field)); assertTrue(row.getUpdatedProperties().contains(field)); + assertEquals(checker ? 1 : 0, f.checkerCalls); + } + } + @Test public void rejectsAllNonfiniteCreateAndUpdateWithChecker() { invalid(true); } + @Test public void rejectsAllNonfiniteCreateAndUpdateWithoutChecker() { invalid(false); } + @Test public void customerFixMayRepairInvalidInputBeforeFinalAdmission() { + for (boolean update : List.of(false, true)) for (String field : FIELDS) + for (double bad : new double[]{Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY}) { + var f = fixture(true, row -> row.updateProperty(field, number(field, 7.5))); + var row = f.entity(update); row.updateProperty(field, number(field, bad)); + row.auditAs("Accept a finite final customer Fix").save(f.context); + assertEquals(1, f.checkerCalls); assertEquals(1, f.provider.mutations); assertEquals(1, f.provider.begins); + assertEquals(number(field, 7.5), row.getProperty(field)); + } + } + @Test public void customerFixCannotIntroduceNonfiniteValues() { + for (boolean update : List.of(false, true)) for (String field : FIELDS) + for (double bad : new double[]{Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY}) { + var f = fixture(true, row -> row.updateProperty(field, number(field, bad))); + var row = f.entity(update); row.updateProperty(field, number(field, 1.25)); + rejected(f, row, field); assertEquals(1, f.checkerCalls); + } + } + @Test public void secondChildRejectsTheWholeGraphBeforeAnyTransactionAndCanBeRepaired() { + var f = fixture(true, null); var parent = f.entity(false); var first = f.entity(false); var second = f.entity(false); + first.updateProperty("required_double", 7.5d); second.updateProperty("optional_float", Float.POSITIVE_INFINITY); + parent.updateProperty("children", List.of(first, second)); + var error = rejected(f, parent, "optional_float"); + assertEquals("children[1].optional_float", error.getViolates().get(0).getLocation().modelPath()); + assertEquals(7.5d, (Double)first.getProperty("required_double"), 0); + second.updateProperty("optional_float", 4.5f); + parent.auditAs("Retry the same graph after repairing one scalar").save(f.context); + assertEquals(1, f.provider.begins); assertEquals(3, f.provider.mutations); assertEquals(3, f.audits); + } + @Test public void detachedRawLedgerIntentCannotBypassFinalNumericAdmission() { + var f = fixture(true, null); var row = f.entity(true); + row.getEntityMutationLedger().setOriginalVersion(new EntityKey("NameProbe", 77L),1L); + row.getEntityMutationLedger().set(new EntityKey("NameProbe", 77L), "required_double", Double.NEGATIVE_INFINITY); + rejected(f, row, "required_double"); + assertTrue(row.getEntityMutationLedger().currentChangeSet().changes().containsKey(new EntityKey("NameProbe", 77L))); + } + @Test public void untouchedPartialRelatedObjectIsNotTreatedAsAMutation() { + var f = fixture(true, null); var row = f.entity(true); var passive = new Probe(); + passive.__internalSet("id", 2L); passive.__internalSet("version", 1L); passive.set$status(EntityStatus.PERSISTED); + passive.__internalSet("required_double", Double.POSITIVE_INFINITY); + row.updateProperty("children", List.of(passive)); + assertFalse(passive.__internalHasMutationLedger()); + assertTrue(io.teaql.core.checker.internal.FiniteScalarAdmission.collect(f.metadata,row,true).isEmpty()); + assertFalse(passive.__internalHasMutationLedger()); + row.auditAs("Save only the actually modified owner").save(f.context); + assertEquals(1, f.provider.mutations); assertEquals(1, f.audits); assertTrue(passive.getUpdatedProperties().isEmpty()); + } + @Test public void legalFiniteValuesNullAndNonnumericTextRemainUnchanged() { + for (Object value : Arrays.asList(null, -0.0d, Double.MIN_VALUE, Double.MAX_VALUE, -0.0f, Float.MIN_VALUE, Float.MAX_VALUE)) { + var f = fixture(true, null); var row = f.entity(false); + row.updateProperty("required_string", "Infinity"); row.updateProperty("required_double", value); + row.auditAs("Calibrate finite and nullable values").save(f.context); + assertEquals(value, row.getProperty("required_double")); assertEquals(1, f.provider.mutations); + } + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/GraphTraceChainTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/GraphTraceChainTest.java index 41eb3a10d..941932d0d 100644 --- a/teaql-runtime/src/test/java/io/teaql/runtime/GraphTraceChainTest.java +++ b/teaql-runtime/src/test/java/io/teaql/runtime/GraphTraceChainTest.java @@ -104,7 +104,10 @@ static SimpleEntityMetaFactory metadata() { var children = new Relation(); children.setName("children"); children.setOwner(descriptor); - descriptor.setProperties(List.of(children)); + var name = new PropertyDescriptor(); + name.setName("name"); + name.setOwner(descriptor); + descriptor.setProperties(List.of(name, children)); metadata.register(descriptor); } return metadata; diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/ReviewedMutationGraphIdentityTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/ReviewedMutationGraphIdentityTest.java new file mode 100644 index 000000000..5d37ec1c2 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/ReviewedMutationGraphIdentityTest.java @@ -0,0 +1,70 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.core.meta.*; +import java.util.*; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Provider FK readback must not replace an already materialized graph node. */ +public class ReviewedMutationGraphIdentityTest { + public static final class Node extends BaseEntity { + private final String type; + private final Map values = new HashMap<>(); + Node(String type) { this.type = type; } + @Override public String typeName() { return type; } + @Override public Object __internalGet(String name) { + return name.equals("id") || name.equals("version") ? super.__internalGet(name) : values.get(name); + } + @Override public void __internalSet(String name, Object value) { + if (name.equals("id") || name.equals("version")) super.__internalSet(name, value); + else { values.put(name, value); markPropertyLoaded(name); } + } + } + @Test public void referenceReadbackRetainsTheCompleteChildForConsecutiveMutations() { + var metadata = new SimpleEntityMetaFactory(); + for (String name : List.of("Parent", "Child")) { + var descriptor = new EntityDescriptor(); descriptor.setType(name); descriptor.setDataService("fixture"); + descriptor.setEntitySupplier(() -> new Node(name)); + var fields = new ArrayList(); + for (String field : List.of("id", "version", "name")) { + var property = new PropertyDescriptor(); property.setName(field); fields.add(property); + } + if (name.equals("Parent")) { var relation = new Relation(); relation.setName("child"); fields.add(relation); } + descriptor.setProperties(fields); metadata.register(descriptor); + } + var requests = new ArrayList(); + var executor = new MutationExecutor() { + public MutationResult mutate(UserContext caller, PersistenceMutation request) { + var mutation = (EntityPersistenceMutation) request; requests.add(mutation); + var entity = (BaseEntity) mutation.getEntity(); + entity.__internalSet("version", entity.getVersion() == null ? 1L : entity.getVersion() + 1); + entity.set$status(EntityStatus.PERSISTED); return new DefaultMutationResult(entity); + } + public String name() { return "fixture"; } + public DataServiceCapabilities capabilities() { return new DataServiceCapabilities(); } + }; + var runtime = TeaQLRuntime.builder().metadata(metadata).dataService("fixture", executor).build(); + var context = new DefaultUserContext(runtime); + var parent = new Node("Parent"); parent.__internalSet("id", 1L); + var child = new Node("Child"); child.__internalSet("id", 1L); + // This low-level fixture explicitly performs the NEW lifecycle entry + // normally supplied by generated Q.newEntity(), not merely hydration. + parent.getEntityMutationLedger().markAsNew(new EntityKey("Parent", 1L)); + child.getEntityMutationLedger().markAsNew(new EntityKey("Child", 1L)); + child.updateProperty("name", "first"); parent.updateProperty("child", child); + parent.auditAs("Create the complete identity graph").save(context); + assertSame(child, parent.__internalGet("child")); + assertEquals(Long.valueOf(1), child.getVersion()); assertEquals(Long.valueOf(1), parent.getVersion()); + assertEquals(2, requests.size()); + for (String next : List.of("second", "third")) { + child.updateProperty("name", next); + parent.auditAs("Save the next child mutation through the unchanged parent").save(context); + assertSame(child, parent.__internalGet("child")); + assertEquals(next, requests.get(requests.size() - 1).getEntity().getProperty("name")); + assertEquals(Long.valueOf(1), parent.getVersion()); + assertTrue(parent.getEntityMutationLedger().currentChangeSet().changes().isEmpty()); + } + assertEquals(4, requests.size()); assertEquals(Long.valueOf(3), child.getVersion()); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/ReviewedMutationSnapshotTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/ReviewedMutationSnapshotTest.java new file mode 100644 index 000000000..b9bddc00b --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/ReviewedMutationSnapshotTest.java @@ -0,0 +1,90 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.data.dynamic.*; +import java.util.*; +import org.junit.Test; +import static org.junit.Assert.*; + +public class ReviewedMutationSnapshotTest { + private final EntityKey key = new EntityKey("Probe",1L); + private final EntityMutationLedger ledger = new EntityMutationLedger(); + private MutationPlan plan(Object value) { + return new MutationPlan("execution","Probe.saveGraph","Probe","review mutation", + List.of(new MutationOperation(MutationOperationKind.UPDATE,key,1L,Collections.singletonMap("value",value)))); + } + @Test public void immutableAndNullScalarsStayEqual() { + for (Object value : Arrays.asList(null,true,4L,3.5,new java.math.BigDecimal("123456789012.3456789"),java.time.Instant.EPOCH)) { + var p = plan(value); ReviewedMutationSnapshot.capture(p,ledger).requireUnchanged(p,ledger); + } + } + @Test public void nestedContainerAndArrayMutationCannotRewriteTheSnapshot() { + byte[] bytes = {1,2}; Map value = new HashMap<>(); value.put("bytes",bytes); + var p = plan(List.of(value)); var snapshot = ReviewedMutationSnapshot.capture(p,ledger); + snapshot.requireUnchanged(p,ledger); bytes[1] = 3; + assertThrows(TeaQLRuntimeException.class,() -> snapshot.requireUnchanged(p,ledger)); + } + private static final class PreciseDate extends Date { + int nanos = 123456789; + @Override public java.time.Instant toInstant() { return java.time.Instant.ofEpochSecond(0,nanos); } + } + @Test public void mutableDateInstantRetainsNanosecondPrecision() { + var time = new PreciseDate(); var p = plan(time); + var snapshot = ReviewedMutationSnapshot.capture(p,ledger); snapshot.requireUnchanged(p,ledger); + time.nanos = 123456780; assertThrows(TeaQLRuntimeException.class,() -> snapshot.requireUnchanged(p,ledger)); + } + @Test public void equalPrimitiveAndNestedArraysAreStable() { + var p = plan(new Object[]{new int[]{1,2},new byte[]{3},Collections.singletonMap("nullable",null)}); + ReviewedMutationSnapshot.capture(p,ledger).requireUnchanged(p,ledger); + } + @Test public void dynamicFieldTimeCannotMutateBehindTheReview() { + var time = new Date(123); var p = plan(DynamicFieldMutation.set("observed_at",DynamicDataType.DATE_TIME,time)); + var snapshot = ReviewedMutationSnapshot.capture(p,ledger); time.setTime(124); + assertThrows(TeaQLRuntimeException.class,() -> snapshot.requireUnchanged(p,ledger)); + } + @Test public void changedReferenceIdentityIsDetected() { + var entity = new BaseEntity(); entity.__internalSet("id",1L); var p = plan(entity); + var snapshot = ReviewedMutationSnapshot.capture(p,ledger); entity.__internalSet("id",2L); + assertThrows(TeaQLRuntimeException.class,() -> snapshot.requireUnchanged(p,ledger)); + } + @Test public void changedOperationIdentityKindAndVersionAreDetected() { + var p = plan("value"); var snapshot = ReviewedMutationSnapshot.capture(p,ledger); + for (var operation : List.of(new MutationOperation(MutationOperationKind.DELETE,key,1L,Map.of()), + new MutationOperation(MutationOperationKind.UPDATE,new EntityKey("Other",1L),1L,Map.of("value","value")), + new MutationOperation(MutationOperationKind.UPDATE,key,2L,Map.of("value","value")))) { + var changed = new MutationPlan("execution","Probe.saveGraph","Probe","review mutation",List.of(operation)); + assertThrows(TeaQLRuntimeException.class,() -> snapshot.requireUnchanged(changed,ledger)); + } + } + @Test public void traceChangeIsRejectedButLaterCommentCannotReplaceTheCapturedReason() { + var p = plan("PRIVATE_VALUE"); var snapshot = ReviewedMutationSnapshot.capture(p,ledger); + ledger.setTraceChain(key,List.of(new TraceNode("PRIVATE_TRACE"))); + var error = assertThrows(TeaQLRuntimeException.class,() -> snapshot.requireUnchanged(p,ledger)); + assertFalse(error.getMessage().contains("PRIVATE")); + var after = ReviewedMutationSnapshot.capture(p,ledger); ledger.setComment("PRIVATE_COMMENT"); + after.requireUnchanged(p,ledger); + assertEquals("review mutation",after.preparedPlan().auditReason()); + } + @Test public void providerVersionProgressDoesNotChangeThePreparedWriteVersion() { + var p = plan("value"); var snapshot = ReviewedMutationSnapshot.capture(p,ledger); + var next = new MutationPlan("execution","Probe.saveGraph","Probe","review mutation", + List.of(new MutationOperation(MutationOperationKind.UPDATE,key,2L,Map.of("value","value")))); + assertThrows(TeaQLRuntimeException.class,() -> snapshot.requireUnchanged(next,ledger)); + snapshot.requireUnchanged(next,ledger,true); + assertEquals(Long.valueOf(1),snapshot.preparedPlan().operations().get(0).originalVersion()); + } + @Test public void preparedProviderOperandsAreDetachedFromCustomerPolicyOperands() { + var metadata = new io.teaql.core.meta.SimpleEntityMetaFactory(); + var descriptor = new io.teaql.core.meta.EntityDescriptor();descriptor.setType("BaseEntity");descriptor.setEntitySupplier(BaseEntity::new);metadata.register(descriptor); + var reference = new BaseEntity();reference.__internalSet("id",1L); + var time = new Date(123);byte[] bytes = {1,2};var values = new HashMap();values.put("time",time);values.put("bytes",bytes);values.put("reference",reference); + var p = plan(values);var snapshot = ReviewedMutationSnapshot.capture(p,ledger,metadata); + time.setTime(456);bytes[0]=3;reference.__internalSet("id",2L); + var detached = (Map)snapshot.preparedPlan().operations().get(0).changedValues().get("value"); + assertEquals(123L,((Date)detached.get("time")).getTime());assertArrayEquals(new byte[]{1,2},(byte[])detached.get("bytes"));assertEquals(Long.valueOf(1),((Entity)detached.get("reference")).getId()); + } + @Test public void cyclicContainersFailWithoutRecursingUntilStackOverflow() { + List cycle = new ArrayList<>(); cycle.add(cycle); + assertThrows(TeaQLRuntimeException.class,() -> ReviewedMutationSnapshot.capture(plan(cycle),ledger)); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/TeaQLRuntimeTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/TeaQLRuntimeTest.java index ba44096a6..3b2d3a5e0 100644 --- a/teaql-runtime/src/test/java/io/teaql/runtime/TeaQLRuntimeTest.java +++ b/teaql-runtime/src/test/java/io/teaql/runtime/TeaQLRuntimeTest.java @@ -355,6 +355,7 @@ public void graphPolicyReviewsAllOperationsExactlyOnce() { .build(); ContainerEntity root = new ContainerEntity(); root.updateId(910L); + root.__internalSet("version", 1L); root.set$status(EntityStatus.PERSISTED); DummyEntity child = changedEntity(911L, "child change"); root.updateProperty("rel1", child); @@ -477,9 +478,12 @@ public void modifiedDescendantIsCheckedThroughUntouchedPartialParent() { .install(RuntimeModule.of().withCheckers(checker)); var context = new DefaultUserContext(runtime); var root = new DummyEntity(); root.name = "complete parent"; + root.__internalSet("id", 1L); root.__internalSet("version", 1L); root.set$status(EntityStatus.UPDATED); root.setComment("check modified descendants"); root.child = new DummyEntity(); root.child.set$status(EntityStatus.PERSISTED); + root.child.__internalSet("id", 2L); root.child.__internalSet("version", 1L); root.child.child = new DummyEntity(); root.child.child.set$status(EntityStatus.UPDATED); + root.child.child.__internalSet("id", 3L); root.child.child.__internalSet("version", 1L); // Cycle exercises the independent persistence walk's identity boundary. root.child.child.child = root; var error = Assert.assertThrows(CheckException.class, () -> runtime.saveGraph(context, root)); @@ -904,12 +908,14 @@ public void testSaveGraphLedgerClassificationAndExecutionOrder() throws Exceptio DummyEntity e1 = new DummyEntity(); // to delete e1.updateId(101L); + e1.__internalSet("version", 1L); e1.set$status(EntityStatus.PERSISTED); e1.setEntityMutationLedger(root); e1.markForDeletion(); DummyEntity e2 = new DummyEntity(); // to update e2.updateId(102L); + e2.__internalSet("version", 1L); e2.set$status(EntityStatus.PERSISTED); e2.setEntityMutationLedger(root); e2.updateProperty("name", "updated"); @@ -923,24 +929,25 @@ public void testSaveGraphLedgerClassificationAndExecutionOrder() throws Exceptio DummyEntity e4 = new DummyEntity(); // to delete only e4.updateId(104L); + e4.__internalSet("version", 1L); e4.set$status(EntityStatus.PERSISTED); e4.setEntityMutationLedger(root); e4.markForDeletion(); - java.util.Map realEntities = new java.util.HashMap<>(); - realEntities.put(new EntityKey("Dummy", 101L), e1); - realEntities.put(new EntityKey("Dummy", 102L), e2); - realEntities.put(new EntityKey("Dummy", 103L), e3); - realEntities.put(new EntityKey("Dummy", 104L), e4); - - java.lang.reflect.Method method = TeaQLRuntime.class.getDeclaredMethod( - "executeLedgerPlan", UserContext.class, EntityMutationLedger.class, - MutationExecutor.class, java.util.Map.class, MutationGovernanceSnapshot.class, MutationIntent.class, - java.util.Map.class, MutationTraceScope.class); - method.setAccessible(true); - method.invoke(runtime, new DefaultUserContext(runtime), root, executor, realEntities, null, - MutationIntent.of("root comment"), java.util.Map.of(), - MutationTraceScope.append(null, "Dummy", null, "root comment")); + // Exercise public graph admission, review and execution rather than a + // private helper signature. Hydration attaches the already-owned graph + // without turning the unchanged container into another write. + ContainerEntity graph = new ContainerEntity(); + graph.__internalSet("id", 200L); + graph.__internalSet("version", 1L); + graph.set$status(EntityStatus.PERSISTED); + graph.setEntityMutationLedger(root); + graph.__internalSet("rel1", e1); + graph.__internalSet("rel2", e2); + graph.__internalSet("rel3", e3); + graph.__internalSet("rel4", e4); + graph.setComment("root comment"); + runtime.saveGraph(new DefaultUserContext(runtime), graph); List requests = executor.requests; @@ -971,8 +978,10 @@ public void testSaveGraphLedgerClassificationAndExecutionOrder() throws Exceptio Assert.assertFalse(saves.stream().anyMatch(r -> r.getEntity().getId().equals(104L))); // 104 shouldn't be saved Assert.assertTrue(requests.stream().allMatch(r -> "root comment".equals(r.getEntity().getComment()))); - // The current change set is not cleared by executeLedgerPlan, it's cleared by saveGraph, so we can't test that here unless we do it. - // I will omit that check or just check saveGraph does it. + Assert.assertEquals("Only the four changed children are written", 4, requests.size()); + Assert.assertTrue(root.currentChangeSet().changes().isEmpty()); + Assert.assertTrue(root.newKeys().isEmpty()); + Assert.assertTrue(root.deletedKeys().isEmpty()); } @Test @@ -985,18 +994,22 @@ public void testSaveGraphMergesRelatedEntityMutationLedgers() { ContainerEntity rootEntity = new ContainerEntity(); rootEntity.updateId(1L); + rootEntity.__internalSet("version", 1L); rootEntity.set$status(EntityStatus.PERSISTED); DummyEntity toOneChild = new DummyEntity(); toOneChild.updateId(2L); + toOneChild.__internalSet("version", 1L); toOneChild.set$status(EntityStatus.PERSISTED); DummyEntity listChild1 = new DummyEntity(); listChild1.updateId(3L); + listChild1.__internalSet("version", 1L); listChild1.set$status(EntityStatus.PERSISTED); DummyEntity listChild2 = new DummyEntity(); listChild2.updateId(4L); + listChild2.__internalSet("version", 1L); listChild2.set$status(EntityStatus.PERSISTED); rootEntity.updateProperty("rel1", toOneChild); @@ -1031,12 +1044,14 @@ public void testSaveGraphDoesNotConsumeIndependentLedgerFromSameContext() { DummyEntity first = new DummyEntity(); first.updateId(11L); + first.__internalSet("version", 1L); first.set$status(EntityStatus.PERSISTED); first.updateProperty("name", "save me"); first.setComment("save first graph only"); DummyEntity independent = new DummyEntity(); independent.updateId(22L); + independent.__internalSet("version", 1L); independent.set$status(EntityStatus.PERSISTED); independent.updateProperty("name", "keep pending"); @@ -1070,12 +1085,14 @@ public MutationResult mutate(UserContext context, PersistenceMutation request) { DummyEntity failing = new DummyEntity(); failing.updateId(31L); + failing.__internalSet("version", 1L); failing.set$status(EntityStatus.PERSISTED); failing.updateProperty("name", "must remain pending"); failing.setComment("fail this graph"); DummyEntity independent = new DummyEntity(); independent.updateId(32L); + independent.__internalSet("version", 1L); independent.set$status(EntityStatus.PERSISTED); independent.updateProperty("name", "independent pending"); diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/VersionLifecycleMemoryTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/VersionLifecycleMemoryTest.java new file mode 100644 index 000000000..9e442ccca --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/VersionLifecycleMemoryTest.java @@ -0,0 +1,54 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.runtime.memory.MemoryDataService; +import org.junit.Test; +import static io.teaql.runtime.CanonicalMutationFieldsTest.*; +import static org.junit.Assert.*; + +/** Production memory provider arithmetic; SQL tombstone retention is a separate gate. */ +public class VersionLifecycleMemoryTest { + static EntityPersistenceMutation request(Probe entity, EntityPersistenceMutation.Action action) { + return new EntityPersistenceMutation(entity, action, MutationIntent.of("verify production memory versions")); + } + @Test public void invalidUpdatesDoNotPublishRowsOrChangePendingState() { + for (Long version : new Long[]{null, 0L, -1L, Long.MAX_VALUE}) { + var context = new Fixture(false, null).context; var memory = new MemoryDataService("fixture"); + var row = VersionLifecycleRuntimeTest.persisted(version); row.set$status(EntityStatus.PERSISTED); + row.updateProperty("required_string", "pending"); + assertThrows(MutationVersionException.class, () -> memory.mutate(context, request(row, EntityPersistenceMutation.Action.SAVE))); + assertEquals(version, row.getVersion()); assertEquals(EntityStatus.UPDATED, row.get$status()); + var query = new BaseRequest(Probe.class, Probe::new) { + @Override public String getTypeName() { return "NameProbe"; } + }; + var result = (DefaultQueryResult) memory.query(context, + new DefaultQueryRequest(query, QueryIntent.of("inspect rejected memory write", "prove zero published rows"))); + assertTrue(result.getResult().isEmpty()); + } + } + @Test public void createDoesNotIncrementAPreassignedNonPersistedVersion() { + var context = new Fixture(false, null).context; var memory = new MemoryDataService("fixture"); var row = new Probe(); + row.__internalInitializeNewEntityId(1L); row.__internalSet("version", Long.MAX_VALUE); + row.updateProperty("required_string", "new"); + memory.mutate(context, request(row, EntityPersistenceMutation.Action.SAVE)); + assertEquals(Long.valueOf(1), row.getVersion()); assertEquals(EntityStatus.PERSISTED, row.get$status()); + } + @Test public void lastUpdateAndRecoveryHaveExactEndpoints() { + var context = new Fixture(false, null).context; var memory = new MemoryDataService("fixture"); + var live = VersionLifecycleRuntimeTest.persisted(Long.MAX_VALUE - 1); live.updateProperty("required_string", "pending"); + memory.mutate(context, request(live, EntityPersistenceMutation.Action.SAVE)); assertEquals(Long.valueOf(Long.MAX_VALUE), live.getVersion()); + var recover = VersionLifecycleRuntimeTest.persisted(Long.MIN_VALUE + 2); recover.markAsRecover(); + memory.mutate(context, request(recover, EntityPersistenceMutation.Action.SAVE)); assertEquals(Long.valueOf(Long.MAX_VALUE), recover.getVersion()); + } + @Test public void exhaustedRecoveryAndWrongSignDeleteCannotChangeTheInput() { + var context = new Fixture(false, null).context; var memory = new MemoryDataService("fixture"); + for (long version : new long[]{Long.MIN_VALUE, Long.MIN_VALUE + 1}) { + var row = VersionLifecycleRuntimeTest.persisted(version); row.markAsRecover(); + assertThrows(MutationVersionException.class, () -> memory.mutate(context, request(row, EntityPersistenceMutation.Action.SAVE))); + assertEquals(Long.valueOf(version), row.getVersion()); assertEquals(EntityStatus.UPDATED_RECOVER, row.get$status()); + } + var row = VersionLifecycleRuntimeTest.persisted(-2L); row.set$status(EntityStatus.PERSISTED); row.markForDeletion(); + assertThrows(MutationVersionException.class, () -> memory.mutate(context, request(row, EntityPersistenceMutation.Action.DELETE))); + assertEquals(Long.valueOf(-2), row.getVersion()); assertEquals(EntityStatus.UPDATED_DELETED, row.get$status()); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/VersionLifecycleRuntimeTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/VersionLifecycleRuntimeTest.java new file mode 100644 index 000000000..0b715fdf4 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/VersionLifecycleRuntimeTest.java @@ -0,0 +1,136 @@ +package io.teaql.runtime; + +import io.teaql.core.*; +import io.teaql.core.checker.CheckException; +import java.util.List; +import org.junit.Test; +import static io.teaql.runtime.CanonicalMutationFieldsTest.*; +import static org.junit.Assert.*; + +/** #236: version admission is graph-wide and precedes customer code and I/O. */ +public class VersionLifecycleRuntimeTest { + static Probe persisted(Long version) { + var entity = new Probe(); + entity.__internalSet("id", 1L); + entity.__internalSet("version", version); + entity.set$status(version != null && version < 0 ? EntityStatus.PERSISTED_DELETED : EntityStatus.PERSISTED); + entity.setEntityMutationLedger(new EntityMutationLedger()); + return entity; + } + static void rejected(Fixture fixture, Probe root, Probe invalid, String path, int expectedCheckers) { + Long before = invalid.getVersion(); + EntityStatus status = invalid.get$status(); + Throwable failure = null; + try { root.auditAs("validate version lifecycle before side effects").save(fixture.context); } + catch (RuntimeException error) { failure = error; } + int[] observed = {fixture.checkerCalls, fixture.policyCalls, fixture.ids, + fixture.provider.begins, fixture.provider.mutations, fixture.audits}; + System.out.println("VERSION_ADMISSION path=" + path + " version=" + before + + " hooks=" + java.util.Arrays.toString(observed) + + " failure=" + (failure == null ? "none" : failure.getClass().getSimpleName())); + assertArrayEquals("checker, policy, IDs, transaction, provider, committed audit", + new int[]{expectedCheckers, 0, 0, 0, 0, 0}, observed); + assertTrue("typed checker rejection required", failure instanceof CheckException); + var error = (CheckException) failure; + assertEquals(path, error.getViolates().get(0).getLocation().instancePath()); + assertEquals(before, invalid.getVersion()); + assertEquals(status, invalid.get$status()); + } + static void rejectUpdate(Long version) { + var fixture = new Fixture(true, null); + var entity = persisted(version); + entity.updateProperty("required_string", "pending value"); + rejected(fixture, entity, entity, "/version", 0); + } + static void rejectRecover(long version) { + var fixture = new Fixture(true, null); + var entity = persisted(version); + // The provider must validate the version, not trust a forged lifecycle label. + entity.set$status(EntityStatus.PERSISTED_DELETED); + entity.markAsRecover(); + rejected(fixture, entity, entity, "/version", 0); + } + @Test public void exhaustedUpdateRejectedBeforeAnyHook() { rejectUpdate(Long.MAX_VALUE); } + @Test public void zeroUpdateRejectedBeforeAnyHook() { rejectUpdate(0L); } + @Test public void negativeUpdateRejectedBeforeAnyHook() { + var fixture = new Fixture(true, null); var entity = persisted(-1L); + entity.set$status(EntityStatus.PERSISTED); entity.updateProperty("required_string", "pending value"); + rejected(fixture, entity, entity, "/version", 0); + } + @Test public void missingUpdateVersionRejectedBeforeAnyHook() { rejectUpdate(null); } + @Test public void minimumRecoveryRejectedBeforeAnyHook() { rejectRecover(Long.MIN_VALUE); } + @Test public void minimumPlusOneRecoveryRejectedBeforeAnyHook() { rejectRecover(Long.MIN_VALUE + 1); } + @Test public void positiveRecoveryRejectedBeforeAnyHook() { rejectRecover(1L); } + @Test public void zeroRecoveryRejectedBeforeAnyHook() { rejectRecover(0L); } + @Test public void invalidChildRejectsWholeGraphBeforeFirstChecker() { + var fixture = new Fixture(true, null); var root = fixture.entity(false); + var child = persisted(Long.MAX_VALUE); child.updateProperty("required_string", "pending child"); + root.updateProperty("children", List.of(child)); + rejected(fixture, root, child, "/children/0/version", 0); + } + @Test public void postFixVersionRejectedBeforePolicyAllocationOrStorage() { + var fixture = new Fixture(true, entity -> { + entity.__internalSet("version", Long.MAX_VALUE); + entity.getEntityMutationLedger().setOriginalVersion(new EntityKey("NameProbe", 1L), Long.MAX_VALUE); + }); + var entity = persisted(1L); entity.updateProperty("required_string", "pending value"); + // Rejection preserves the Checker-produced pending state, not a fake successful readback. + Throwable failure = null; + try { entity.auditAs("reject invalid post-fix version").save(fixture.context); } + catch (RuntimeException error) { failure = error; } + assertEquals(1, fixture.checkerCalls); assertEquals(0, fixture.policyCalls); + assertEquals(0, fixture.ids); assertEquals(0, fixture.provider.begins); + assertEquals(0, fixture.provider.mutations); assertEquals(0, fixture.audits); + assertTrue(failure instanceof CheckException); + assertEquals(Long.valueOf(Long.MAX_VALUE), entity.getVersion()); + assertEquals("/version", ((CheckException) failure).getViolates().get(0).getLocation().instancePath()); + } + @Test public void unchangedExhaustedObjectNeedsNoCheckerPolicyOrTransaction() { + var fixture = new Fixture(true, null); var entity = persisted(Long.MAX_VALUE); + entity.auditAs("inspect unchanged exhausted object").save(fixture.context); + assertEquals(0, fixture.checkerCalls); assertEquals(0, fixture.policyCalls); + assertEquals(0, fixture.provider.begins); assertEquals(0, fixture.provider.mutations); assertEquals(0, fixture.audits); + } + @Test public void restoredKnownNullAtMaxIsARealNoOp() { + var fixture = new Fixture(true, null); var entity = persisted(Long.MAX_VALUE); + entity.markPropertyLoaded("required_string"); + entity.updateProperty("required_string", "temporary"); entity.updateProperty("required_string", null); + assertEquals(EntityStatus.PERSISTED, entity.get$status()); + entity.auditAs("retain restored exhausted object").save(fixture.context); + assertEquals(0, fixture.checkerCalls); assertEquals(0, fixture.policyCalls); assertEquals(0, fixture.provider.mutations); + assertEquals(Long.valueOf(Long.MAX_VALUE), entity.getVersion()); + } + @Test public void untouchedExhaustedAssociationDoesNotBlockNewParent() { + var fixture = new Fixture(true, null); var root = fixture.entity(false); var child = persisted(Long.MAX_VALUE); + root.updateProperty("children", List.of(child)); root.auditAs("create parent around unchanged reference").save(fixture.context); + assertEquals(1, fixture.ids); assertEquals(1, fixture.checkerCalls); assertEquals(1, fixture.policyCalls); + assertEquals(1, fixture.provider.mutations); assertEquals(Long.valueOf(Long.MAX_VALUE), child.getVersion()); + } + @Test public void exhaustedRawOwnLedgerRejectsEvenWithCleanEntityStatus() { + var fixture = new Fixture(true, null); var entity = persisted(Long.MAX_VALUE); + entity.getEntityMutationLedger().set(new EntityKey("NameProbe", 1L), "required_string", "raw pending"); + rejected(fixture, entity, entity, "/version", 0); + } + @Test public void exhaustedDetachedKeyRejectsBeforeNewRootIdAllocation() { + var fixture = new Fixture(true, null); var root = fixture.entity(false); var key = new EntityKey("NameProbe", 23L); + root.getEntityMutationLedger().set(key, "required_string", "detached pending"); + root.getEntityMutationLedger().setOriginalVersion(key, Long.MAX_VALUE); + rejected(fixture, root, root, "/version", 0); + } + @Test public void legalDeleteAtMaxStillEntersReviewedExecution() { + var fixture = new Fixture(true, null); var entity = persisted(Long.MAX_VALUE); entity.markForDeletion(); + entity.auditAs("delete last representable live version").save(fixture.context); + assertEquals(1, fixture.policyCalls); assertEquals(1, fixture.provider.mutations); assertEquals(1, fixture.audits); + } + @Test public void legalRecoveryToMaxStillEntersReviewedExecution() { + var fixture = new Fixture(true, null); var entity = persisted(Long.MIN_VALUE + 2); entity.markAsRecover(); + entity.auditAs("recover last representable tombstone").save(fixture.context); + assertEquals(1, fixture.policyCalls); assertEquals(1, fixture.provider.mutations); assertEquals(1, fixture.audits); + } + @Test public void oneRejectedGraphDoesNotPoisonLaterSaveOnSameContext() { + var fixture = new Fixture(true, null); var bad = persisted(Long.MAX_VALUE); bad.updateProperty("required_string", "bad"); + rejected(fixture, bad, bad, "/version", 0); + fixture.entity(false).auditAs("save independent valid graph").save(fixture.context); + assertEquals(1, fixture.checkerCalls); assertEquals(1, fixture.policyCalls); assertEquals(1, fixture.provider.mutations); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryAggregationTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryAggregationTest.java new file mode 100644 index 000000000..cfc700daf --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryAggregationTest.java @@ -0,0 +1,242 @@ +package io.teaql.runtime.memory; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.*; +import io.teaql.core.criteria.Operator; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.PropertyDescriptor; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Public runtime aggregation boundary; no SQL, provider result stub or generated-code edits. */ +public class MemoryAggregationTest { + public static final class Sample extends BaseEntity { + private Number amount; + private String bucket; + private Sample parent; + + Sample amount(Number value) { handleUpdate("amount", amount, value); amount = value; return this; } + Sample bucket(String value) { handleUpdate("bucket", bucket, value); bucket = value; return this; } + Sample parent(Sample value) { handleUpdate("parent", parent, value); parent = value; return this; } + @Override public String typeName() { return "MemoryAmount"; } + @Override public Object __internalGet(String property) { + return switch (property) { + case "amount" -> amount; + case "bucket" -> bucket; + case "parent" -> parent; + default -> super.__internalGet(property); + }; + } + @Override public void __internalSet(String property, Object value) { + switch (property) { + case "amount" -> amount = (Number) value; + case "bucket" -> bucket = (String) value; + case "parent" -> parent = (Sample) value; + default -> super.__internalSet(property, value); + } + } + } + + private static final class Request extends BaseRequest { + Request() { super(Sample.class, Sample::new); internalComment("inspect memory aggregates"); purpose("verify empty aggregate semantics"); } + @Override public String getTypeName() { return "MemoryAmount"; } + Request only(String bucket) { appendSearchCriteria(createBasicSearchCriteria("bucket", Operator.EQUAL, bucket)); return this; } + Request comment(String comment) { internalComment(comment); return this; } + AggregationResult run(UserContext context) { return purpose("verify empty aggregate semantics").aggregation(context); } + } + + private DefaultUserContext context; + private MemoryDataService service; + private boolean denyNestedQuery; + + @Before public void setup() { + var metadata = new SimpleEntityMetaFactory(); + var descriptor = new EntityDescriptor(); + descriptor.setType("MemoryAmount"); descriptor.setTargetType(Sample.class); descriptor.setDataService("memory"); + descriptor.setEntitySupplier(Sample::new); + var properties = new ArrayList(); + for (String name : List.of("id", "version", "amount", "bucket", "parent")) { + var property = new PropertyDescriptor(); property.setName(name); property.setOwner(descriptor); properties.add(property); + } + descriptor.setProperties(properties); metadata.register(descriptor); + service = new MemoryDataService("memory"); + var ids = new AtomicLong(100); + context = new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata).dataService("memory", service) + .queryPolicy(new QueryPolicy() { + @Override public void enforceSelect(UserContext caller, SearchRequest request) { + if (denyNestedQuery && QueryRequestScope.capture(request).parentRequest() != null) + throw new TeaQLRuntimeException("memory nested query denied by policy"); + } + }) + .idGenerationService((c, e) -> ids.getAndIncrement()).build()); + } + + private void seed(String bucket, Number... values) { + for (Number value : values) new Sample().bucket(bucket).amount(value).auditAs("seed memory aggregate probe").save(context); + } + private Request aggregate() { + var request = new Request(); + request.addAggregate("rows", "id", AggrFunction.COUNT); + request.addAggregate("values", "amount", AggrFunction.COUNT); + request.addAggregate("total", "amount", AggrFunction.SUM); + return request; + } + private Map scalar(Request request) { + var result = request.run(context); + assertNotNull("memory aggregation must produce an AggregationResult", result); + assertEquals(1, result.toList().size()); return result.toList().get(0); + } + private static void number(String expected, Object actual) { + assertTrue("aggregate remains numeric: " + actual, actual instanceof Number); + assertEquals(0, new BigDecimal(expected).compareTo(new BigDecimal(actual.toString()))); + } + + @Test public void noRowsProducePresentNullSumAndZeroCounts() throws Exception { + var values = scalar(aggregate()); number("0", values.get("rows")); number("0", values.get("values")); + assertTrue(values.containsKey("total")); assertNull(values.get("total")); + var json = new ObjectMapper().valueToTree(values); assertTrue(json.has("total")); assertTrue(json.get("total").isNull()); + } + @Test public void allNullRowsKeepCountStarDistinctFromCountValue() { + seed("nulls", (Number) null, null); var values = scalar(aggregate()); + number("2", values.get("rows")); number("0", values.get("values")); assertNull(values.get("total")); + } + @Test public void mixedNullsDoNotContributeToSumOrValueCount() { + seed("mixed", null, 2, 3); var values = scalar(aggregate()); + number("3", values.get("rows")); number("2", values.get("values")); number("5", values.get("total")); + } + @Test public void cancellationProducesRealZeroRatherThanNull() { + seed("zero", new BigDecimal("2.50"), new BigDecimal("-2.50")); number("0", scalar(aggregate()).get("total")); + } + @Test public void groupedInputWithoutGroupsProducesNoSyntheticRow() { + var request = aggregate(); request.groupBy("bucket"); var result = request.run(context); + assertNotNull(result); assertTrue(result.toList().isEmpty()); + } + @Test public void groupedNullBucketAndIndependentTotalsAreRetained() { + seed(null, 4); seed("a", null, 2); seed("b", (Number) null); var request = aggregate(); request.groupBy("bucket"); + var rows = request.run(context).toList(); assertEquals(3, rows.size()); + for (var row : rows) { + if (row.get("bucket") == null) { number("4", row.get("total")); number("1", row.get("rows")); } + else if ("a".equals(row.get("bucket"))) { number("2", row.get("total")); number("2", row.get("rows")); } + else { assertEquals("b", row.get("bucket")); assertTrue(row.containsKey("total")); assertNull(row.get("total")); } + } + } + @Test public void filteringHappensBeforeAggregationAndDoesNotMutateRequest() { + seed("a", 2); seed("b", 100); var request = aggregate().only("a"); + var criteria = request.getSearchCriteria(); var expressions = new ArrayList<>(request.getAggregations().getAggregates()); + number("2", scalar(request).get("total")); number("2", scalar(request).get("total")); + assertSame(criteria, request.getSearchCriteria()); assertEquals(expressions, request.getAggregations().getAggregates()); + } + @Test public void explicitFallbackDoesNotChangeRawNullForAnotherConsumer() { + var request = new Request(); request.addAggregate("total", "amount", AggrFunction.SUM); + var result = request.run(context); assertNotNull(result); number("0", result.toNumber(0)); + assertNull(result.toNumber(null)); assertNull(scalar(request).get("total")); + } + @Test public void decimalAndLargeIntegerSumsDoNotPassThroughBinaryFloat() { + seed("decimal", new BigDecimal("0.1"), new BigDecimal("0.2")); + var decimal = scalar(aggregate().only("decimal")).get("total"); assertTrue(decimal instanceof BigDecimal); number("0.3", decimal); + seed("integer", 9007199254740993L, 1L); number("9007199254740994", scalar(aggregate().only("integer")).get("total")); + } + @Test public void unsupportedAggregateIsRejectedEvenOnEmptyInput() { + var request = new Request(); request.addAggregate("stddev", "amount", AggrFunction.STDDEV); + var error = assertThrows(TeaQLRuntimeException.class, () -> request.run(context)); + assertTrue(error.getMessage().contains("STDDEV")); + } + @Test public void nonFiniteSeedIsRejectedBeforeItEntersMemoryStorage() { + var error = assertThrows(io.teaql.core.checker.CheckException.class, () -> seed("invalid", Double.POSITIVE_INFINITY)); + assertTrue(error.getMessage().contains("finite")); + assertTrue(new Request().purpose("verify rejected seed was not stored").executeForList(context).isEmpty()); + } + @Test public void missingIntentStillRejectsBeforeProviderAccess() { + var request = aggregate().comment(" "); + assertThrows(RuntimeException.class, () -> request.run(context)); + } + + private Sample saved(Sample row) { + row.auditAs("seed a memory graph bucket").save(context); return row; + } + private Request related(Request targets) { + targets.addRelationCount("rows", new Request().only("child"), "parent", null); + targets.addRelationScalarAggregate("total", new Request().only("child"), "parent", "amount", AggrFunction.SUM, null); + return targets; + } + private SmartList list(Request request) { + return request.purpose("verify memory graph aggregate boundaries").executeForList(context); + } + @Test public void emptyRelatedValuesArePresentWithoutContaminatingStoredOrEarlierRows() { + var parent = saved(new Sample().bucket("parent").amount(null).parent(null)); + var request = related(new Request().only("parent")); request.selectProperty("bucket"); + var childTemplate = request.getDynamicAggregateAttributes().get(0).getAggregateRequest(); + var originalCriteria = childTemplate.getSearchCriteria(); + var first = list(request).get(0); + number("0", first.getDynamicProperty("rows")); assertTrue(first.hasDynamicProperty("total")); + assertNull(first.getDynamicProperty("total")); assertFalse(first.isPropertyLoaded("amount")); + assertNotSame(parent, first); assertFalse(parent.hasDynamicProperty("rows")); + saved(new Sample().bucket("child").amount(7).parent(parent)); + var second = list(request).get(0); + number("1", second.getDynamicProperty("rows")); number("7", second.getDynamicProperty("total")); + number("0", first.getDynamicProperty("rows")); assertNull(first.getDynamicProperty("total")); + assertSame(originalCriteria, childTemplate.getSearchCriteria()); + assertEquals(0, childTemplate.getAggregations().getDimensions().size()); + assertFalse(parent.hasDynamicProperty("total")); assertFalse(first.needPersist()); + } + @Test public void facetsUseFullFilteredMembershipEvenWhenVisiblePageIsEmpty() { + var a = saved(new Sample().bucket("parent").amount(null).parent(null)); + var b = saved(new Sample().bucket("parent").amount(null).parent(null)); + saved(new Sample().bucket("child").amount(null).parent(a)); + saved(new Sample().bucket("child").amount(2).parent(a)); + saved(new Sample().bucket("excluded").amount(100).parent(a)); + var targets = related(new Request().only("parent")); targets.selectProperty("bucket"); + var source = new Request().only("child"); source.offset(100, 1); + source.addFacet("buckets", "parent", targets, true); + var result = list(source); assertTrue(result.isEmpty()); + var facets = result.getFacet("buckets"); assertEquals(2, facets.size()); + for (Object value : facets) { + var row = (Sample) value; + number(row.getId().equals(a.getId()) ? "2" : "0", row.getDynamicProperty("count")); + number(row.getId().equals(a.getId()) ? "2" : "0", row.getDynamicProperty("rows")); + if (row.getId().equals(b.getId())) assertNull(row.getDynamicProperty("total")); + else number("2", row.getDynamicProperty("total")); + } + source.getFacetRequests().get(0).setMergeCriteria(true); + assertEquals(1, list(source).getFacet("buckets").size()); + assertFalse(a.hasDynamicProperty("count")); assertFalse(b.hasDynamicProperty("rows")); + } + @Test public void nestedMembershipRemainsRequestImmutableAndDoesNotExposeStoredDetails() { + var a = saved(new Sample().bucket("parent").amount(null).parent(null)); + saved(new Sample().bucket("child").amount(9).parent(a)); + var allowed = new Request().only("parent"); allowed.offset(100, 1); + var request = new Request().only("child"); + request.appendSearchCriteria(new SubQuerySearchCriteria("parent", allowed, "id")); + var first = list(request); assertEquals(1, first.size()); assertEquals(1, list(request).size()); + assertTrue(allowed.getAggregations().getSelectedExpressions().isEmpty()); + assertEquals(100, allowed.getSlice().getOffset()); + var reference = (Sample) first.get(0).getProperty("parent"); + assertEquals(a.getId(), reference.getId()); assertFalse(reference.isPropertyLoaded("bucket")); + assertNotSame(a, reference); + } + @Test public void relatedAggregatesCannotBypassTheNestedQueryPolicy() { + var parent = saved(new Sample().bucket("parent").amount(null).parent(null)); + var request = related(new Request().only("parent")); + denyNestedQuery = true; + var error = assertThrows(TeaQLRuntimeException.class, () -> list(request)); + assertTrue(error.getMessage().contains("denied by policy")); + assertFalse(parent.hasDynamicProperty("rows")); + denyNestedQuery = false; + number("0", list(request).get(0).getDynamicProperty("rows")); + } + @Test public void malformedRelatedAggregatesFailEvenWithoutAnyVisibleParents() { + var request = new Request().only("absent"); + request.addSingleAggregateDynamicProperty("invalid", new Request()); + assertThrows(TeaQLRuntimeException.class, () -> list(request)); + assertTrue(request.getDynamicAggregateAttributes().get(0).getAggregateRequest().getAggregations().getSelectedExpressions().isEmpty()); + } +} diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryDatabaseTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryDatabaseTest.java index 18c3574fb..fbe316969 100644 --- a/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryDatabaseTest.java +++ b/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryDatabaseTest.java @@ -70,7 +70,7 @@ public Object __internalGet(String property) { public static class TaskRequest extends BaseRequest { public TaskRequest() { - super(Task.class); + super(Task.class, Task::new); } @Override diff --git a/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryMembershipCriteriaTest.java b/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryMembershipCriteriaTest.java new file mode 100644 index 000000000..871880d47 --- /dev/null +++ b/teaql-runtime/src/test/java/io/teaql/runtime/memory/MemoryMembershipCriteriaTest.java @@ -0,0 +1,53 @@ +package io.teaql.runtime.memory; + +import io.teaql.core.Parameter; +import io.teaql.core.PropertyReference; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.List; +import org.junit.Test; +import static org.junit.Assert.*; + +public class MemoryMembershipCriteriaTest { + private boolean matches(Number amount, Operator operator, Object candidates) { + var row = new MemoryAggregationTest.Sample().amount(amount); + return new CriteriaFilter().accept(row, + new TwoOperatorCriteria(operator, new PropertyReference("amount"), new Parameter("amount", candidates, operator))); + } + @Test public void inAcceptsTheNormalizedListRatherThanComparingTheWholeList() { + assertTrue(matches(2L, Operator.IN, List.of(1L, 2L))); + assertFalse(matches(3L, Operator.IN, List.of(1L, 2L))); + } + @Test public void notInAcceptsNormalizedListAndExcludesMatches() { + assertFalse(matches(2L, Operator.NOT_IN, List.of(1L, 2L))); + assertTrue(matches(3L, Operator.NOT_IN, List.of(1L, 2L))); + } + @Test public void largeMembershipOperatorsUseTheSameValueSemantics() { + assertTrue(matches(2L, Operator.IN_LARGE, List.of(1L, 2L))); + assertFalse(matches(2L, Operator.NOT_IN_LARGE, List.of(1L, 2L))); + } + @Test public void primitiveAndObjectArraysRemainSupportedAfterParameterNormalization() { + assertTrue(matches(2L, Operator.IN, new long[]{1L, 2L})); + assertTrue(matches(2L, Operator.IN, new Long[]{1L, 2L})); + } + @Test public void emptyMembershipHasExplicitTruthValues() { + assertFalse(matches(2L, Operator.IN, List.of())); + assertTrue(matches(2L, Operator.NOT_IN, List.of())); + assertFalse(matches(null, Operator.IN, List.of())); + assertTrue(matches(null, Operator.NOT_IN, List.of())); + } + @Test public void nullOperandDoesNotMatchNonemptyInOrNotIn() { + assertFalse(matches(null, Operator.IN, List.of(1L, 2L))); + assertFalse(matches(null, Operator.NOT_IN, List.of(1L, 2L))); + } + @Test public void decimalMembershipDoesNotCollapseNearbyExactValues() { + var value = new BigDecimal("9007199254740993.1"); + assertFalse(matches(value, Operator.IN, List.of(new BigDecimal("9007199254740993.2")))); + assertTrue(matches(value, Operator.IN, List.of(new BigDecimal("9007199254740993.100")))); + } + @Test public void ordinaryOrderedComparisonsStillUseScalarOperands() { + assertTrue(matches(2L, Operator.GREATER_THAN, 1L)); + assertFalse(matches(2L, Operator.LESS_THAN, 1L)); + } +} diff --git a/teaql-snowflake/pom.xml b/teaql-snowflake/pom.xml index 3f37a9394..400e7555e 100644 --- a/teaql-snowflake/pom.xml +++ b/teaql-snowflake/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-snowflake teaql-snowflake diff --git a/teaql-sql-portable/pom.xml b/teaql-sql-portable/pom.xml index 41eff8c75..e04c73df8 100644 --- a/teaql-sql-portable/pom.xml +++ b/teaql-sql-portable/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-sql-portable diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/SQLColumnResolver.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/SQLColumnResolver.java index 86bba5500..7d9534c56 100644 --- a/teaql-sql-portable/src/main/java/io/teaql/core/sql/SQLColumnResolver.java +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/SQLColumnResolver.java @@ -4,12 +4,20 @@ import java.util.Map; import io.teaql.core.SearchRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.Expression; import io.teaql.core.UserContext; import io.teaql.core.utils.CollUtil; import io.teaql.core.sql.expression.SQLExpressionParser; public interface SQLColumnResolver { + /** Optional provider override for typed aggregation; null uses portable SQL. */ + default String aggregateSql(UserContext context, AggrFunction function, + Expression operand, String columnSql) { + return null; + } + default io.teaql.core.SqlParameterLogPolicy parameterLogPolicy(String property) { return io.teaql.core.SqlParameterLogPolicy.UNKNOWN; } diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/dialect/SqlDialect.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/dialect/SqlDialect.java index cb47ba32a..c2afe6dda 100644 --- a/teaql-sql-portable/src/main/java/io/teaql/core/sql/dialect/SqlDialect.java +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/dialect/SqlDialect.java @@ -1,6 +1,8 @@ package io.teaql.core.sql.dialect; import io.teaql.core.SearchRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.sql.SQLColumn; import java.util.List; import java.util.Locale; import java.util.Map; @@ -54,6 +56,21 @@ default String mapColumnType(String type) { return type; } + /** Physical type plus column-local constraints needed by a provider. */ + default String columnTypeAndConstraintsSql(SQLColumn column) { + return mapColumnType(column.getType()); + } + + /** Override only when a provider needs an exact Decimal aggregate. */ + default String decimalAggregateSql(AggrFunction function, String columnSql, boolean directColumn) { + return null; + } + + /** Decode an exact modeled Decimal aggregate without binary-float fallback. */ + default Object decodeDecimalAggregate(Object value) { + return value; + } + /** * Compare the storage families reported by the provider with the type selected for the model. * Providers may override this when their storage type system has wider compatibility rules. diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/AggrExpressionParser.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/AggrExpressionParser.java index 54f3f9892..fc305f9b0 100644 --- a/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/AggrExpressionParser.java +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/AggrExpressionParser.java @@ -39,7 +39,9 @@ public String toSql( String sqlColumn = ExpressionHelper.toSql( userContext, expressions.get(0), idTable, parameters, sqlColumnResolver); - return genAggrSQL((AggrFunction) operator, sqlColumn); + String specialized = sqlColumnResolver.aggregateSql( + userContext, (AggrFunction) operator, expressions.get(0), sqlColumn); + return specialized == null ? genAggrSQL((AggrFunction) operator, sqlColumn) : specialized; } public String genAggrSQL(AggrFunction operator, String sqlColumn) { diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/SubQueryParser.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/SubQueryParser.java index a52ca922f..22a95cad6 100644 --- a/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/SubQueryParser.java +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/expression/SubQueryParser.java @@ -101,6 +101,13 @@ public String toSql( dependsOnValues.add(propertyValue); } } + // This is a completed relation subquery, not a caller-supplied empty + // IN argument. Its empty set is FALSE; the normal NOT parser must be + // able to invert it to TRUE. Binding an empty collection would expand + // to IN (NULL), whose negation is UNKNOWN and incorrectly drops rows. + if (dependsOnValues.isEmpty()) { + return SearchCriteria.FALSE; + } // The fallback has already materialized the nested result. Bind those // identifiers as an ordinary parameterized IN list. IN_LARGE compiles // to PostgreSQL's scalar-array syntax and requires one JDBC array; the diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLDataService.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLDataService.java index 88712dd94..37321aa84 100644 --- a/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLDataService.java +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLDataService.java @@ -194,12 +194,9 @@ private void attachDynamicAggregations( AggregationResult aggregation = aggregateRepository.doAggregateInternal(userContext, request, intent == null ? null : intent.copy()); if (attribute.isSingleNumber()) { - var expressions = aggregateRequest.getAggregations().getAggregates(); - boolean count = expressions.isEmpty() || expressions.size() == 1 - && expressions.get(0).getExpression() instanceof AggrExpression expression - && expression.getOperator() == AggrFunction.COUNT; + Number emptyValue = emptySingleAggregateValue(aggregateRequest); for (Entity parent : parentsById.values()) { - parent.addDynamicProperty(attribute.getName(), count ? 0 : null); + parent.addDynamicProperty(attribute.getName(), emptyValue); } aggregation .toSimpleMap() @@ -223,6 +220,16 @@ private void attachDynamicAggregations( } } + private static Number emptySingleAggregateValue(SearchRequest request) { + var expressions = request.getAggregations().getAggregates(); + // Keep the main-branch empty-bucket policy for all scalar aggregates: + // implicit/explicit COUNT is zero; value aggregates have no value. + boolean count = expressions.isEmpty() || expressions.size() == 1 + && expressions.get(0).getExpression() instanceof AggrExpression aggregate + && aggregate.getOperator() == AggrFunction.COUNT; + return count ? 0 : null; + } + private SqlDiagnosticRequest dynamicAggregateRequest(SearchRequest aggregateRequest, String partitionProperty, SqlIntentRedactions intent, SearchRequest parentRequest, SimpleAggregation attribute) { EntityDescriptor aggregateDescriptor = metadata.resolveEntityDescriptor(aggregateRequest.getTypeName()); @@ -455,13 +462,13 @@ private void collectChildren( } } // A successful explicit selection must materialize even an empty list. - // Use the shared typed empty payload; availability stays in the parent's - // private view, and no mutation ledger is created by this hydration. + // A selected relation is an owner-local mutable collection: generated + // add-child APIs append to it. Share availability/layout, not the value + // container. The typed shared-empty singleton remains read-only. if (relation.getType() != null && SmartList.class.isAssignableFrom(relation.getType().javaType())) { - Class childType = reverseProperty.getOwner().getTargetType(); for (Entity parent : dataSet) { if (parent.getProperty(relation.getName()) == null) { - parent.setProperty(relation.getName(), SmartList.empty(childType)); + parent.setProperty(relation.getName(), new SmartList<>(0)); } } } @@ -529,6 +536,7 @@ public MutationResult mutate(UserContext context, PersistenceMutation request) { } EntityPersistenceMutation mutation = (EntityPersistenceMutation) request; Entity entity = mutation.getEntity(); + long nextVersion = MutationVersions.next(mutationKind(mutation), entity.getVersion()); String typeName = entity.typeName(); PortableSQLRepository repository = getRepository(typeName); // Local to this mutation, never stored on context or a shared repository. @@ -553,17 +561,17 @@ public MutationResult mutate(UserContext context, PersistenceMutation request) { repository.createInternal(context, Collections.singletonList(entity), readbackIntent, trace); } else if (entity.updateItem()) { repository.updateInternal(context, Collections.singletonList(entity), readbackIntent, trace); - ((BaseEntity) entity).__internalSet("version", entity.getVersion() + 1); + ((BaseEntity) entity).__internalSet("version", nextVersion); } else if (entity.recoverItem()) { repository.recoverInternal(context, Collections.singletonList(entity), readbackIntent, trace); - ((BaseEntity) entity).__internalSet("version", -entity.getVersion() + 1); + ((BaseEntity) entity).__internalSet("version", nextVersion); } if (entity instanceof BaseEntity) { ((BaseEntity) entity).gotoNextStatus(EntityAction.PERSIST); } } else if (mutation.getAction() == EntityPersistenceMutation.Action.DELETE) { repository.deleteInternal(context, Collections.singletonList(entity), readbackIntent, trace); - ((BaseEntity) entity).__internalSet("version", -(entity.getVersion() + 1)); + ((BaseEntity) entity).__internalSet("version", nextVersion); if (entity instanceof BaseEntity) { ((BaseEntity) entity).gotoNextStatus(EntityAction.PERSIST); } @@ -596,6 +604,8 @@ public List mutateBatch(UserContext context, MutationBatchReques || !batchOperation(item).equals(operation))) { throw new TeaQLRuntimeException("Portable SQL prepared batch requires one entity type and mutation operation"); } + // Admit every original before the first transaction, ID allocation or write. + var nextVersions = items.stream().map(item -> MutationVersions.next(mutationKind(item), item.getEntity().getVersion())).toList(); return executeInTransaction(context, () -> { PortableSQLRepository repository = getRepository(type); var redactions = new SqlIntentRedactions(); @@ -634,9 +644,7 @@ public List mutateBatch(UserContext context, MutationBatchReques var item = items.get(index); var entity = (BaseEntity) item.getEntity(); if (!operation.equals("insert")) { - long version = entity.getVersion(); - entity.__internalSet("version", operation.equals("delete") ? -(version + 1) - : operation.equals("recover") ? -version + 1 : version + 1); + entity.__internalSet("version", nextVersions.get(index)); } entity.gotoNextStatus(EntityAction.PERSIST); Entity persisted = repository.loadPersistedById(context, entity.getId(), redactions, @@ -659,6 +667,15 @@ private String batchOperation(EntityPersistenceMutation item) { throw new TeaQLRuntimeException("Prepared mutation member has no executable persistence state"); } + private MutationOperationKind mutationKind(EntityPersistenceMutation item) { + return switch (batchOperation(item)) { + case "insert" -> MutationOperationKind.CREATE; + case "delete" -> MutationOperationKind.DELETE; + case "recover" -> MutationOperationKind.RECOVER; + default -> MutationOperationKind.UPDATE; + }; + } + @Override @SuppressWarnings("unchecked") public T executeInTransaction(UserContext context, TransactionCallback action) { diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLRepository.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLRepository.java index dc4da6c90..b308afa30 100644 --- a/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLRepository.java +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLRepository.java @@ -124,6 +124,22 @@ public void setDialect(io.teaql.core.sql.dialect.SqlDialect dialect) { this.dialect = dialect; } + @Override + public String aggregateSql(UserContext context, io.teaql.core.AggrFunction function, + io.teaql.core.Expression operand, String columnSql) { + boolean direct = operand instanceof io.teaql.core.PropertyReference; + for (String name : operand.properties(context)) { + PropertyDescriptor property = allProperties.stream() + .filter(candidate -> name.equals(candidate.getName())) + .findFirst().orElse(null); + if (property != null && property.getType() != null + && property.getType().javaType() == BigDecimal.class) { + return dialect.decimalAggregateSql(function, columnSql, direct); + } + } + return null; + } + public String escapeIdentifier(String identifier) { return dialect.escapeIdentifier(identifier); } @@ -1008,7 +1024,11 @@ private io.teaql.core.CompiledRowMapper compileRowMapper(SearchRequest req PropertyDescriptor property = binding.property(); Object value; if (binding.relationDescriptor() == null) { - value = row.get(binding.index(), property.getType().javaType()); + Class javaType = property.getType().javaType(); + value = row.get(binding.index(), javaType); + if (javaType == java.time.LocalDateTime.class && value != null) { + value = convertColumnValue(property, value); + } } else { Long id = row.get(binding.index(), Long.class); @@ -1219,9 +1239,8 @@ T loadPersistedById(UserContext userContext, Long id, io.teaql.core.SqlIntentRed } Object value = row.get(columnKey); if (!(property instanceof Relation)) { - Class targetType = property.getType().javaType(); entity.setProperty(property.getName(), value == null - ? null : convertColumnValue(targetType, value)); + ? null : convertColumnValue(property, value)); } else if (value == null) { entity.setProperty(property.getName(), null); } else { @@ -1333,12 +1352,11 @@ private T mapRowToEntity(UserContext userContext, SearchRequest request, Map< String columnKey = binding.column(); if (!(property instanceof Relation)) { Object value = row.get(columnKey); - Class targetType = property.getType().javaType(); entity.setProperty( property.getName(), value == null ? null - : convertColumnValue(targetType, value)); + : convertColumnValue(property, value)); } else if (property instanceof Relation) { Object value = row.get(columnKey); if (value == null) { @@ -1395,19 +1413,24 @@ private String findColumnKey(Map row, String propertyName) { } static Object convertTemporalColumnValue(Class targetType, Object value) { - if ((targetType == java.time.LocalDateTime.class || targetType == java.time.LocalDate.class - || targetType == java.time.LocalTime.class) && targetType.isInstance(value)) { - return value; - } - if (targetType == java.time.LocalDateTime.class - && value instanceof java.sql.Timestamp timestamp) { - return timestamp.toLocalDateTime(); - } + return convertTemporalColumnValue(targetType, value, null, null); + } + + private static Object convertTemporalColumnValue(Class targetType, Object value, + String entityType, String field) { if (targetType == java.time.LocalDateTime.class) { - // SQLite returns text and some JDBC drivers return vendor temporal - // wrappers. Both expose the standard timestamp representation. + if (value == null) return null; + if (value instanceof java.time.LocalDateTime dateTime) + return SqlTemporalPrecision.storedDateTime(dateTime, entityType, field); + if (value instanceof java.sql.Timestamp timestamp) + return SqlTemporalPrecision.storedDateTime(timestamp.toLocalDateTime(), entityType, field); String text = String.valueOf(value); - return java.time.LocalDateTime.parse(text.replace(' ', 'T')); + return SqlTemporalPrecision.storedDateTime( + java.time.LocalDateTime.parse(text.replace(' ', 'T')), entityType, field); + } + if ((targetType == java.time.LocalDate.class || targetType == java.time.LocalTime.class) + && targetType.isInstance(value)) { + return value; } if (targetType == java.time.LocalDate.class) { if (value instanceof java.sql.Date date) return date.toLocalDate(); @@ -1429,8 +1452,9 @@ static Object convertTemporalColumnValue(Class targetType, Object value) { return io.teaql.core.utils.Convert.convert(targetType, value); } - private Object convertColumnValue(Class targetType, Object value) { - return convertTemporalColumnValue(targetType, value); + private Object convertColumnValue(PropertyDescriptor property, Object value) { + return convertTemporalColumnValue(property.getType().javaType(), value, + entityDescriptor.getType(), property.getName()); } @SuppressWarnings("unchecked") @@ -1535,6 +1559,7 @@ private record PreparedWriteRow(Object[] values, io.teaql.core.SqlExecutionTrace void updateBatchInternal(UserContext context, List entities, io.teaql.core.SqlIntentRedactions intent, List traces) { requireMemberTraces(entities, traces); + entities.forEach(entity -> io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.UPDATE, entity.getVersion())); Map> rows = new java.util.LinkedHashMap<>(); var compiler = new io.teaql.core.sql.SqlAstCompiler(); for (int index = 0; index < entities.size(); index++) { @@ -1555,7 +1580,7 @@ void updateBatchInternal(UserContext context, List entities, io.teaql.core.Sq versionUpdated = true; columns.add("version"); bindings.add("version"); bindings.add("id"); bindings.add("version"); - values.add(entity.getVersion() + 1); values.add(entity.getId()); values.add(entity.getVersion()); + values.add(io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.UPDATE, entity.getVersion())); values.add(entity.getId()); values.add(entity.getVersion()); sql = compiler.buildUpdateVersionSQL(this, table, columns, null); } else if (primary) { bindings.add("id"); values.add(entity.getId()); @@ -1573,7 +1598,7 @@ void updateBatchInternal(UserContext context, List entities, io.teaql.core.Sq compiler.buildUpdateVersionTableVersionSQL(this, versionTableName), List.of("version", "id", "version"), true, true); rows.computeIfAbsent(shape, ignored -> new ArrayList<>()).add(new PreparedWriteRow( - new Object[]{entity.getVersion() + 1, entity.getId(), entity.getVersion()}, traces.get(index))); + new Object[]{io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.UPDATE, entity.getVersion()), entity.getId(), entity.getVersion()}, traces.get(index))); } } executePreparedWrites(context, rows, intent); @@ -1600,11 +1625,9 @@ private void versionBatchInternal(UserContext context, List entities, io.teaq for (int index = 0; index < entities.size(); index++) { T entity = entities.get(index); Long version = entity.getVersion(); - if (version == null || (recover ? version >= 0 : version <= 0)) { - throw new IllegalArgumentException("Delete/recover batch requires the matching persisted version sign"); - } + long nextVersion = io.teaql.core.MutationVersions.next(recover ? io.teaql.core.MutationOperationKind.RECOVER : io.teaql.core.MutationOperationKind.DELETE, version); if (intent != null) intent.captureTargetId(entity.getId()); - members.add(new PreparedWriteRow(new Object[]{recover ? -version + 1 : -(version + 1), + members.add(new PreparedWriteRow(new Object[]{nextVersion, entity.getId(), version}, traces.get(index))); } executePreparedWrites(context, Map.of(shape, members), intent); @@ -1658,6 +1681,7 @@ void updateInternal(UserContext userContext, Collection updateItems, io.teaql io.teaql.core.SqlExecutionTrace trace) { if (intent != null) updateItems.forEach(item -> intent.captureTargetId(item.getId())); if (ObjectUtil.isEmpty(updateItems)) return; + updateItems.forEach(entity -> io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.UPDATE, entity.getVersion())); List sqlEntities = CollectionUtil.map(updateItems, i -> convertToSQLEntityForUpdate(userContext, i), true); if (ObjectUtil.isEmpty(sqlEntities)) return; @@ -1701,7 +1725,7 @@ private void updateVersionTableVersion(UserContext userContext, SQLEntity sqlEnt io.teaql.core.SqlExecutionTrace trace) { io.teaql.core.sql.SqlAstCompiler compiler = new io.teaql.core.sql.SqlAstCompiler(); String updateSql = compiler.buildUpdateVersionTableVersionSQL(this, this.versionTableName); - Object[] parameters = {sqlEntity.getVersion() + 1, sqlEntity.getId(), sqlEntity.getVersion()}; + Object[] parameters = {io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.UPDATE, sqlEntity.getVersion()), sqlEntity.getId(), sqlEntity.getVersion()}; var bindings = logBindings(this.versionTableName, List.of("version", "id", "version")).withTrace(trace); if (intent != null) intent.capture(bindings.policies(), parameters); int update = database.executeUpdate(userContext, updateSql, parameters, withMutationIntent(bindings, intent)); @@ -1725,7 +1749,7 @@ private void updateVersionTable(UserContext userContext, SQLEntity sqlEntity, io.teaql.core.SqlIntentRedactions intent, io.teaql.core.SqlExecutionTrace trace) { versionTableUpdated.set(true); columns.add("version"); - l.add(sqlEntity.getVersion() + 1); + l.add(io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.UPDATE, sqlEntity.getVersion())); l.add(sqlEntity.getId()); l.add(sqlEntity.getVersion()); io.teaql.core.sql.SqlAstCompiler compiler = new io.teaql.core.sql.SqlAstCompiler(); @@ -1752,8 +1776,7 @@ void deleteInternal(UserContext userContext, Collection entities, io.teaql.co io.teaql.core.sql.SqlAstCompiler compiler = new io.teaql.core.sql.SqlAstCompiler(); String updateSql = compiler.buildDeleteSQL(this, this.versionTableName); List args = entities.stream() - .filter(e -> e.getVersion() > 0) - .map(e -> new Object[]{-(e.getVersion() + 1), e.getId(), e.getVersion()}) + .map(e -> new Object[]{io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.DELETE, e.getVersion()), e.getId(), e.getVersion()}) .collect(Collectors.toList()); var bindings = logBindings(this.versionTableName, List.of("version", "id", "version")).withTrace(trace); if (intent != null) for (Object[] row : args) intent.capture(bindings.policies(), row); @@ -1778,8 +1801,7 @@ void recoverInternal(UserContext userContext, Collection entities, io.teaql.c io.teaql.core.sql.SqlAstCompiler compiler = new io.teaql.core.sql.SqlAstCompiler(); String updateSql = compiler.buildDeleteSQL(this, this.versionTableName); List args = entities.stream() - .filter(e -> e.getVersion() < 0) - .map(e -> new Object[]{(-e.getVersion() + 1), e.getId(), e.getVersion()}) + .map(e -> new Object[]{io.teaql.core.MutationVersions.next(io.teaql.core.MutationOperationKind.RECOVER, e.getVersion()), e.getId(), e.getVersion()}) .collect(Collectors.toList()); var bindings = logBindings(this.versionTableName, List.of("version", "id", "version")).withTrace(trace); if (intent != null) for (Object[] row : args) intent.capture(bindings.policies(), row); @@ -2103,7 +2125,8 @@ private static boolean isUnboundedTextFamily(String family) { private static boolean isDecimalFamily(String family) { return "DECIMAL".equals(family) || "NUMERIC".equals(family) - || "NUMBER".equals(family); + || "NUMBER".equals(family) + || "DECIMAL_TEXT".equals(family); } private String metadataColumnName(Map column, String table) { @@ -2123,7 +2146,8 @@ protected void createTable(UserContext context, String table, List co sb.append("CREATE TABLE ").append(table).append(" (\n"); sb.append(columns.stream() .map(column -> { - String dbColumn = dialect.escapeIdentifier(column.getColumnName()) + " " + dialect.mapColumnType(column.getType()); + String dbColumn = dialect.escapeIdentifier(column.getColumnName()) + " " + + dialect.columnTypeAndConstraintsSql(column); if (column.isIdColumn()) dbColumn += " NOT NULL PRIMARY KEY"; else if (column.isRequired()) dbColumn += " NOT NULL"; return dbColumn; @@ -2143,7 +2167,7 @@ protected void createTable(UserContext context, String table, List co protected void addColumn(UserContext context, SQLColumn column) { String sql = StrUtil.format("ALTER TABLE {} ADD COLUMN {} {}{}", dialect.escapeIdentifier(column.getTableName()), dialect.escapeIdentifier(column.getColumnName()), - dialect.mapColumnType(column.getType()), column.isRequired() ? " NOT NULL" : ""); + dialect.columnTypeAndConstraintsSql(column), column.isRequired() ? " NOT NULL" : ""); logInfo(sql + ";"); if (ensureTableEnabled(context)) { try { @@ -2434,7 +2458,8 @@ private AggregationResult aggregateWithIntent(UserContext userContext, SearchReq AggregationItem item = new AggregationItem(); for (SimpleNamedExpression function : request.getAggregations().getAggregates()) { String columnKey = findColumnKey(row, function.name()); - item.addValue(function, columnKey == null ? null : row.get(columnKey)); + Object raw = columnKey == null ? null : row.get(columnKey); + item.addValue(function, decodeAggregateValue(function, raw)); } for (SimpleNamedExpression dimension : request.getAggregations().getDimensions()) { String columnKey = findColumnKey(row, dimension.name()); @@ -2449,6 +2474,21 @@ private AggregationResult aggregateWithIntent(UserContext userContext, SearchReq } } + private Object decodeAggregateValue(SimpleNamedExpression selected, Object raw) { + if (raw == null || !(selected.getExpression() instanceof io.teaql.core.AggrExpression aggregate) + || aggregate.getOperator() == io.teaql.core.AggrFunction.COUNT + || aggregate.getExpressions().size() != 1 + || !(aggregate.getExpressions().get(0) instanceof io.teaql.core.PropertyReference reference)) { + return raw; + } + PropertyDescriptor property = allProperties.stream() + .filter(candidate -> reference.getPropertyName().equals(candidate.getName())) + .findFirst().orElse(null); + return property != null && property.getType() != null + && property.getType().javaType() == BigDecimal.class + ? dialect.decodeDecimalAggregate(raw) : raw; + } + // ========================================== // Stream support // ========================================== diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/SqlTemporalPrecision.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/SqlTemporalPrecision.java new file mode 100644 index 000000000..adaa7c736 --- /dev/null +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/SqlTemporalPrecision.java @@ -0,0 +1,71 @@ +package io.teaql.core.sql.portable; + +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; + +/** Physical modeled DateTime precision. Does not mutate entities, clocks or codecs. */ +public final class SqlTemporalPrecision { + private SqlTemporalPrecision() { } + + /** Normalize new SQL parameters without changing caller-owned native values. */ + public static LocalDateTime dateTime(LocalDateTime value) { + return value == null || value.getNano() % 1_000_000 == 0 + ? value : value.truncatedTo(ChronoUnit.MILLIS); + } + + /** Never turn an incompatible legacy row into a successful lossy read. */ + static LocalDateTime storedDateTime(LocalDateTime value, String entityType, String field) { + if (value != null && value.getNano() % 1_000_000 != 0) { + // Deliberately omit the private value and any value-carrying cause. + throw new SqlTemporalPrecisionException(entityType, field); + } + return value; + } + + private static Object parameter(Object value) { + if (value instanceof LocalDateTime time) return dateTime(time); + // SQL IN/array bindings are flat scalar collections, not arbitrary + // object graphs. Never traverse JSON objects or recursively walk lists. + if (value instanceof List values) { + List copy = null; + for (int i=0;i(values);copy.set(i,after); } + } + return copy==null ? value : copy; + } + if (value instanceof LocalDateTime[] values) { + LocalDateTime[] copy=null; + for (int i=0;i batch(List values) { + if (values==null) return null; + List copy=null; + for (int i=0;i(values);copy.set(i,after); } + } + return copy==null ? values : copy; + } +} diff --git a/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/SqlTemporalPrecisionException.java b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/SqlTemporalPrecisionException.java new file mode 100644 index 000000000..dc9b704eb --- /dev/null +++ b/teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/SqlTemporalPrecisionException.java @@ -0,0 +1,31 @@ +package io.teaql.core.sql.portable; + +import io.teaql.core.TeaQLRuntimeException; +import io.teaql.core.checker.ObjectLocation; + +/** Value-free diagnostic for stored DateTime values incompatible with SQL precision. */ +public final class SqlTemporalPrecisionException extends TeaQLRuntimeException { + private static final String CODE = "SQL_DATETIME_PRECISION_MISMATCH"; + private static final String REMEDY = "Migrate the stored DateTime field to millisecond precision under an explicit data-migration policy, then retry. No data was automatically rewritten."; + private final String entityType; + private final String field; + + SqlTemporalPrecisionException(String entityType, String field) { + super("[" + CODE + "] Stored SQL DateTime for " + + (entityType == null ? "the modeled entity" : entityType) + + (field == null ? "" : "." + field) + + " has sub-millisecond precision; expected milliseconds. " + REMEDY); + this.entityType = entityType; + this.field = field; + } + + public String getCode() { return CODE; } + public String getEntityType() { return entityType; } + /** Canonical modeled property name supplied by metadata, never the stored value. */ + public String getField() { return field; } + /** RFC 6901 pointer under the default JSON naming policy; empty means root. */ + public String getPath() { return field == null ? "" : ObjectLocation.hashRoot(field).instancePath(); } + public String getExpectedPrecision() { return "milliseconds"; } + public boolean isMigrationRequired() { return true; } + public String getSuggestedFix() { return REMEDY; } +} diff --git a/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLDatabaseTest.java b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLDatabaseTest.java index 02d6e7f6e..d76e04519 100644 --- a/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLDatabaseTest.java +++ b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLDatabaseTest.java @@ -436,6 +436,50 @@ public void TOPN_013_canonicalRelationIndexOnlyIgnoresKnownDuplicateRace() { } } + @Test + public void selectedEmptyReverseListsAreMutableAndOwnerLocalWithoutLedgerAllocation() { + registerTopNFixture(); + TopNChildRequest child = new TopNChildRequest().where("state", Operator.EQUAL, "no-child-state"); + child.selectProperty("id"); child.selectProperty("version"); child.offset(0, 2); + TopNParentRequest parent = new TopNParentRequest(); + parent.selectProperty("id"); parent.selectProperty("version"); parent.selectProperty("name"); + parent.addOrderByAscending("id"); parent.offset(0, 3); parent.enhanceRelation("children", child); + int writesBefore = sqliteDb.executeTrace().size(); + SmartList rows = parent.comment("Load three explicitly empty child lists") + .purpose("Verify mutable relation values remain private while load states are shared") + .executeForList(context); + assertEquals(3, rows.size()); + SmartList first = rows.get(0).getProperty("children"); + SmartList second = rows.get(1).getProperty("children"); + SmartList third = rows.get(2).getProperty("children"); + assertNotSame(first, second); assertNotSame(first, third); assertNotSame(second, third); + for (TopNParent row : rows) { + assertTrue(row.isPropertyLoaded("children")); + assertFalse(row.__internalHasMutationLedger()); + assertSame(rows.get(0).__internalLoadState(), row.__internalLoadState()); + } + TopNChild appended = new TopNChild(); first.add(appended); + assertSame(appended, first.first()); assertTrue(second.isEmpty()); assertTrue(third.isEmpty()); + assertTrue(SmartList.empty(TopNChild.class).isEmpty()); + assertEquals(writesBefore, sqliteDb.executeTrace().size()); + for (TopNParent row : rows) assertFalse(row.__internalHasMutationLedger()); + } + + @Test + public void unselectedReverseListRemainsNotLoadedWithoutLedgerOrWrites() { + registerTopNFixture(); + TopNParentRequest parent = new TopNParentRequest(); + parent.selectProperty("id"); parent.selectProperty("version"); parent.selectProperty("name"); + parent.addOrderByAscending("id"); parent.offset(0, 1); + int writesBefore = sqliteDb.executeTrace().size(); + SmartList rows = parent.comment("Load an owner without selecting children") + .purpose("Keep absent relation details distinct from an explicitly empty list") + .executeForList(context); + assertEquals(1, rows.size()); assertFalse(rows.first().isPropertyLoaded("children")); + assertNull(rows.first().getProperty("children")); assertFalse(rows.first().__internalHasMutationLedger()); + assertEquals(writesBefore, sqliteDb.executeTrace().size()); + } + private Map> loadTopNFixture(Integer threshold) { sqliteDb.clearQueryTrace(); TopNChildRequest child = new TopNChildRequest().where("state", Operator.EQUAL, "visible"); @@ -463,7 +507,10 @@ private Map> loadTopNFixture(Integer threshold) { assertTrue("selected relation marker must include empty parents", row.isPropertyLoaded("children")); assertFalse("read hydration must not allocate a mutation ledger", row.__internalHasMutationLedger()); assertSame("loaded and empty reverse parents share one actual shape", shared, row.__internalLoadState()); - if (children.isEmpty()) assertSame(SmartList.empty(TopNChild.class), children); + if (children.isEmpty()) { + assertFalse("entity-owned lists must accept generated child attachment", children.isSharedEmpty()); + assertNotSame(SmartList.empty(TopNChild.class), children); + } result.put(row.getId(), children.toList(Entity::getId)); } return result; @@ -878,6 +925,60 @@ public void testCompleteForwardAndReverseRelationFixtureIncludingOrphanNullOnSQL new QueryGroupRequest().withoutRecordsMatching(allRecords)); } + @Test public void testEmptyMaterializedReverseRelationPreservesNegation() { + prepareEmptyRelationFixture(); + for (boolean materialized : List.of(false, true)) { + QueryRecordRequest absent = new QueryRecordRequest().where("name", Operator.EQUAL, "no match"); + if (materialized) absent.top(5); else absent.unlimited(); + assertNames(List.of(), new QueryGroupRequest().withRecordsMatching(absent)); + assertNames(List.of("Core", "Other", "Empty"), new QueryGroupRequest().withoutRecordsMatching(absent)); + } + } + + @Test public void testNullOnlyMaterializedReverseRelationPreservesNegation() { + prepareEmptyRelationFixture(); + for (boolean materialized : List.of(false, true)) { + QueryRecordRequest orphan = new QueryRecordRequest().where("name", Operator.EQUAL, "orphan"); + if (materialized) orphan.top(5); else orphan.unlimited(); + assertNames(List.of(), new QueryGroupRequest().withRecordsMatching(orphan)); + assertNames(List.of("Core", "Other", "Empty"), new QueryGroupRequest().withoutRecordsMatching(orphan)); + } + } + + @Test public void testEmptyMaterializedForwardRelationPreservesNegation() { + prepareEmptyRelationFixture(); + for (boolean materialized : List.of(false, true)) { + QueryGroupRequest absent = new QueryGroupRequest().where("name", Operator.EQUAL, "no match"); + if (materialized) absent.top(5); else absent.unlimited(); + assertNames(List.of(), new QueryRecordRequest().withGroupMatching(absent)); + assertNames(List.of("included", "excluded", "orphan"), new QueryRecordRequest().withoutGroupMatching(absent)); + } + } + + @Test public void testEmptyMaterializedNegativeRelationPreservesOuterConjunction() { + prepareEmptyRelationFixture(); + for (boolean materialized : List.of(false, true)) { + QueryRecordRequest absent = new QueryRecordRequest().where("name", Operator.EQUAL, "no match"); + if (materialized) absent.top(5); else absent.unlimited(); + assertNames(List.of("Core"), new QueryGroupRequest().where("name", Operator.EQUAL, "Core").withoutRecordsMatching(absent)); + assertNames(List.of(), new QueryGroupRequest().where("name", Operator.EQUAL, "Core").withRecordsMatching(absent)); + } + } + + private static void prepareEmptyRelationFixture() { + metaFactory.register(relationEntity("QueryGroup", QueryGroup.class, QueryGroup::new, "query_group_data", + List.of(new Object[] {"id", "INTEGER", Long.class}, new Object[] {"name", "VARCHAR(100)", String.class}, new Object[] {"version", "INTEGER", Long.class}))); + metaFactory.register(relationEntity("QueryRecord", QueryRecord.class, QueryRecord::new, "query_record_data", + List.of(new Object[] {"id", "INTEGER", Long.class}, new Object[] {"query_group", "INTEGER", Long.class}, + new Object[] {"name", "VARCHAR(100)", String.class}, new Object[] {"version", "INTEGER", Long.class}))); + sqlDataService.getRepository("QueryGroup").ensurePhysicalSchema(context); + sqlDataService.getRepository("QueryRecord").ensurePhysicalSchema(context); + sqliteDb.execute("DELETE FROM query_group_data"); + sqliteDb.execute("DELETE FROM query_record_data"); + sqliteDb.execute("INSERT INTO query_group_data VALUES (1,'Core',1),(2,'Other',1),(3,'Empty',1)"); + sqliteDb.execute("INSERT INTO query_record_data VALUES (11,1,'included',1),(12,2,'excluded',1),(13,NULL,'orphan',1)"); + } + private static EntityDescriptor relationEntity( String type, Class targetType, java.util.function.Supplier supplier, String table, List definitions) { diff --git a/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLTemporalConversionTest.java b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLTemporalConversionTest.java index ad5cf7e45..8f974aae4 100644 --- a/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLTemporalConversionTest.java +++ b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/PortableSQLTemporalConversionTest.java @@ -12,11 +12,21 @@ public class PortableSQLTemporalConversionTest { public void nativeImmutableTemporalValuesAreNotFormattedAndParsedAgain() { var date = java.time.LocalDate.of(2026, 10, 7); var time = java.time.LocalTime.of(12, 34, 56, 123456789); - var timestamp = java.time.LocalDateTime.of(date, time); + // SQL DateTime now has an approved millisecond carrier. The aligned + // native value still takes the identity-preserving fast path. + var timestamp = java.time.LocalDateTime.of(date, time.truncatedTo(java.time.temporal.ChronoUnit.MILLIS)); org.junit.Assert.assertSame(date, PortableSQLRepository.convertTemporalColumnValue(java.time.LocalDate.class, date)); org.junit.Assert.assertSame(time, PortableSQLRepository.convertTemporalColumnValue(java.time.LocalTime.class, time)); org.junit.Assert.assertSame(timestamp, PortableSQLRepository.convertTemporalColumnValue(java.time.LocalDateTime.class, timestamp)); - org.junit.Assert.assertEquals(123456789, timestamp.getNano()); + org.junit.Assert.assertEquals(123000000, timestamp.getNano()); + } + @Test + public void subMillisecondSqlReadRejectsWithoutChangingTheNativeValue() { + var nativeValue = LocalDateTime.of(2026, 11, 10, 12, 34, 56, 123456789); + org.junit.Assert.assertThrows(SqlTemporalPrecisionException.class, + () -> PortableSQLRepository.convertTemporalColumnValue(LocalDateTime.class, nativeValue)); + assertEquals(123456789, nativeValue.getNano()); + org.junit.Assert.assertNull(PortableSQLRepository.convertTemporalColumnValue(LocalDateTime.class, null)); } @Test public void convertsJdbcStyleTemporalStrings() { diff --git a/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/SqlLegacyTemporalPrecisionTest.java b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/SqlLegacyTemporalPrecisionTest.java new file mode 100644 index 000000000..8873124b7 --- /dev/null +++ b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/SqlLegacyTemporalPrecisionTest.java @@ -0,0 +1,194 @@ +package io.teaql.core.sql.portable; + +import static org.junit.Assert.*; + +import io.teaql.core.*; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.GenericSQLProperty; +import io.teaql.core.sql.SQLEntityDescriptor; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import java.lang.reflect.Proxy; +import java.sql.DriverManager; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Test; + +/** Legacy SQL carriers must never become a successful lossy read. */ +public class SqlLegacyTemporalPrecisionTest { + private static final LocalDateTime LEGACY = LocalDateTime.of(2026, 11, 10, 12, 34, 56, 123456789); + private static final LocalDateTime ALIGNED = LEGACY.withNano(123000000); + + public static final class TemporalRow extends BaseEntity { + static { + FieldLayout.installGenerated(FieldLayout.generated(TemporalRow.class, "legacy-sql-time-v1", + Map.of("id", 0, "version", 1, "happened_at", 2), + Map.of("id", List.of("id", "id"), "version", List.of("version", "version"), + "happened_at", List.of("happenedAt", "event_time")), Set.of())); + } + LocalDateTime happenedAt; + @Override public String typeName() { return "TemporalRow"; } + @Override public Object __internalGet(String name) { + return "happenedAt".equals(name) ? happenedAt : super.__internalGet(name); + } + @Override public void __internalSet(String name, Object value) { + if ("happenedAt".equals(name)) { happenedAt = (LocalDateTime) value; markPropertyLoaded(name); } + else super.__internalSet(name, value); + } + } + + private static final class Request extends BaseRequest { + Request() { + super(TemporalRow.class); + selectProperty("id"); selectProperty("version"); selectProperty("happenedAt"); + offset(0, 1); + internalComment("read the legacy SQL precision boundary"); + internalPurpose("reject incompatible stored precision without rewriting data"); + } + @Override public String getTypeName() { return "TemporalRow"; } + } + + private record Fixture(PortableSQLRepository repository, DefaultUserContext context) { + SmartList load() { return repository.loadInternal(context, new Request()); } + } + + private Fixture fixture(TeaQLDatabase database) { + new TemporalRow(); + var descriptor = new SQLEntityDescriptor(); + descriptor.setType("TemporalRow"); descriptor.setTargetType(TemporalRow.class); + descriptor.setEntitySupplier(TemporalRow::new); descriptor.setDataService("legacy-time-test"); + descriptor.with("table_name", "temporal_data"); descriptor.setAuditMaskFields(List.of()); + for (String name : List.of("id", "version", "happenedAt")) { + var property = (GenericSQLProperty) descriptor.addSimpleProperty(name, + name.equals("happenedAt") ? LocalDateTime.class : Long.class); + property.setTableName("temporal_data"); + property.setColumnName(name.equals("happenedAt") ? "event_time" : name); + property.setColumnType(name.equals("happenedAt") ? "TIMESTAMP" : "BIGINT"); + } + var metadata = new SimpleEntityMetaFactory(); metadata.register(descriptor); + var runtime = TeaQLRuntime.builder().metadata(metadata).queryExecutionLogging(false).build(); + return new Fixture(new PortableSQLRepository<>(descriptor, database, null, metadata), new DefaultUserContext(runtime)); + } + + private Fixture fixture(Object value, boolean compiled, AtomicInteger mapped) { + TeaQLDatabase database = (TeaQLDatabase) Proxy.newProxyInstance(TeaQLDatabase.class.getClassLoader(), + new Class[]{TeaQLDatabase.class}, (proxy, method, args) -> { + if (method.getName().equals("supportsCompiledRowMapping")) return compiled; + if (method.getName().equals("query")) { + mapped.incrementAndGet(); + if (args.length == 5 && args[3] instanceof CompiledRowMapper mapper) { + return List.of(mapper.map(new DataRow() { + @Override public Object get(int index) { return index < 3 ? 1L : value; } + @Override public V get(int index, Class type) { return type.cast(get(index)); } + })); + } + var row = new LinkedHashMap(); + row.put("id", 1L); row.put("version", 1L); row.put("happenedAt", value); + return List.of(row); + } + throw new AssertionError("unexpected provider access: " + method); + }); + return fixture(database); + } + + private RuntimeException rejected(org.junit.function.ThrowingRunnable action, boolean fieldKnown) throws Exception { + var error = assertThrows(TeaQLRuntimeException.class, action); + assertEquals("SQL_DATETIME_PRECISION_MISMATCH", error.getClass().getMethod("getCode").invoke(error)); + assertEquals("milliseconds", error.getClass().getMethod("getExpectedPrecision").invoke(error)); + assertEquals(true, error.getClass().getMethod("isMigrationRequired").invoke(error)); + var remedy = (String) error.getClass().getMethod("getSuggestedFix").invoke(error); + assertTrue(remedy.toLowerCase(Locale.ROOT).contains("migrat")); + assertFalse(error.toString().contains("2026-11-10")); + assertNull("the rejected private value must not survive in a cause", error.getCause()); + if (fieldKnown) { + assertEquals("TemporalRow", error.getClass().getMethod("getEntityType").invoke(error)); + assertEquals("happenedAt", error.getClass().getMethod("getField").invoke(error)); + assertEquals("/happenedAt", error.getClass().getMethod("getPath").invoke(error)); + } + return error; + } + + @Test public void nativeSubMillisecondSqlValuesAreRejectedWithoutChangingThem() throws Exception { + for (var time : List.of(LEGACY, LEGACY.withNano(1), LEGACY.withNano(999999999), + LocalDateTime.of(1960, 2, 29, 23, 59, 59, 999999999))) { + int before = time.getNano(); + rejected(() -> PortableSQLRepository.convertTemporalColumnValue(LocalDateTime.class, time), false); + assertEquals(before, time.getNano()); + } + } + @Test public void timestampSubMillisecondSqlValuesAreRejectedWithoutChangingThem() throws Exception { + var timestamp = java.sql.Timestamp.valueOf(LEGACY); + rejected(() -> PortableSQLRepository.convertTemporalColumnValue(LocalDateTime.class, timestamp), false); + assertEquals(123456789, timestamp.getNanos()); + } + @Test public void textualAndVendorSqlValuesAreRejectedWithoutEmbeddingPrivateValues() throws Exception { + for (Object carrier : List.of("2026-11-10 12:34:56.123456789", "2026-11-10T12:34:56.000000001", + new Object() { @Override public String toString() { return "2026-11-10 12:34:56.999999999"; } })) { + rejected(() -> PortableSQLRepository.convertTemporalColumnValue(LocalDateTime.class, carrier), false); + } + } + @Test public void compiledMapperReportsTheModeledFieldOnColdAndCachedPlans() throws Exception { + var mapped = new AtomicInteger(); var fixture = fixture(LEGACY, true, mapped); + rejected(fixture::load, true); rejected(fixture::load, true); + assertEquals(2, mapped.get()); + } + @Test public void fallbackMapperReportsTheModeledFieldInsteadOfReturningLoadedNull() throws Exception { + var mapped = new AtomicInteger(); var fixture = fixture("2026-11-10 12:34:56.123456789", false, mapped); + rejected(fixture::load, true); assertEquals(1, mapped.get()); + } + @Test public void authoritativeReadbackReportsTheSameField() throws Exception { + var mapped = new AtomicInteger(); var fixture = fixture(LEGACY, false, mapped); + rejected(() -> fixture.repository.loadPersistedById(fixture.context, 1L), true); + assertEquals(1, mapped.get()); + } + @Test public void alignedAndNullSqlValuesKeepTheirSuccessfulLoadedStates() { + for (boolean compiled : List.of(false, true)) { + var row = fixture(ALIGNED, compiled, new AtomicInteger()).load().get(0); + assertSame(ALIGNED, row.happenedAt); assertTrue(row.isPropertyLoaded("happenedAt")); + var empty = fixture(null, compiled, new AtomicInteger()).load().get(0); + assertNull(empty.happenedAt); assertTrue(empty.isPropertyLoaded("happenedAt")); + } + assertSame(ALIGNED, PortableSQLRepository.convertTemporalColumnValue(LocalDateTime.class, ALIGNED)); + assertNull(PortableSQLRepository.convertTemporalColumnValue(LocalDateTime.class, null)); + } + @Test public void realLegacySqliteRowRemainsUnchangedAfterRejectedQueryAndReadback() throws Exception { + try (var connection = DriverManager.getConnection("jdbc:sqlite::memory:")) { + try (var statement = connection.createStatement()) { + statement.execute("CREATE TABLE temporal_data(id INTEGER PRIMARY KEY, version INTEGER, event_time TEXT)"); + // Deliberately incompatible legacy fixture, not application bootstrap data. + statement.execute("INSERT INTO temporal_data VALUES(1,1,'2026-11-10 12:34:56.123456789')"); + } + var queries = new AtomicInteger(); + TeaQLDatabase database = (TeaQLDatabase) Proxy.newProxyInstance(TeaQLDatabase.class.getClassLoader(), + new Class[]{TeaQLDatabase.class}, (proxy, method, args) -> { + if (method.getName().equals("supportsCompiledRowMapping")) return false; + if (!method.getName().equals("query")) throw new AssertionError("no writes allowed: " + method); + queries.incrementAndGet(); + try (var statement = connection.prepareStatement((String) args[1])) { + var parameters = (Object[]) args[2]; + for (int i = 0; i < parameters.length; i++) statement.setObject(i + 1, parameters[i]); + try (var rows = statement.executeQuery()) { + var result = new ArrayList>(); + while (rows.next()) { + var row = new LinkedHashMap(); + for (int i = 1; i <= rows.getMetaData().getColumnCount(); i++) + row.put(rows.getMetaData().getColumnLabel(i), rows.getObject(i)); + result.add(row); + } + return result; + } + } + }); + var fixture = fixture(database); + rejected(fixture::load, true); + rejected(() -> fixture.repository.loadPersistedById(fixture.context, 1L), true); + assertEquals(2, queries.get()); + try (var statement = connection.createStatement(); + var rows = statement.executeQuery("SELECT event_time, total_changes() FROM temporal_data")) { + assertTrue(rows.next()); assertEquals("2026-11-10 12:34:56.123456789", rows.getString(1)); + assertEquals(1, rows.getInt(2)); assertFalse(rows.next()); + } + } + } +} diff --git a/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/SqlTemporalPrecisionTest.java b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/SqlTemporalPrecisionTest.java new file mode 100644 index 000000000..2f8319bda --- /dev/null +++ b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/SqlTemporalPrecisionTest.java @@ -0,0 +1,52 @@ +package io.teaql.core.sql.portable; + +import java.time.*; +import java.util.*; +import org.junit.Test; +import static org.junit.Assert.*; + +public class SqlTemporalPrecisionTest { + private static final LocalDateTime NANO=LocalDateTime.of(1960,2,29,23,59,59,999999999); + private static final LocalDateTime MILLI=NANO.withNano(999000000); + + @Test public void flatCollectionsAndTypedArraysAreCopiedOnlyWhenNeeded() { + var list=Arrays.asList(NANO,null,MILLI); + LocalDateTime[] array={NANO,null,MILLI}; + Object[] input={list,array}; + Object[] actual=SqlTemporalPrecision.parameters(input); + assertNotSame(input,actual); + assertEquals(Arrays.asList(MILLI,null,MILLI),actual[0]); + assertArrayEquals(new LocalDateTime[]{MILLI,null,MILLI},(LocalDateTime[])actual[1]); + assertSame(NANO,list.get(0));assertSame(NANO,array[0]); + } + @Test public void alignedBindingsAndBatchesReuseTheirExistingContainers() { + Object[] row={MILLI,null,"unchanged",12L};var batch=Collections.singletonList(row); + assertSame(row,SqlTemporalPrecision.parameters(row));assertSame(batch,SqlTemporalPrecision.batch(batch)); + assertNull(SqlTemporalPrecision.parameters(null));assertNull(SqlTemporalPrecision.batch(null)); + } + @Test public void batchNormalizationDoesNotRewriteAnyCallerOwnedRow() { + Object[] changed={NANO},aligned={MILLI};var batch=List.of(changed,aligned); + var actual=SqlTemporalPrecision.batch(batch); + assertNotSame(batch,actual);assertNotSame(changed,actual.get(0));assertSame(aligned,actual.get(1)); + assertSame(NANO,changed[0]);assertEquals(MILLI,actual.get(0)[0]); + } + @Test public void nativeTimeInstantAndJsonObjectsAreNotPrecisionConverted() { + var map=Map.of("datetime",NANO);var time=NANO.toLocalTime();var instant=Instant.parse("1960-02-29T23:59:59.999999999Z"); + Object[] input={map,time,instant,NANO.toLocalDate()}; + assertSame(input,SqlTemporalPrecision.parameters(input));assertEquals(NANO,map.get("datetime")); + assertEquals(999999999,time.getNano());assertEquals(999999999,instant.getNano()); + } + @Test public void cyclicAndNestedListsAreNotTraversedAsObjectGraphs() { + var list=new ArrayList();list.add(list);list.add(Map.of("datetime",NANO)); + Object[] input={list};assertSame(input,SqlTemporalPrecision.parameters(input)); + } + @Test public void wallTimeFormattingDoesNotNormalizeDstGapsOrConsultTheDefaultZone() { + var original=TimeZone.getDefault();var gap=LocalDateTime.of(2024,3,10,2,30,0,123000000); + try { for(var zone:List.of("UTC","America/New_York","Asia/Shanghai")) { + TimeZone.setDefault(TimeZone.getTimeZone(zone)); + assertEquals("2024-03-10 02:30:00.123",io.teaql.core.utils.LocalDateTimeUtil.formatSql(gap)); + assertEquals("1960-02-29 23:59:59.999999999",io.teaql.core.utils.LocalDateTimeUtil.formatSql(NANO)); + assertEquals("2026-01-01 00:00:00.0",io.teaql.core.utils.LocalDateTimeUtil.formatSql(LocalDateTime.of(2026,1,1,0,0))); + }} finally { TimeZone.setDefault(original); } + } +} diff --git a/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/VersionLifecyclePortableSQLTest.java b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/VersionLifecyclePortableSQLTest.java new file mode 100644 index 000000000..5a7edc4f8 --- /dev/null +++ b/teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/VersionLifecyclePortableSQLTest.java @@ -0,0 +1,146 @@ +package io.teaql.core.sql.portable; + +import io.teaql.core.*; +import io.teaql.core.meta.*; +import io.teaql.core.sql.GenericSQLProperty; +import io.teaql.runtime.*; +import java.util.*; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Actual SQLite and direct provider admission, not a compiler-only probe. */ +public class VersionLifecyclePortableSQLTest { + public static final class Row extends BaseEntity { + String name; + void updateName(String value) { handleUpdate("name", name, value); name = value; } + @Override public Object __internalGet(String field) { return field.equals("name") ? name : super.__internalGet(field); } + @Override public void __internalSet(String field, Object value) { + if (field.equals("name")) { markPropertyLoaded(field); name = (String) value; } + else super.__internalSet(field, value); + } + } + static final class Database extends PortableSQLDatabaseTest.SQLiteTeaQLDatabase { + int writes, transactions; + Database() throws Exception { super(); } + @Override public int executeUpdate(String sql, Object[] args) { writes++; return super.executeUpdate(sql, args); } + @Override public int[] batchUpdate(String sql, List args) { writes++; return super.batchUpdate(sql, args); } + @Override public void executeInTransaction(Runnable action) { transactions++; super.executeInTransaction(action); } + } + static final class Fixture { + final Database database = new Database(); + final PortableSQLDataService service; + final PortableSQLRepository repository; + final DefaultUserContext context; + Fixture() throws Exception { + var descriptor = new EntityDescriptor(); + descriptor.setType("Row"); descriptor.setTargetType(Row.class); descriptor.setEntitySupplier(Row::new); + var properties = new ArrayList(); + for (String name : List.of("id", "version", "name")) { + var p = new GenericSQLProperty("version_lifecycle_data", name, name.equals("name") ? "VARCHAR(100)" : "BIGINT"); + p.setName(name); p.setOwner(descriptor); + p.setType(new SimplePropertyType(name.equals("name") ? String.class : Long.class)); properties.add(p); + } + descriptor.setProperties(properties); + var metadata = new SimpleEntityMetaFactory(); metadata.register(descriptor); + context = new DefaultUserContext(TeaQLRuntime.builder().metadata(metadata).executionLogging(false).build()); + service = new PortableSQLDataService("fixture", database, metadata); + repository = service.getRepository("Row"); repository.ensurePhysicalSchema(context); + } + Row row(long id, long version) { + database.executeUpdate("INSERT INTO version_lifecycle_data(id,version,name) VALUES(?,?,?)", new Object[]{id, version, "original"}); + return repository.loadPersistedById(context, id); + } + void reset() { database.writes = 0; database.transactions = 0; } + long version(long id) { return ((Number) database.query("SELECT version FROM version_lifecycle_data WHERE id=?", new Object[]{id}).get(0).get("version")).longValue(); } + void rejected(Runnable action, Row... rows) { + long[] before = Arrays.stream(rows).mapToLong(row -> row.getVersion()).toArray(); + var names = Arrays.stream(rows).map(row -> database.query("SELECT name FROM version_lifecycle_data WHERE id=?", new Object[]{row.getId()}).get(0).get("name")).toList(); + var pendingNames = Arrays.stream(rows).map(row -> row.name).toList(); + reset(); + Throwable failure = null; + try { action.run(); } catch (RuntimeException error) { failure = error; } + System.out.println("VERSION_SQL originals=" + Arrays.toString(before) + " writes=" + database.writes + + " transactions=" + database.transactions + " failure=" + (failure == null ? "none" : failure.getClass().getSimpleName())); + assertEquals("invalid full batch must not enter storage", 0, database.writes); + assertEquals("invalid provider batch must not begin transaction", 0, database.transactions); + assertNotNull("invalid operation requires explicit rejection", failure); + for (int i = 0; i < rows.length; i++) { + assertEquals(before[i], version(rows[i].getId())); assertEquals(Long.valueOf(before[i]), rows[i].getVersion()); + assertEquals(names.get(i), database.query("SELECT name FROM version_lifecycle_data WHERE id=?", new Object[]{rows[i].getId()}).get(0).get("name")); + assertEquals(pendingNames.get(i), rows[i].name); + } + } + } + static void rejectUpdate(long version) throws Exception { + var f = new Fixture(); var row = f.row(1, version); row.set$status(EntityStatus.PERSISTED); row.updateName("pending"); + f.rejected(() -> f.repository.updateInternal(f.context, List.of(row)), row); + } + @Test public void exhaustedUpdateCannotWrapToTombstone() throws Exception { rejectUpdate(Long.MAX_VALUE); } + @Test public void zeroUpdateCannotBecomeLive() throws Exception { rejectUpdate(0); } + @Test public void tombstoneCannotBeUpdatedAsLive() throws Exception { rejectUpdate(-1); } + @Test public void minimumRecoveryCannotWrap() throws Exception { + var f = new Fixture(); var row = f.row(1, Long.MIN_VALUE); f.rejected(() -> f.repository.recoverInternal(f.context, List.of(row)), row); + } + @Test public void minimumPlusOneRecoveryCannotWrap() throws Exception { + var f = new Fixture(); var row = f.row(1, Long.MIN_VALUE + 1); f.rejected(() -> f.repository.recoverInternal(f.context, List.of(row)), row); + } + @Test public void nonLiveDeleteCannotSilentlySucceed() throws Exception { + var f = new Fixture(); var row = f.row(1, -2); f.rejected(() -> f.repository.deleteInternal(f.context, List.of(row)), row); + } + @Test public void wholeUpdateCollectionRejectedBeforeFirstNativeWrite() throws Exception { + var f = new Fixture(); var first = f.row(1, 1); var second = f.row(2, Long.MAX_VALUE); + first.updateName("first pending"); second.updateName("second pending"); + f.rejected(() -> f.repository.updateInternal(f.context, List.of(first, second)), first, second); + } + @Test public void wholePreparedBatchRejectedBeforeFirstNativeWrite() throws Exception { + var f = new Fixture(); var first = f.row(1, 1); var second = f.row(2, Long.MAX_VALUE); + first.updateName("first pending"); second.updateName("second pending"); + var traces = List.of(SqlExecutionTrace.mutation(first, List.of(), "update", MutationIntent.of("inspect version batch")), + SqlExecutionTrace.mutation(second, List.of(), "update", MutationIntent.of("inspect version batch"))); + f.rejected(() -> f.repository.updateBatchInternal(f.context, List.of(first, second), null, traces), first, second); + } + private static EntityPersistenceMutation mutation(Row row, EntityPersistenceMutation.Action action) { + return new EntityPersistenceMutation(row, action, MutationIntent.of("validate actual provider version lifecycle")); + } + @Test public void providerBatchRejectsEveryOriginalBeforeTransaction() throws Exception { + var f = new Fixture(); var first = f.row(1, 1); var second = f.row(2, Long.MAX_VALUE); + first.updateName("first pending"); second.updateName("second pending"); + var request = new MutationBatchRequest("validate actual provider version lifecycle", List.of( + mutation(first, EntityPersistenceMutation.Action.SAVE), mutation(second, EntityPersistenceMutation.Action.SAVE))); + f.rejected(() -> f.service.mutateBatch(f.context, request), first, second); + } + @Test public void providerSingleRejectsBeforeNativeWriteOrReadback() throws Exception { + var f = new Fixture(); var row = f.row(1, Long.MAX_VALUE); row.updateName("pending"); + f.rejected(() -> f.service.mutate(f.context, mutation(row, EntityPersistenceMutation.Action.SAVE)), row); + } + @Test public void lastUpdateThenDeleteUsesExactLongEndpointsInDatabaseAndReadback() throws Exception { + var f = new Fixture(); var row = f.row(1, Long.MAX_VALUE - 1); row.updateName("final live value"); + var updated = f.service.mutate(f.context, mutation(row, EntityPersistenceMutation.Action.SAVE)); + assertEquals(Long.valueOf(Long.MAX_VALUE), row.getVersion()); assertEquals(Long.MAX_VALUE, f.version(1)); + assertEquals(Long.valueOf(Long.MAX_VALUE), updated.persistedEntity().getVersion()); + row.markForDeletion(); var deleted = f.service.mutate(f.context, mutation(row, EntityPersistenceMutation.Action.DELETE)); + assertEquals(Long.valueOf(Long.MIN_VALUE), row.getVersion()); assertEquals(Long.MIN_VALUE, f.version(1)); + assertEquals(EntityStatus.PERSISTED_DELETED, row.get$status()); + assertEquals(Long.valueOf(Long.MIN_VALUE), deleted.persistedEntity().getVersion()); + row.markAsRecover(); f.rejected(() -> f.service.mutate(f.context, mutation(row, EntityPersistenceMutation.Action.SAVE)), row); + } + @Test public void lastRepresentableRecoveryUsesExactLongReadback() throws Exception { + var f = new Fixture(); var row = f.row(1, Long.MIN_VALUE + 2); row.markAsRecover(); + var recovered = f.service.mutate(f.context, mutation(row, EntityPersistenceMutation.Action.SAVE)); + assertEquals(Long.valueOf(Long.MAX_VALUE), row.getVersion()); assertEquals(Long.MAX_VALUE, f.version(1)); + assertEquals(EntityStatus.PERSISTED, row.get$status()); assertEquals(Long.valueOf(Long.MAX_VALUE), recovered.persistedEntity().getVersion()); + } + @Test public void preparedDeleteAtMaxAndRecoveryToMaxMatchScalarTransitions() throws Exception { + var f = new Fixture(); var first = f.row(1, Long.MAX_VALUE); var second = f.row(2, 1); + first.markForDeletion(); second.markForDeletion(); + var deleted = f.service.mutateBatch(f.context, new MutationBatchRequest("validate actual provider version lifecycle", List.of( + mutation(first, EntityPersistenceMutation.Action.DELETE), mutation(second, EntityPersistenceMutation.Action.DELETE)))); + assertEquals(Long.MIN_VALUE, f.version(1)); assertEquals(-2, f.version(2)); + assertEquals(Long.valueOf(Long.MIN_VALUE), deleted.get(0).persistedEntity().getVersion()); + var recoverable = f.row(3, Long.MIN_VALUE + 2); recoverable.markAsRecover(); second.markAsRecover(); + var recovered = f.service.mutateBatch(f.context, new MutationBatchRequest("validate actual provider version lifecycle", List.of( + mutation(recoverable, EntityPersistenceMutation.Action.SAVE), mutation(second, EntityPersistenceMutation.Action.SAVE)))); + assertEquals(Long.MAX_VALUE, f.version(3)); assertEquals(3, f.version(2)); + assertEquals(Long.valueOf(Long.MAX_VALUE), recovered.get(0).persistedEntity().getVersion()); + } +} diff --git a/teaql-sqlite/pom.xml b/teaql-sqlite/pom.xml index 54a851055..059fdab16 100644 --- a/teaql-sqlite/pom.xml +++ b/teaql-sqlite/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-sqlite teaql-sqlite diff --git a/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDataServiceExecutor.java b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDataServiceExecutor.java index 6b1b3b2bd..2e1aec6cd 100644 --- a/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDataServiceExecutor.java +++ b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDataServiceExecutor.java @@ -21,9 +21,11 @@ public class SqliteDataServiceExecutor extends SqlDataServiceExecutor { System.getLogger(SqliteDataServiceExecutor.class.getName()); private final DataSource dataSource; private boolean soundexInstalled; + private boolean decimalInstalled; public SqliteDataServiceExecutor(String name, SqlExecutionAdapter executionAdapter, DataSource dataSource) { super(name, executionAdapter); + this.dialect = new SqliteDialect(); this.debugDatabaseKind = "sqlite"; this.topNRelationPlanPolicy = io.teaql.core.sql.portable.TopNRelationPlanPolicy.ALWAYS_PROBE; this.dataSource = dataSource; @@ -32,8 +34,13 @@ public SqliteDataServiceExecutor(String name, SqlExecutionAdapter executionAdapt @Override public void ensureSchema(UserContext context, io.teaql.core.SchemaExecutor.Invocation invocation) { io.teaql.core.SchemaExecutor.Invocation.requireContextOwned(invocation); - ensureSoundexOnEveryConnection(); List descriptors = EntityMetaFactory.requireFrom(context).allEntityDescriptors(); + if (descriptors.stream().flatMap(descriptor -> descriptor.getOwnProperties().stream()) + .flatMap(property -> io.teaql.core.sql.portable.SQLPropertyUtil.getColumns(property).stream()) + .anyMatch(this::isExactDecimalColumn)) { + ensureDecimalOnEveryConnection(); + } + ensureSoundexOnEveryConnection(); TeaQLDatabase dbAdapter = new TeaQLDatabase() { @Override @@ -97,8 +104,47 @@ public Optional indexExists( for (EntityDescriptor descriptor : descriptors) { PortableSQLRepository repository = new PortableSQLRepository(descriptor, dbAdapter, null); + repository.setDialect(dialect); repository.ensurePhysicalSchema(context); + for (var property : descriptor.getOwnProperties()) { + for (var column : io.teaql.core.sql.portable.SQLPropertyUtil.getColumns(property)) { + if (isExactDecimalColumn(column)) { + SqliteDecimalSchemaVerifier.verify( + getExecutionAdapter(), column.getTableName(), column.getColumnName()); + } + } + } + } + } + + private boolean isExactDecimalColumn(io.teaql.core.sql.SQLColumn column) { + String mapped = dialect.mapColumnType(column.getType()); + return mapped != null && mapped.toUpperCase(java.util.Locale.ROOT).startsWith("DECIMAL_TEXT"); + } + + private synchronized void ensureDecimalOnEveryConnection() { + if (decimalInstalled) return; + if (getExecutionAdapter() instanceof JdbcSqlExecutor jdbc) { + jdbc.addConnectionInitializer(connection -> { + try { + SqliteDecimalFunctions.register(connection); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Unable to register SQLite exact Decimal functions", failure); + } + }); + } + try { + getExecutionAdapter().queryForList( + "SELECT teaql_decimal_valid('1') AS valid, " + + "'1' = '1' COLLATE TEAQL_DECIMAL AS ordered, " + + "teaql_decimal_sum(value) AS total FROM (SELECT '1' AS value)", + new Object[0]); + } catch (RuntimeException missing) { + throw new IllegalStateException( + "SQLite exact Decimal functions and collation must be registered on every connection", + missing); } + decimalInstalled = true; } private synchronized void ensureSoundexOnEveryConnection() { diff --git a/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDecimalFunctions.java b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDecimalFunctions.java new file mode 100644 index 000000000..1e777b0d7 --- /dev/null +++ b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDecimalFunctions.java @@ -0,0 +1,89 @@ +package io.teaql.core.sqlite; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.SQLException; +import org.sqlite.Collation; +import org.sqlite.Function; +import org.sqlite.core.Codes; + +/** Connection-local exact Decimal primitives for SQLite's text-affinity columns. */ +final class SqliteDecimalFunctions { + + static final String COLLATION = "TEAQL_DECIMAL"; + static final String VALID = "teaql_decimal_valid"; + static final String SUM = "teaql_decimal_sum"; + + private SqliteDecimalFunctions() {} + + private static boolean hasExponent(String text) { + return text != null && (text.indexOf('e') >= 0 || text.indexOf('E') >= 0); + } + + static void register(Connection connection) throws SQLException { + Connection sqlite = connection instanceof org.sqlite.SQLiteConnection + ? connection : connection.unwrap(org.sqlite.SQLiteConnection.class); + Collation.create(sqlite, COLLATION, new Collation() { + @Override + protected int xCompare(String left, String right) { + try { + return new BigDecimal(left).compareTo(new BigDecimal(right)); + } catch (NumberFormatException corruptLegacyValue) { + // A collation cannot report an error. Schema CHECK and row + // decoding reject invalid text at their respective edges. + return left.compareTo(right); + } + } + }); + Function.create(sqlite, VALID, new Function() { + @Override + protected void xFunc() throws SQLException { + if (value_type(0) != Codes.SQLITE_TEXT) { + result(0); + return; + } + String text = value_text(0); + boolean valid; + try { + // Exponent notation is never canonical plain text. Reject it + // before toPlainString(), which could expand a tiny input into + // billions of characters (for example, 1e-1000000000). + valid = text != null && !hasExponent(text) + && new BigDecimal(text).toPlainString().equals(text); + } catch (NumberFormatException invalid) { + valid = false; + } + result(valid ? 1 : 0); + } + }, 1, Function.FLAG_DETERMINISTIC); + Function.create(sqlite, SUM, new Function.Aggregate() { + private BigDecimal total; + + @Override + protected void xStep() throws SQLException { + if (value_type(0) == Codes.SQLITE_NULL) return; + if (value_type(0) != Codes.SQLITE_TEXT) { + error("invalid decimal storage type"); + return; + } + String text = value_text(0); + if (hasExponent(text)) { + error("invalid decimal text"); + return; + } + try { + BigDecimal value = new BigDecimal(text); + total = total == null ? value : total.add(value); + } catch (NumberFormatException invalid) { + error("invalid decimal text"); + } + } + + @Override + protected void xFinal() throws SQLException { + if (total == null) result(); + else result(total.toPlainString()); + } + }, 1); + } +} diff --git a/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDecimalSchemaVerifier.java b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDecimalSchemaVerifier.java new file mode 100644 index 000000000..738eb9156 --- /dev/null +++ b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDecimalSchemaVerifier.java @@ -0,0 +1,136 @@ +package io.teaql.core.sqlite; + +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** Fail closed when an existing Decimal column lacks TeaQL's exact semantics. */ +final class SqliteDecimalSchemaVerifier { + + private SqliteDecimalSchemaVerifier() {} + + static void verify(SqlExecutionAdapter adapter, String table, String column) { + List> schema = adapter.queryForList( + "SELECT sql FROM sqlite_master WHERE type='table' AND name=?", + new Object[] {table}); + if (schema.size() != 1) throw incompatible(table, column, "table definition is missing"); + String ddl = String.valueOf(value(schema.get(0), "sql")); + String expected = column.toLowerCase(Locale.ROOT); + List check = List.of("check", "(", expected, "is", "null", "or", + SqliteDecimalFunctions.VALID, "(", expected, ")", ")"); + boolean validated = columns(ddl).stream().anyMatch(tokens -> tokens.size() > 2 + && expected.equals(tokens.get(0)) && "decimal_text".equals(tokens.get(1)) + && hasStandaloneCheck(tokens, check)); + if (!validated) throw incompatible(table, column, "required Decimal CHECK is missing"); + + List> program = adapter.queryForList( + "EXPLAIN SELECT 1 FROM " + quote(table) + " NOT INDEXED WHERE " + + quote(column) + " = ?", new Object[] {"0"}); + boolean collated = program.stream().anyMatch(row -> { + String opcode = String.valueOf(value(row, "opcode")); + Object p4 = value(row, "p4"); + return ("Eq".equals(opcode) || "Ne".equals(opcode)) + && p4 != null && String.valueOf(p4).startsWith(SqliteDecimalFunctions.COLLATION); + }); + if (!collated) throw incompatible(table, column, "TEAQL_DECIMAL collation is missing"); + } + + private static IllegalStateException incompatible(String table, String column, String reason) { + return new IllegalStateException("Ensure Schema incompatible exact Decimal column '" + + column + "' on table '" + table + "': " + reason + + "; migrate the column explicitly before retrying"); + } + + private static String quote(String identifier) { + return "\"" + identifier.replace("\"", "\"\"") + "\""; + } + + private static Object value(Map row, String name) { + for (Map.Entry entry : row.entrySet()) { + if (name.equalsIgnoreCase(entry.getKey())) return entry.getValue(); + } + return null; + } + + private static boolean hasStandaloneCheck(List tokens, List check) { + int depth = 0; + for (int index = 0; index < tokens.size(); index++) { + if (depth == 0 && "check".equals(tokens.get(index)) + && index + check.size() <= tokens.size() + && tokens.subList(index, index + check.size()).equals(check)) return true; + if ("(".equals(tokens.get(index))) depth++; + else if (")".equals(tokens.get(index))) depth--; + } + return false; + } + + private static List> columns(String ddl) { + List tokens = tokens(ddl); + int opening = tokens.indexOf("("); + if (opening < 0) return List.of(); + List> columns = new ArrayList<>(); + List current = new ArrayList<>(); + int depth = 1; + for (int index = opening + 1; index < tokens.size(); index++) { + String token = tokens.get(index); + if ("(".equals(token)) depth++; + else if (")".equals(token) && --depth == 0) { + columns.add(current); + break; + } else if (",".equals(token) && depth == 1) { + columns.add(current); + current = new ArrayList<>(); + continue; + } + current.add(token); + } + return columns; + } + + private static List tokens(String sql) { + List tokens = new ArrayList<>(); + for (int offset = 0; offset < sql.length();) { + char current = sql.charAt(offset); + if (Character.isWhitespace(current)) { + offset++; + } else if (current == '-' && offset + 1 < sql.length() && sql.charAt(offset + 1) == '-') { + offset += 2; + while (offset < sql.length() && sql.charAt(offset) != '\n') offset++; + } else if (current == '/' && offset + 1 < sql.length() && sql.charAt(offset + 1) == '*') { + offset += 2; + while (offset + 1 < sql.length() + && !(sql.charAt(offset) == '*' && sql.charAt(offset + 1) == '/')) offset++; + offset = Math.min(sql.length(), offset + 2); + } else if (current == '\'' || current == '"' || current == '`' || current == '[') { + char close = current == '[' ? ']' : current; + offset++; + StringBuilder content = new StringBuilder(); + while (offset < sql.length()) { + char next = sql.charAt(offset++); + if (next == close) { + if (offset < sql.length() && sql.charAt(offset) == close) { + content.append(close); + offset++; + } else break; + } else content.append(next); + } + tokens.add(current == '\'' ? "" + : content.toString().toLowerCase(Locale.ROOT)); + } else if (Character.isLetterOrDigit(current) || current == '_' || current == '$') { + int start = offset++; + while (offset < sql.length()) { + char next = sql.charAt(offset); + if (!(Character.isLetterOrDigit(next) || next == '_' || next == '$')) break; + offset++; + } + tokens.add(sql.substring(start, offset).toLowerCase(Locale.ROOT)); + } else { + tokens.add(String.valueOf(current)); + offset++; + } + } + return tokens; + } +} diff --git a/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDialect.java b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDialect.java new file mode 100644 index 000000000..a6bf58c95 --- /dev/null +++ b/teaql-sqlite/src/main/java/io/teaql/core/sqlite/SqliteDialect.java @@ -0,0 +1,60 @@ +package io.teaql.core.sqlite; + +import java.math.BigDecimal; +import java.math.BigInteger; +import io.teaql.core.sql.SQLColumn; +import io.teaql.core.AggrFunction; +import io.teaql.core.sql.dialect.PostgreSqlDialect; +import java.util.Locale; + +/** SQLite-specific physical Decimal storage; ordinary SQL remains portable. */ +final class SqliteDialect extends PostgreSqlDialect { + + @Override + public String mapColumnType(String type) { + String mapped = super.mapColumnType(type); + if (mapped == null) return null; + String normalized = mapped.trim().toUpperCase(Locale.ROOT); + for (String family : new String[] {"DECIMAL", "NUMERIC"}) { + if (normalized.equals(family) || normalized.startsWith(family + "(")) { + return "DECIMAL_TEXT" + mapped.trim().substring(family.length()); + } + } + return mapped; + } + + @Override + public String columnTypeAndConstraintsSql(SQLColumn column) { + String type = mapColumnType(column.getType()); + if (type == null) return null; + if (!type.toUpperCase(Locale.ROOT).startsWith("DECIMAL_TEXT")) return type; + String name = escapeIdentifier(column.getColumnName()); + return type + " COLLATE " + SqliteDecimalFunctions.COLLATION + + " CHECK (" + name + " IS NULL OR " + SqliteDecimalFunctions.VALID + + "(" + name + "))"; + } + + @Override + public String decimalAggregateSql(AggrFunction function, String columnSql, boolean directColumn) { + if (!directColumn) { + throw new IllegalArgumentException( + "SQLite exact Decimal aggregation requires a direct Decimal column"); + } + return switch (function) { + case SUM -> SqliteDecimalFunctions.SUM + "(" + columnSql + ")"; + case SELF, MIN, MAX, COUNT -> null; + default -> throw new IllegalArgumentException( + "SQLite exact Decimal aggregate is unsupported: " + function); + }; + } + + @Override + public Object decodeDecimalAggregate(Object value) { + if (value == null || value instanceof BigDecimal) return value; + if (value instanceof CharSequence text) return new BigDecimal(text.toString()); + if (value instanceof BigInteger || value instanceof Long || value instanceof Integer) { + return new BigDecimal(value.toString()); + } + throw new IllegalArgumentException("SQLite exact Decimal aggregate returned an inexact value"); + } +} diff --git a/teaql-sqlite/src/test/java/io/teaql/core/sqlite/SqliteDecimalFunctionsTest.java b/teaql-sqlite/src/test/java/io/teaql/core/sqlite/SqliteDecimalFunctionsTest.java new file mode 100644 index 000000000..000018d2a --- /dev/null +++ b/teaql-sqlite/src/test/java/io/teaql/core/sqlite/SqliteDecimalFunctionsTest.java @@ -0,0 +1,303 @@ +package io.teaql.core.sqlite; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + +import io.teaql.core.BaseEntity; +import io.teaql.core.BaseRequest; +import io.teaql.core.criteria.Operator; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.GenericSQLProperty; +import io.teaql.core.sql.SQLEntityDescriptor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Statement; +import java.nio.file.Files; +import java.nio.file.Path; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; + +public class SqliteDecimalFunctionsTest { + + @Test + public void virtualColumnsWithoutPhysicalTypeRemainUnmapped() { + assertNull(new SqliteDialect().mapColumnType(null)); + } + + public static class DecimalRow extends BaseEntity { + private BigDecimal amount; + + @Override public String typeName() { return "DecimalRow"; } + + @Override public void __internalSet(String property, Object value) { + if ("amount".equals(property)) amount = (BigDecimal) value; + else super.__internalSet(property, value); + } + + @Override public Object __internalGet(String property) { + return "amount".equals(property) ? amount : super.__internalGet(property); + } + } + + public static class DecimalRequest extends BaseRequest { + public DecimalRequest() { super(DecimalRow.class); } + @Override public String getTypeName() { return "DecimalRow"; } + public DecimalRequest comment(String comment) { + super.internalComment(comment); + return this; + } + + public DecimalRequest amountIs(BigDecimal amount) { + appendSearchCriteria(createBasicSearchCriteria("amount", Operator.EQUAL, amount)); + return this; + } + } + + @Test + public void exactStorageComparisonAndSumSurviveJdbcDecimalBinding() throws Exception { + try (Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:")) { + SqliteDecimalFunctions.register(connection); + SqliteDecimalFunctions.register(connection); + try (Statement statement = connection.createStatement()) { + statement.execute("CREATE TABLE amounts (value DECIMAL_TEXT COLLATE TEAQL_DECIMAL " + + "CHECK (value IS NULL OR teaql_decimal_valid(value)))"); + } + for (String value : new String[] {"3.50", "2", "10", "123456789012.3456789", "-0.1"}) { + try (PreparedStatement statement = connection.prepareStatement( + "INSERT INTO amounts (value) VALUES (?)")) { + statement.setBigDecimal(1, new BigDecimal(value)); + statement.executeUpdate(); + } + } + try (Statement statement = connection.createStatement(); + ResultSet rows = statement.executeQuery( + "SELECT typeof(value), value FROM amounts ORDER BY value LIMIT 1")) { + rows.next(); + assertEquals("text", rows.getString(1)); + assertEquals("-0.1", rows.getString(2)); + } + try (Statement statement = connection.createStatement(); + ResultSet rows = statement.executeQuery( + "SELECT value FROM amounts WHERE value = '3.5'")) { + rows.next(); + assertEquals("3.50", rows.getString(1)); + } + try (Statement statement = connection.createStatement(); + ResultSet rows = statement.executeQuery( + "SELECT teaql_decimal_sum(value), typeof(sum(value)) FROM amounts")) { + rows.next(); + assertEquals("123456789027.7456789", rows.getString(1)); + assertEquals("real", rows.getString(2)); + } + try (Statement statement = connection.createStatement()) { + assertThrows(java.sql.SQLException.class, + () -> statement.executeUpdate("INSERT INTO amounts (value) VALUES ('not-a-decimal')")); + assertThrows(java.sql.SQLException.class, + () -> statement.executeUpdate("INSERT INTO amounts (value) VALUES (X'31')")); + assertThrows(java.sql.SQLException.class, + () -> statement.executeUpdate( + "INSERT INTO amounts (value) VALUES ('1e-1000000000')")); + } + } + } + + @Test + public void exponentTextCannotAmplifyDecimalValidationOrAggregation() throws Exception { + try (Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:")) { + SqliteDecimalFunctions.register(connection); + try (Statement statement = connection.createStatement(); + ResultSet rows = statement.executeQuery( + "SELECT teaql_decimal_valid('1e-1000000000'), " + + "teaql_decimal_valid('1E+1000000000'), " + + "teaql_decimal_valid('0.0000001')")) { + assertTrue(rows.next()); + assertEquals(0, rows.getInt(1)); + assertEquals(0, rows.getInt(2)); + assertEquals(1, rows.getInt(3)); + } + try (Statement statement = connection.createStatement()) { + assertThrows(java.sql.SQLException.class, + () -> statement.executeQuery( + "SELECT teaql_decimal_sum('1e-1000000000')")); + } + } + } + + @Test + public void contextEnsureSchemaCreatesExactDecimalStorageAndRepeats() throws Exception { + Path file = Files.createTempFile("teaql-java-exact-decimal-", ".db"); + try { + SQLiteDataSource dataSource = new SQLiteDataSource(); + dataSource.setUrl("jdbc:sqlite:" + file); + JdbcSqlExecutor jdbc = new JdbcSqlExecutor(dataSource); + SqliteDataServiceExecutor provider = new SqliteDataServiceExecutor( + "sqlite", jdbc, dataSource); + SQLEntityDescriptor entity = new SQLEntityDescriptor(); + entity.setType("DecimalRow"); + entity.setTargetType(DecimalRow.class); + entity.setEntitySupplier(DecimalRow::new); + entity.setDataService("sqlite"); + ((GenericSQLProperty) entity.addSimpleProperty("id", Long.class)) + .setColumnType("BIGINT"); + ((GenericSQLProperty) entity.addSimpleProperty("version", Long.class)) + .setColumnType("BIGINT"); + ((GenericSQLProperty) entity.addSimpleProperty("bucket", String.class)) + .setColumnType("VARCHAR(20)"); + ((GenericSQLProperty) entity.addSimpleProperty("amount", BigDecimal.class)) + .setColumnType("NUMERIC(19,7)"); + SimpleEntityMetaFactory metadata = new SimpleEntityMetaFactory(); + metadata.register(entity); + DefaultUserContext context = new DefaultUserContext(TeaQLRuntime.builder() + .metadata(metadata).dataService("sqlite", provider).build()); + + context.ensureSchema(); + context.ensureSchema(); + String ddl = String.valueOf(jdbc.queryForList( + "SELECT sql FROM sqlite_master WHERE type='table' AND name='decimal_row_data'", + new Object[0]).get(0).get("sql")); + assertTrue(ddl, ddl.contains("DECIMAL_TEXT(19,7) COLLATE TEAQL_DECIMAL")); + assertTrue(ddl, ddl.contains("CHECK (amount IS NULL OR teaql_decimal_valid(amount))")); + jdbc.update("INSERT INTO decimal_row_data (id, version, bucket, amount) VALUES (?, ?, ?, ?)", + new Object[] {1L, 1L, "A", new BigDecimal("3.50")}); + assertEquals("3.50", jdbc.queryForList( + "SELECT amount FROM decimal_row_data WHERE amount = ?", new Object[] { + new BigDecimal("3.5")}).get(0).get("amount")); + DecimalRequest query = new DecimalRequest(); + query.sum("total", "amount"); + Object total = query.comment("calculate exact order amount") + .purpose("verify modeled Q aggregation") + .aggregation(context).getData().get(0).getValues().values().iterator().next(); + assertEquals(new BigDecimal("3.50"), total); + + jdbc.update("INSERT INTO decimal_row_data (id, version, bucket, amount) VALUES (?, ?, ?, ?)", + new Object[] {2L, 1L, "A", new BigDecimal("10.25")}); + jdbc.update("INSERT INTO decimal_row_data (id, version, bucket, amount) VALUES (?, ?, ?, ?)", + new Object[] {3L, 1L, "B", new BigDecimal("123456789012.3456789")}); + DecimalRequest selected = new DecimalRequest(); + for (String property : new String[] {"id", "version", "amount"}) { + selected.selectProperty(property); + } + var loaded = selected.amountIs(new BigDecimal("3.5")) + .comment("load exact Decimal row") + .purpose("verify typed Q and E Decimal hydration") + .executeForList(context); + assertEquals(1, loaded.size()); + assertEquals(new BigDecimal("3.50"), loaded.get(0).getProperty("amount")); + + DecimalRequest grouped = new DecimalRequest(); + grouped.groupBy("bucket"); + grouped.sum("total", "amount"); + grouped.min("smallest", "amount"); + grouped.max("largest", "amount"); + grouped.countProperty("items", "amount"); + var rows = grouped.comment("aggregate exact Decimal buckets") + .purpose("verify grouped monetary totals").aggregation(context).toList(); + assertEquals(2, rows.size()); + var first = rows.stream().filter(row -> "A".equals(row.get("bucket"))).findFirst().orElseThrow(); + assertEquals(new BigDecimal("13.75"), first.get("total")); + assertEquals(new BigDecimal("3.50"), first.get("smallest")); + assertEquals(new BigDecimal("10.25"), first.get("largest")); + assertEquals(2L, ((Number) first.get("items")).longValue()); + var second = rows.stream().filter(row -> "B".equals(row.get("bucket"))).findFirst().orElseThrow(); + assertEquals(new BigDecimal("123456789012.3456789"), second.get("total")); + + DecimalRequest unsupported = new DecimalRequest(); + unsupported.avg("average", "amount"); + assertThrows(IllegalArgumentException.class, () -> unsupported + .comment("reject approximate Decimal average") + .purpose("prevent silent financial rounding").aggregation(context)); + + for (String value : new String[] {"1E-7", "1E+8"}) { + jdbc.update("INSERT INTO decimal_row_data (id, version, bucket, amount) VALUES (?, ?, ?, ?)", + new Object[] {value.equals("1E-7") ? 4L : 5L, 1L, "C", new BigDecimal(value)}); + var matched = jdbc.queryForList( + "SELECT amount FROM decimal_row_data WHERE amount = ?", + new Object[] {new BigDecimal(value)}); + assertEquals(1, matched.size()); + assertEquals(new BigDecimal(value).toPlainString(), matched.get(0).get("amount")); + } + } finally { + Files.deleteIfExists(file); + } + } + + @Test + public void existingDecimalTablesWithoutTheFullContractFailClosed() throws Exception { + String[] invalidDefinitions = { + "amount NUMERIC(19,7)", + "amount DECIMAL_TEXT COLLATE TEAQL_DECIMAL", + "amount DECIMAL_TEXT CHECK (amount IS NULL OR teaql_decimal_valid(amount))", + "amount DECIMAL_TEXT COLLATE TEAQL_DECIMAL " + + "DEFAULT 'CHECK (amount IS NULL OR teaql_decimal_valid(amount))'", + "amount DECIMAL_TEXT COLLATE TEAQL_DECIMAL " + + "/* CHECK (amount IS NULL OR teaql_decimal_valid(amount)) */" + }; + for (String definition : invalidDefinitions) { + Path file = Files.createTempFile("teaql-java-decimal-legacy-", ".db"); + try { + SQLiteDataSource dataSource = new SQLiteDataSource(); + dataSource.setUrl("jdbc:sqlite:" + file); + JdbcSqlExecutor jdbc = new JdbcSqlExecutor(dataSource); + jdbc.addConnectionInitializer(connection -> { + try { + SqliteDecimalFunctions.register(connection); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException(failure); + } + }); + jdbc.execute("CREATE TABLE amounts (" + definition + ")"); + IllegalStateException failure = assertThrows(IllegalStateException.class, + () -> SqliteDecimalSchemaVerifier.verify(jdbc, "amounts", "amount")); + assertTrue(failure.getMessage(), failure.getMessage().contains("incompatible exact Decimal")); + } finally { + Files.deleteIfExists(file); + } + } + } + + @Test + public void contextEnsureSchemaDoesNotAdoptLegacyNumericStorage() throws Exception { + Path file = Files.createTempFile("teaql-java-decimal-context-legacy-", ".db"); + try { + SQLiteDataSource dataSource = new SQLiteDataSource(); + dataSource.setUrl("jdbc:sqlite:" + file); + JdbcSqlExecutor jdbc = new JdbcSqlExecutor(dataSource); + String ddl = "CREATE TABLE decimal_row_data (id BIGINT NOT NULL PRIMARY KEY, " + + "version BIGINT, bucket VARCHAR(20), amount NUMERIC(19,7))"; + jdbc.execute(ddl); + + SQLEntityDescriptor entity = new SQLEntityDescriptor(); + entity.setType("DecimalRow"); + entity.setTargetType(DecimalRow.class); + entity.setEntitySupplier(DecimalRow::new); + entity.setDataService("sqlite"); + ((GenericSQLProperty) entity.addSimpleProperty("id", Long.class)).setColumnType("BIGINT"); + ((GenericSQLProperty) entity.addSimpleProperty("version", Long.class)).setColumnType("BIGINT"); + ((GenericSQLProperty) entity.addSimpleProperty("bucket", String.class)) + .setColumnType("VARCHAR(20)"); + ((GenericSQLProperty) entity.addSimpleProperty("amount", BigDecimal.class)) + .setColumnType("NUMERIC(19,7)"); + SimpleEntityMetaFactory metadata = new SimpleEntityMetaFactory(); + metadata.register(entity); + DefaultUserContext context = new DefaultUserContext(TeaQLRuntime.builder() + .metadata(metadata) + .dataService("sqlite", new SqliteDataServiceExecutor("sqlite", jdbc, dataSource)) + .build()); + + assertThrows(RuntimeException.class, context::ensureSchema); + assertEquals(ddl, jdbc.queryForList( + "SELECT sql FROM sqlite_master WHERE type='table' AND name='decimal_row_data'", + new Object[0]).get(0).get("sql")); + } finally { + Files.deleteIfExists(file); + } + } +} diff --git a/teaql-sqlite/src/test/java/io/teaql/sqlite/DerivedQueryTraceSqliteTest.java b/teaql-sqlite/src/test/java/io/teaql/sqlite/DerivedQueryTraceSqliteTest.java index 922cc5005..4427c9b31 100644 --- a/teaql-sqlite/src/test/java/io/teaql/sqlite/DerivedQueryTraceSqliteTest.java +++ b/teaql-sqlite/src/test/java/io/teaql/sqlite/DerivedQueryTraceSqliteTest.java @@ -258,6 +258,151 @@ private static List businessComments(ExecutionMetadata entry) { } } + /** #271: a scalar relation aggregate is not necessarily COUNT. */ + @Test public void emptyAggregateBucketsKeepCountZeroButSumNull() throws Exception { + for (boolean logging : List.of(false, true)) { + try (var fixture = new Fixture(logging)) { + // All-null bucket, genuine zero bucket and absent bucket must differ. + for (long id : List.of(101L, 102L, 201L)) { + var line = fixture.context.getRuntime().executeForList(fixture.context, + fixture.lines().where("id", Operator.EQUAL, id) + .intent("load aggregate operand", "prepare null and zero controls")).get(0); + line.updateProperty("documentNumber", id == 201L ? 0L : null); + line.auditAs("prepare nullable aggregate operand").save(fixture.context); + } + var empty = fixture.create(new TraceDocument(), 300, "Document without lines"); + empty.auditAs("prepare absent aggregate bucket").save(fixture.context); + + for (boolean facet : List.of(false, true)) { + fixture.sql.clear(); fixture.returnedQueries.clear(); + var sum = fixture.lines(); sum.sum("amount", "documentNumber"); + sum.setPartitionProperty("document"); + var count = fixture.lines(); count.count("count"); count.setPartitionProperty("document"); + var owners = fixture.documents(); owners.setSize(10); + owners.addSingleAggregateDynamicProperty("lineSum", sum); + owners.addSingleAggregateDynamicProperty("lineCount", count); + var request = facet ? fixture.lines() : owners; + if (facet) request.addFacet("documents", "document", owners, true); + request.intent("inspect empty aggregates", "distinguish no contribution from numeric zero"); + var result = fixture.context.getRuntime().executeForList(fixture.context, request); + var rows = facet ? result.getFacet("documents") : result; + assertEquals(3, rows.size()); + for (Object value : rows) { + var row = (Entity) value; + long id = row.getId(); + assertTrue("selected null is a present property", ((BaseEntity) row).hasDynamicProperty("lineSum")); + if (id == 200) assertEquals(0L, ((Number) row.getDynamicProperty("lineSum")).longValue()); + else assertNull("all-null and absent buckets must not invent a sum", row.getDynamicProperty("lineSum")); + assertEquals(id == 100 ? 2L : id == 200 ? 1L : 0L, + ((Number) row.getDynamicProperty("lineCount")).longValue()); + } + assertTrue(fixture.context.getTraceChain().isEmpty()); + // Facet count + root + value enumeration + SUM + related COUNT. + int statements = facet ? 5 : 3; + assertEquals(logging ? statements : 0, fixture.sql.size()); + System.out.println("EMPTY_AGGREGATE_BUCKET_PASS facet=" + facet + " logging=" + logging); + } + } + } + } + + @Test public void emptyMinimumBucketsKeepNullForRelationsAndFacets() throws Exception { + assertNullableStatisticBuckets(AggrFunction.MIN); + } + + @Test public void emptyMaximumBucketsKeepNullForRelationsAndFacets() throws Exception { + assertNullableStatisticBuckets(AggrFunction.MAX); + } + + @Test public void emptyAverageBucketsKeepNullForRelationsAndFacets() throws Exception { + assertNullableStatisticBuckets(AggrFunction.AVG); + } + + private static void assertNullableStatisticBuckets(AggrFunction function) throws Exception { + for (boolean logging : List.of(false, true)) { + try (var fixture = new Fixture(logging)) { + // Mixed null/value, genuine zero, absent and all-null buckets. + for (long id : List.of(101L, 102L, 201L)) { + var line = fixture.context.getRuntime().executeForList(fixture.context, + fixture.lines().where("id", Operator.EQUAL, id) + .intent("prepare a statistic operand", "distinguish null and numeric zero")).get(0); + line.updateProperty("documentNumber", id == 101L ? null : id == 102L ? 8L : 0L); + line.auditAs("prepare statistic operand").save(fixture.context); + } + var empty = fixture.create(new TraceDocument(), 300, "Absent statistic bucket"); + empty.auditAs("prepare absent statistic bucket").save(fixture.context); + var allNull = fixture.create(new TraceDocument(), 400, "All-null statistic bucket"); + allNull.auditAs("prepare all-null statistic bucket").save(fixture.context); + var nullLine = fixture.create(new TraceLine(), 401, "Null statistic operand"); + nullLine.updateProperty("document", allNull); + nullLine.updateProperty("state", "OPEN"); + nullLine.updateProperty("documentNumber", null); + nullLine.auditAs("prepare null statistic operand").save(fixture.context); + + for (boolean facet : List.of(false, true)) { + fixture.sql.clear(); fixture.returnedQueries.clear(); + var metric = fixture.lines(); + switch (function) { + case MIN -> metric.min("metric", "documentNumber"); + case MAX -> metric.max("metric", "documentNumber"); + case AVG -> metric.avg("metric", "documentNumber"); + default -> throw new AssertionError("unexpected statistic"); + } + metric.setPartitionProperty("document"); + var count = fixture.lines(); count.count("count"); count.setPartitionProperty("document"); + var owners = fixture.documents(); owners.setSize(10); + owners.addSingleAggregateDynamicProperty("metric", metric); + owners.addSingleAggregateDynamicProperty("lineCount", count); + var request = facet ? fixture.lines() : owners; + if (facet) request.addFacet("documents", "document", owners, true); + request.intent("inspect nullable statistics", "preserve empty, null and zero independently"); + var result = fixture.context.getRuntime().executeForList(fixture.context, request); + var rows = facet ? result.getFacet("documents") : result; + assertEquals(4, rows.size()); + for (Object item : rows) { + var row = (BaseEntity) item; + assertTrue("selected null statistic is present", row.hasDynamicProperty("metric")); + Number value = row.getDynamicProperty("metric"); + if (row.getId() == 100L) assertEquals(8.0, value.doubleValue(), 0.0); + else if (row.getId() == 200L) assertEquals(0.0, value.doubleValue(), 0.0); + else assertNull("absent and all-null statistics must not become zero", value); + assertEquals(row.getId() == 100L ? 2L : row.getId() == 300L ? 0L : 1L, + ((Number) row.getDynamicProperty("lineCount")).longValue()); + } + assertEquals(logging ? facet ? 5 : 3 : 0, fixture.sql.size()); + assertTrue(fixture.context.getTraceChain().isEmpty()); + assertEquals(1, metric.getAggregations().getAggregates().size()); + assertNull(metric.comment()); + System.out.printf("EMPTY_STATISTIC_BUCKET_PASS function=%s facet=%s logging=%s buckets=4%n", function, facet, logging); + } + } + } + } + + @Test public void emptyAggregateDirectSqlDistinguishesAbsentGroupFromNullSum() throws Exception { + try (var fixture = new Fixture(false)) { + var query = fixture.lines().where("id", Operator.EQUAL, -1L) + .intent("calculate empty aggregate", "verify scalar and grouped SQL semantics"); + query.count("count"); query.sum("sum", "documentNumber"); + var result = (DefaultQueryResult) fixture.provider.query(fixture.context, new DefaultQueryRequest(query)); + var rows = result.getAggregationResult().toList(); + assertEquals(1, rows.size()); assertTrue(rows.get(0).containsKey("sum")); + assertNull(rows.get(0).get("sum")); assertEquals(0L, ((Number) rows.get(0).get("count")).longValue()); + // Explicit defaulting must not rewrite the underlying nullable result. + var onlySum = fixture.lines().where("id", Operator.EQUAL, -1L) + .intent("read nullable sum", "verify explicit caller fallback"); + onlySum.sum("sum", "documentNumber"); + var nullable = (DefaultQueryResult) fixture.provider.query(fixture.context, new DefaultQueryRequest(onlySum)); + assertNull(nullable.getAggregationResult().toNumber(null)); + assertEquals(0L, nullable.getAggregationResult().toNumber(0L).longValue()); + assertNull(nullable.getAggregationResult().toList().get(0).get("sum")); + query.groupBy("state"); + var grouped = (DefaultQueryResult) fixture.provider.query(fixture.context, new DefaultQueryRequest(query)); + assertTrue(grouped.getAggregationResult().toList().isEmpty()); + System.out.println("EMPTY_AGGREGATE_DIRECT_PASS"); + } + } + @Test public void idSetDiscoveryOwnsHelperAndRetainedPagesDoNotInventCountSql() throws Exception { for (boolean logging : List.of(true, false)) { var fixture = new Fixture(logging); @@ -379,7 +524,8 @@ Request intent(String comment, String purpose) { } } - private static final class Fixture { + private static final class Fixture implements AutoCloseable { + final java.nio.file.Path databaseFile; final List sql = new CopyOnWriteArrayList<>(); final List returnedQueries = new CopyOnWriteArrayList<>(); final List> receivedChains = new CopyOnWriteArrayList<>(); @@ -396,7 +542,8 @@ private static final class Fixture { } Fixture(boolean logging, Function driverFactory, boolean nestedPeers) throws Exception { var source = new SQLiteDataSource(); - source.setUrl("jdbc:sqlite:" + Files.createTempFile("teaql-derived-trace-", ".db")); + databaseFile = Files.createTempFile("teaql-derived-trace-", ".db"); + source.setUrl("jdbc:sqlite:" + databaseFile); var documents = descriptor(TraceDocument.class,TraceDocument::new); var lines = descriptor(TraceLine.class,TraceLine::new); var state = (GenericSQLProperty) lines.addSimpleProperty("state",String.class); @@ -468,6 +615,9 @@ Request withOpenCount() { count.setPartitionProperty("document"); count.count("count"); var root = documents(); root.addSingleAggregateDynamicProperty("openLineCount",count); return root; } + @Override public void close() throws Exception { + Files.deleteIfExists(databaseFile); + } } @Test public void loadedCollectionFacetsRetainPerParentMembershipCountsAndRequestedEmpty() throws Exception { diff --git a/teaql-tfp-endpoint/pom.xml b/teaql-tfp-endpoint/pom.xml index 15c02fd98..d97d4e474 100644 --- a/teaql-tfp-endpoint/pom.xml +++ b/teaql-tfp-endpoint/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-tfp-endpoint/src/main/java/io/teaql/tfp/WireFieldAdapter.java b/teaql-tfp-endpoint/src/main/java/io/teaql/tfp/WireFieldAdapter.java index fc6ef961c..56c22f30e 100644 --- a/teaql-tfp-endpoint/src/main/java/io/teaql/tfp/WireFieldAdapter.java +++ b/teaql-tfp-endpoint/src/main/java/io/teaql/tfp/WireFieldAdapter.java @@ -48,7 +48,9 @@ public static ObjectNode encode(ObjectNode canonical, WireEntityMetadata metadat public static void retainSubmittedPaths(Iterable results, NormalizedWireObject normalized) { for (CheckResult result : results) { - if (result.getLocation() == null || result.getLocation().segments().isEmpty()) continue; + // This map covers one object, not the descendants already prefixed + // into a graph result. A parent alias is not a leaf source pointer. + if (result.getLocation() == null || result.getLocation().segments().size() != 1) continue; WireLocationSegment first = result.getLocation().segments().get(0); if (!"property".equals(first.kind())) continue; String path = normalized.sourceInstancePaths().get(first.name()); diff --git a/teaql-tfp-endpoint/src/test/java/io/teaql/tfp/WireFieldAdapterTest.java b/teaql-tfp-endpoint/src/test/java/io/teaql/tfp/WireFieldAdapterTest.java index 8c6c3c140..68ad63a04 100644 --- a/teaql-tfp-endpoint/src/test/java/io/teaql/tfp/WireFieldAdapterTest.java +++ b/teaql-tfp-endpoint/src/test/java/io/teaql/tfp/WireFieldAdapterTest.java @@ -58,4 +58,22 @@ public void serializesCanonicalLocationAndSelectedWirePath() throws Exception { assertEquals("/schoolType", wire.path("instancePath").asText()); assertEquals("/legacySchoolType", wire.path("sourceInstancePath").asText()); } + + @Test + public void parentAliasNeverTruncatesDescendantProvenance() { + NormalizedWireObject normalized = new NormalizedWireObject(json.createObjectNode(), + Map.of("order_item_list", "/legacy~1items", "product_name", "/legacy~0name")); + ObjectLocation location = ObjectLocation.hashRoot("order_item_list").element(2).member("product_name"); + CheckResult nested = CheckResult.required(location); + nested.setSourceInstancePath("/legacy~1items/2/legacy~0name"); + CheckResult absent = CheckResult.required(location); + CheckResult indexed = CheckResult.required(ObjectLocation.hashRoot("product_name").element(2)); + CheckResult direct = CheckResult.required(ObjectLocation.hashRoot("order_item_list")); + WireFieldAdapter.retainSubmittedPaths(java.util.List.of(nested, absent, indexed, direct), normalized); + assertEquals("/legacy~1items/2/legacy~0name", nested.getSourceInstancePath()); + assertEquals("/orderItemList/2/productName", nested.toWire(JsonFieldNamingProfile.CAMEL_CASE).instancePath()); + assertEquals(null, absent.getSourceInstancePath()); + assertEquals(null, indexed.getSourceInstancePath()); + assertEquals("/legacy~1items", direct.getSourceInstancePath()); + } } diff --git a/teaql-tool-http/pom.xml b/teaql-tool-http/pom.xml index cf46b995c..182dae09c 100644 --- a/teaql-tool-http/pom.xml +++ b/teaql-tool-http/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-tool-http diff --git a/teaql-tool-http/src/main/java/io/teaql/tools/http/HttpServiceProfile.java b/teaql-tool-http/src/main/java/io/teaql/tools/http/HttpServiceProfile.java index 00e6da37b..6eb81c794 100644 --- a/teaql-tool-http/src/main/java/io/teaql/tools/http/HttpServiceProfile.java +++ b/teaql-tool-http/src/main/java/io/teaql/tools/http/HttpServiceProfile.java @@ -1,9 +1,15 @@ package io.teaql.tools.http; import io.teaql.core.http.HttpRequestService; +import java.io.ByteArrayInputStream; import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; import java.time.Duration; +import java.util.ArrayList; import java.util.EnumSet; +import java.util.List; import java.util.Objects; import java.util.Set; @@ -11,6 +17,7 @@ public final class HttpServiceProfile { private final String alias; private final URI baseUri; + private final List trustedRoots; private final Duration connectTimeout; private final Duration requestTimeout; private final Duration totalTimeout; @@ -26,6 +33,7 @@ public final class HttpServiceProfile { private HttpServiceProfile(Builder b) { this.alias = b.alias; this.baseUri = b.baseUri; + this.trustedRoots = b.trustedRoots; this.connectTimeout = b.connectTimeout; this.requestTimeout = b.requestTimeout; this.totalTimeout = b.totalTimeout; @@ -42,6 +50,7 @@ private HttpServiceProfile(Builder b) { public static Builder builder(String alias, URI baseUri) { return new Builder(alias, baseUri); } public String alias() { return alias; } public URI baseUri() { return baseUri; } + List trustedRoots() { return trustedRoots; } public Duration connectTimeout() { return connectTimeout; } public Duration requestTimeout() { return requestTimeout; } public Duration totalTimeout() { return totalTimeout; } @@ -58,6 +67,7 @@ private HttpServiceProfile(Builder b) { public static final class Builder { private final String alias; private final URI baseUri; + private List trustedRoots = List.of(); private Duration connectTimeout = Duration.ofSeconds(2); private Duration requestTimeout = Duration.ofSeconds(5); private Duration totalTimeout = Duration.ofSeconds(10); @@ -94,6 +104,61 @@ public Builder budgets(Duration connect, Duration request, Duration total) { return this; } public Builder maxResponseBytes(int bytes) { this.maxResponseBytes = bytes; return this; } + /** Replace this profile's custom trust set with exactly one PEM root. */ + public Builder trustedRootPem(byte[] pem) { + if (pem == null) throw new IllegalArgumentException("invalid trusted TLS root"); + return trustedRootsPem(List.of(pem)); + } + + /** Explicit short overlap for CA rotation; custom roots replace system roots for this profile. */ + public Builder trustedRootsPem(List pems) { + if (!"https".equalsIgnoreCase(baseUri.getScheme()) || pems == null + || pems.isEmpty() || pems.size() > 4) { + throw new IllegalArgumentException("invalid trusted TLS root"); + } + try { + var parsed = new ArrayList(pems.size()); + var factory = CertificateFactory.getInstance("X.509"); + for (byte[] pem : pems) { + if (pem == null || pem.length == 0 || pem.length > 64 * 1024) { + throw new IllegalArgumentException("invalid trusted TLS root"); + } + // A trust entry is exactly one PEM certificate, not a permissive + // X.509/DER container with unrelated text or private-key material. + int first = 0, last = pem.length; + while (first < last && pemWhitespace(pem[first])) first++; + while (last > first && pemWhitespace(pem[last - 1])) last--; + String text = new String(pem, first, last - first, StandardCharsets.US_ASCII); + String begin = "-----BEGIN CERTIFICATE-----", end = "-----END CERTIFICATE-----"; + if (!text.startsWith(begin) || !text.endsWith(end) || text.length() <= begin.length() + end.length()) { + throw new IllegalArgumentException("invalid trusted TLS root"); + } + for (int index = begin.length(); index < text.length() - end.length(); index++) { + char value = text.charAt(index); + if (!pemWhitespace((byte) value) && !(value >= 'A' && value <= 'Z') + && !(value >= 'a' && value <= 'z') && !(value >= '0' && value <= '9') + && value != '+' && value != '/' && value != '=') { + throw new IllegalArgumentException("invalid trusted TLS root"); + } + } + var certificates = factory.generateCertificates(new ByteArrayInputStream( + text.getBytes(StandardCharsets.US_ASCII))); + if (certificates.size() != 1 + || !(certificates.iterator().next() instanceof X509Certificate root) + || parsed.contains(root)) { + throw new IllegalArgumentException("invalid trusted TLS root"); + } + parsed.add(root); + } + trustedRoots = List.copyOf(parsed); + } catch (java.security.cert.CertificateException failure) { + throw new IllegalArgumentException("invalid trusted TLS root"); + } + return this; + } + private static boolean pemWhitespace(byte value) { + return value == 9 || value == 10 || value == 12 || value == 13 || value == 32; + } public Builder retry(int attempts, Duration delay, Set methods) { this.maxAttempts = attempts; this.retryDelay = positive(delay); diff --git a/teaql-tool-http/src/main/java/io/teaql/tools/http/JdkHttpRequestService.java b/teaql-tool-http/src/main/java/io/teaql/tools/http/JdkHttpRequestService.java index 81ff99493..8e82b94f2 100644 --- a/teaql-tool-http/src/main/java/io/teaql/tools/http/JdkHttpRequestService.java +++ b/teaql-tool-http/src/main/java/io/teaql/tools/http/JdkHttpRequestService.java @@ -12,6 +12,8 @@ import java.net.http.HttpResponse; import java.net.http.HttpTimeoutException; import java.nio.ByteBuffer; +import java.security.GeneralSecurityException; +import java.security.KeyStore; import java.time.Duration; import java.util.LinkedHashMap; import java.util.List; @@ -24,6 +26,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.logging.Logger; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; /** Shared JDK transport for startup registered HTTP profiles. */ public final class JdkHttpRequestService implements HttpRequestService { @@ -265,11 +269,30 @@ private static final class State { this.profile = profile; this.clock = clock; this.refilledAt = clock.nanoTime(); - this.client = HttpClient.newBuilder() + HttpClient.Builder builder = HttpClient.newBuilder() .connectTimeout(profile.connectTimeout()) - .followRedirects(HttpClient.Redirect.NEVER).build(); + .followRedirects(HttpClient.Redirect.NEVER); + if (!profile.trustedRoots().isEmpty()) builder.sslContext(trustedRootContext(profile)); + this.client = builder.build(); this.tokens = profile.ratePerSecond(); } + private static SSLContext trustedRootContext(HttpServiceProfile profile) { + try { + KeyStore store = KeyStore.getInstance("PKCS12"); + store.load(null, null); + for (int index = 0; index < profile.trustedRoots().size(); index++) { + store.setCertificateEntry("root-" + index, profile.trustedRoots().get(index)); + } + TrustManagerFactory managers = TrustManagerFactory.getInstance( + TrustManagerFactory.getDefaultAlgorithm()); + managers.init(store); + SSLContext context = SSLContext.getInstance("TLS"); + context.init(null, managers.getTrustManagers(), null); + return context; + } catch (GeneralSecurityException | java.io.IOException failure) { + throw new IllegalArgumentException("invalid trusted TLS root"); + } + } synchronized boolean acquireCircuit() { if (profile.circuitFailures() == 0) return false; if (openUntil == 0) return false; diff --git a/teaql-tool-http/src/test/java/io/teaql/tools/http/HttpProfileTrustTest.java b/teaql-tool-http/src/test/java/io/teaql/tools/http/HttpProfileTrustTest.java new file mode 100644 index 000000000..c7b5cf8b3 --- /dev/null +++ b/teaql-tool-http/src/test/java/io/teaql/tools/http/HttpProfileTrustTest.java @@ -0,0 +1,281 @@ +package io.teaql.tools.http; + +import io.teaql.core.UserContext; +import io.teaql.core.http.HttpRequestFailure; +import io.teaql.core.http.HttpRequestService; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.net.InetAddress; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.KeyFactory; +import java.security.KeyStore; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.security.spec.PKCS8EncodedKeySpec; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Base64; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLSocket; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +/** Dedicated private-CA proof; no Secret Provider or external service is involved. */ +public class HttpProfileTrustTest { + private static Path directory; + private static final List roots = new ArrayList<>(); + + private static void openssl(String... args) throws Exception { + var command = new ArrayList(); command.add("openssl"); command.addAll(List.of(args)); + Process child = new ProcessBuilder(command).directory(directory.toFile()) + .redirectErrorStream(true).redirectOutput(ProcessBuilder.Redirect.DISCARD).start(); + try { + assertTrue("TLS fixture generator exceeded budget", child.waitFor(30, TimeUnit.SECONDS)); + assertEquals("TLS fixture generator failed", 0, child.exitValue()); + } finally { + if (child.isAlive()) { child.destroyForcibly(); child.waitFor(); } + } + } + + @BeforeClass public static void createCertificates() throws Exception { + directory = Files.createTempDirectory("teaql-http-trust-"); + for (int i = 0; i < 4; i++) { + openssl("req", "-x509", "-newkey", "rsa:2048", "-nodes", "-days", "1", + "-subj", "/CN=TeaQL HTTP fixture root " + i, + "-addext", "basicConstraints=critical,CA:TRUE", + "-addext", "keyUsage=critical,keyCertSign,cRLSign", + "-keyout", "root-" + i + ".key", "-out", "root-" + i + ".pem"); + roots.add(Files.readAllBytes(directory.resolve("root-" + i + ".pem"))); + } + openssl("req", "-new", "-newkey", "rsa:2048", "-nodes", "-subj", "/CN=HTTP fixture", + "-addext", "subjectAltName=IP:127.0.0.1", "-keyout", "server.key", "-out", "server.csr"); + for (int i = 0; i < 2; i++) openssl("x509", "-req", "-days", "1", "-CAcreateserial", + "-copy_extensions", "copy", "-in", "server.csr", "-CA", "root-" + i + ".pem", + "-CAkey", "root-" + i + ".key", "-out", "server-" + i + ".pem"); + openssl("req", "-new", "-key", "server.key", "-subj", "/CN=HTTP wrong host fixture", + "-addext", "subjectAltName=IP:127.0.0.2", "-out", "wrong-host.csr"); + openssl("x509", "-req", "-days", "1", "-CAcreateserial", "-copy_extensions", "copy", + "-in", "wrong-host.csr", "-CA", "root-0.pem", "-CAkey", "root-0.key", + "-out", "wrong-host.pem"); + } + + @AfterClass public static void removeOwnedPrivateKeys() throws Exception { + if (directory == null) return; + try (var files = Files.walk(directory)) { + for (Path file : files.sorted(Comparator.reverseOrder()).toList()) Files.delete(file); + } + } + + private static HttpServiceProfile.Builder profile(String alias, URI uri) { + return HttpServiceProfile.builder(alias, uri) + .budgets(Duration.ofSeconds(3), Duration.ofSeconds(3), Duration.ofSeconds(5)); + } + + private static UserContext context() { + return (UserContext) Proxy.newProxyInstance(UserContext.class.getClassLoader(), + new Class[] { UserContext.class }, (proxy, method, args) -> { + if (method.isDefault()) return InvocationHandler.invokeDefault(proxy, method, args); + return null; + }); + } + + private static void success(JdkHttpRequestService service, String alias) { + var response = service.execute(context(), HttpRequestService.Call.get(alias, "status", + "load private upstream status", "verify profile-scoped HTTPS trust")); + assertEquals(200, response.status()); assertArrayEquals("ok".getBytes(StandardCharsets.US_ASCII), response.body()); + } + + private static void rejected(JdkHttpRequestService service, String alias) { + var failure = assertThrows(HttpRequestFailure.class, () -> success(service, alias)); + assertEquals(HttpRequestFailure.Code.UPSTREAM_FAILURE, failure.code()); assertNull(failure.getCause()); + } + + @Test public void rejectsInvalidTrustInputsAndAcceptsOneToFourDistinctRoots() { + URI https = URI.create("https://127.0.0.1/"); + byte[] old = roots.get(0), next = roots.get(1); + byte[] bundled = new byte[old.length + next.length]; + System.arraycopy(old, 0, bundled, 0, old.length); System.arraycopy(next, 0, bundled, old.length, next.length); + var invalid = List.of(List.of(), List.of(new byte[0]), List.of(new byte[65537]), + List.of("PRIVATE_ROOT_CANARY".getBytes(StandardCharsets.US_ASCII)), List.of(bundled), + List.of(old, old), List.of(old, new String(old, StandardCharsets.US_ASCII) + .replace("\n", "\r\n").getBytes(StandardCharsets.US_ASCII)), + List.of(old, next, roots.get(2), roots.get(3), old)); + for (var input : invalid) { + var failure = assertThrows(IllegalArgumentException.class, + () -> profile("upstream", https).trustedRootsPem(input)); + assertEquals("invalid trusted TLS root", failure.getMessage()); assertNull(failure.getCause()); + } + assertThrows(IllegalArgumentException.class, () -> profile("upstream", https).trustedRootPem(null)); + assertThrows(IllegalArgumentException.class, () -> profile("upstream", https).trustedRootsPem(null)); + assertThrows(IllegalArgumentException.class, () -> profile("upstream", https).trustedRootsPem(Arrays.asList(old, null))); + assertThrows(IllegalArgumentException.class, + () -> profile("upstream", URI.create("http://127.0.0.1/")).trustedRootPem(old)); + for (int count = 1; count <= 4; count++) assertEquals(count, + profile("upstream", https).trustedRootsPem(roots.subList(0, count)).build().trustedRoots().size()); + System.out.println("HTTP_TRUST_INPUT_PASS language=java bounded=1 malformed=1 duplicate=1 bundle=1 https_only=1"); + } + + @Test public void customRootsStayProfileLocalAndDoNotDisableHostnameChecks() throws Exception { + try (var peer = new Peer("server-0.pem", 0); var wrong = new Peer("wrong-host.pem", 0)) { + var service = new JdkHttpRequestService(List.of(profile("system", peer.uri()).build(), + profile("trusted", peer.uri()).trustedRootPem(roots.get(0)).build(), + profile("wrong_host", wrong.uri()).trustedRootPem(roots.get(0)).build())); + rejected(service, "system"); assertEquals(0, peer.requests.get()); + success(service, "trusted"); assertEquals(1, peer.requests.get()); + rejected(service, "system"); assertEquals(1, peer.requests.get()); + rejected(service, "wrong_host"); assertEquals(0, wrong.requests.get()); + System.out.println("HTTP_TRUST_ISOLATION_PASS language=java system_reject=2 custom_success=1 hostname_reject=1"); + } + } + + @Test public void rejectsMixedPemMaterialAndDerWithSafeErrors() throws Exception { + byte[] root = roots.get(0), key = Files.readAllBytes(directory.resolve("root-0.key")); + var invalid = new java.util.LinkedHashMap(); + invalid.put("leading-text", joined("PRIVATE_ROOT_PREFIX_CANARY\n".getBytes(StandardCharsets.US_ASCII), root)); + invalid.put("trailing-text", joined(root, "\nPRIVATE_ROOT_TRAILING_CANARY".getBytes(StandardCharsets.US_ASCII))); + invalid.put("key-before-certificate", joined(key, root)); + invalid.put("key-after-certificate", joined(root, key)); + byte[] footer = "-----END CERTIFICATE-----\n".getBytes(StandardCharsets.US_ASCII); + invalid.put("extra-footer", joined(root, footer)); + invalid.put("key-and-extra-footer", joined(root, key, footer)); + invalid.put("nested-header", joined("-----BEGIN CERTIFICATE-----\n".getBytes(StandardCharsets.US_ASCII), root)); + invalid.put("byte-order-marker", joined(new byte[] {(byte) 0xef, (byte) 0xbb, (byte) 0xbf}, root)); + invalid.put("raw-der", ((X509Certificate) CertificateFactory.getInstance("X.509") + .generateCertificate(new java.io.ByteArrayInputStream(root))).getEncoded()); + var accepted = new ArrayList(); + for (var entry : invalid.entrySet()) { + try { profile("upstream", URI.create("https://127.0.0.1/")).trustedRootPem(entry.getValue()); accepted.add(entry.getKey()); } + catch (IllegalArgumentException failure) { + assertEquals("invalid trusted TLS root", failure.getMessage()); assertNull(failure.getCause()); + } + } + boolean padded; + try { profile("upstream", URI.create("https://127.0.0.1/")).trustedRootPem(joined( + "\r\n\t ".getBytes(StandardCharsets.US_ASCII), root, "\n \t\r\n".getBytes(StandardCharsets.US_ASCII))); padded = true; } + catch (IllegalArgumentException failure) { padded = false; } + System.out.println("JAVA_HTTP_TRUST_ENVELOPE_CASE={\"total\":" + invalid.size() + + ",\"accepted\":" + accepted.size() + ",\"rejected\":" + (invalid.size() - accepted.size()) + + ",\"padded\":" + padded + "}"); + assertTrue("only one PEM certificate and surrounding whitespace are allowed; accepted labels: " + accepted, accepted.isEmpty()); + assertTrue("surrounding ASCII whitespace must be allowed", padded); + } + + private static byte[] joined(byte[]... values) { + var output = new java.io.ByteArrayOutputStream(); + for (byte[] value : values) output.writeBytes(value); + return output.toByteArray(); + } + + @Test public void overlappingRootsRotateAcrossBothLivePeersWithoutReset() throws Exception { + try (var old = new Peer("server-0.pem", 0); var next = new Peer("server-1.pem", 1)) { + var oldOnly = new JdkHttpRequestService(List.of(profile("old", old.uri()).trustedRootPem(roots.get(0)).build(), + profile("next", next.uri()).trustedRootPem(roots.get(0)).build())); + success(oldOnly, "old"); rejected(oldOnly, "next"); assertEquals(0, next.requests.get()); + var overlap = new JdkHttpRequestService(List.of(profile("old", old.uri()).trustedRootsPem(roots.subList(0, 2)).build(), + profile("next", next.uri()).trustedRootsPem(roots.subList(0, 2)).build())); + var newOnly = new JdkHttpRequestService(List.of(profile("old", old.uri()).trustedRootPem(roots.get(1)).build(), + profile("next", next.uri()).trustedRootPem(roots.get(1)).build())); + for (int round = 1; round <= 2; round++) { + success(overlap, "old"); success(overlap, "next"); rejected(newOnly, "old"); success(newOnly, "next"); + assertEquals(1 + round, old.requests.get()); assertEquals(2 * round, next.requests.get()); + System.out.println("HTTP_TRUST_ROTATION_PASS language=java round=" + round + " old_requests=" + + old.requests.get() + " new_requests=" + next.requests.get()); + } + } + } + + @Test public void builtProfilesSnapshotInputsAndFailedReplacementIsAtomic() throws Exception { + try (var peer = new Peer("server-0.pem", 0)) { + byte[] copy = roots.get(0).clone(); var input = new ArrayList<>(List.of(copy)); + var builder = profile("trusted", peer.uri()).trustedRootsPem(input); var before = builder.build(); + input.clear(); Arrays.fill(copy, (byte) 0); + assertThrows(IllegalArgumentException.class, () -> builder.trustedRootsPem(List.of(roots.get(1), new byte[0]))); + var afterFailure = builder.build(); builder.trustedRootPem(roots.get(1)); + success(new JdkHttpRequestService(List.of(before)), "trusted"); + success(new JdkHttpRequestService(List.of(afterFailure)), "trusted"); + rejected(new JdkHttpRequestService(List.of(builder.build())), "trusted"); + assertEquals(2, peer.requests.get()); + } + } + + @Test public void profileLimitsAndDuplicateAliasesFailBeforeUse() { + URI uri = URI.create("https://127.0.0.1/"); + for (Duration invalid : List.of(Duration.ZERO, Duration.ofNanos(-1), Duration.ofHours(1).plusNanos(1))) { + assertThrows(IllegalArgumentException.class, () -> profile("valid", uri).budgets(invalid, Duration.ofSeconds(1), Duration.ofSeconds(1))); + assertThrows(IllegalArgumentException.class, () -> profile("valid", uri).budgets(Duration.ofSeconds(1), invalid, Duration.ofSeconds(1))); + assertThrows(IllegalArgumentException.class, () -> profile("valid", uri).budgets(Duration.ofSeconds(1), Duration.ofSeconds(1), invalid)); + } + for (int bytes : List.of(0, 16 * 1024 * 1024 + 1)) assertThrows(IllegalArgumentException.class, + () -> profile("valid", uri).maxResponseBytes(bytes).build()); + for (int attempts : List.of(0, 6)) assertThrows(IllegalArgumentException.class, + () -> profile("valid", uri).retry(attempts, Duration.ofMillis(1), Set.of()).build()); + assertThrows(IllegalArgumentException.class, () -> profile("valid", uri).circuit(1, Duration.ofSeconds(1), 0).build()); + assertThrows(IllegalArgumentException.class, () -> new JdkHttpRequestService(List.of(profile("same", uri).build(), profile("same", uri).build()))); + } + + private static final class Peer implements AutoCloseable { + final SSLServerSocket server; + final Thread worker; + final AtomicBoolean closed = new AtomicBoolean(); + final AtomicReference error = new AtomicReference<>(); + final AtomicInteger requests = new AtomicInteger(); + Peer(String certificateFile, int rootIndex) throws Exception { + var factory = CertificateFactory.getInstance("X.509"); + var certificate = (X509Certificate) factory.generateCertificate( + new java.io.ByteArrayInputStream(Files.readAllBytes(directory.resolve(certificateFile)))); + var root = (X509Certificate) factory.generateCertificate(new java.io.ByteArrayInputStream(roots.get(rootIndex))); + certificate.checkValidity(); certificate.verify(root.getPublicKey()); + String key = Files.readString(directory.resolve("server.key")).replace("-----BEGIN PRIVATE KEY-----", "") + .replace("-----END PRIVATE KEY-----", "").replaceAll("\\s", ""); + var privateKey = KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(Base64.getDecoder().decode(key))); + var store = KeyStore.getInstance("PKCS12"); store.load(null, null); + char[] password = "fixture-only".toCharArray(); + store.setKeyEntry("server", privateKey, password, new java.security.cert.Certificate[] {certificate, root}); + var managers = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); managers.init(store, password); + var tls = SSLContext.getInstance("TLS"); tls.init(managers.getKeyManagers(), null, null); + server = (SSLServerSocket) tls.getServerSocketFactory().createServerSocket(0, 16, InetAddress.getByName("127.0.0.1")); + server.setSoTimeout(100); + worker = new Thread(() -> { + while (!closed.get()) { + try (var socket = (SSLSocket) server.accept()) { + socket.setSoTimeout(2000); + var reader = new java.io.BufferedReader(new java.io.InputStreamReader(socket.getInputStream(), StandardCharsets.US_ASCII)); + String first = reader.readLine(); + if (first == null) continue; + assertTrue(first.startsWith("GET /status HTTP/1.1")); + String line; + while ((line = reader.readLine()) != null && !line.isEmpty()) {} + if (line == null) continue; + requests.incrementAndGet(); + socket.getOutputStream().write("HTTP/1.1 200 OK\r\nContent-Length: 2\r\nConnection: close\r\n\r\nok".getBytes(StandardCharsets.US_ASCII)); + socket.getOutputStream().flush(); + } catch (java.io.IOException rejectedOrStopped) { + // Unknown CA and hostname failures cannot enter HTTP. + } catch (Throwable unexpected) { error.compareAndSet(null, unexpected); return; } + } + }, "teaql-http-trust-peer"); + worker.start(); + } + URI uri() { return URI.create("https://127.0.0.1:" + server.getLocalPort() + "/"); } + @Override public void close() throws Exception { + closed.set(true); server.close(); worker.join(5000); + assertFalse("owned TLS peer did not stop", worker.isAlive()); + if (error.get() != null) throw new AssertionError("owned TLS peer failed", error.get()); + } + } +} diff --git a/teaql-tool-http/src/test/java/io/teaql/tools/http/HttpResilienceTest.java b/teaql-tool-http/src/test/java/io/teaql/tools/http/HttpResilienceTest.java index 1b0a9d915..0c248e2d3 100644 --- a/teaql-tool-http/src/test/java/io/teaql/tools/http/HttpResilienceTest.java +++ b/teaql-tool-http/src/test/java/io/teaql/tools/http/HttpResilienceTest.java @@ -74,6 +74,75 @@ private static HttpRequestService.Call get(String path) { return HttpRequestService.Call.get("orders", path, "load order status", "show current order"); } + @Test public void contextAndBothIntentKindsFailBeforeAnyConnection() { + var service = new JdkHttpRequestService(java.util.List.of(profile().build())); + var context = context(service); + for (org.junit.function.ThrowingRunnable work : java.util.List.of( + () -> service.execute(null, get("ok")), () -> service.execute(context, null), + () -> HttpRequestService.Call.get("orders", "ok", " ", "purpose"), + () -> HttpRequestService.Call.get("orders", "ok", "comment", " "), + () -> new HttpRequestService.Call("orders", HttpRequestService.Method.GET, "ok", Map.of(), + null, null, "comment", HttpRequestService.IntentKind.AUDIT, " ", HttpRequestService.RetryMode.NONE))) { + assertEquals(HttpRequestFailure.Code.INVALID_INPUT, assertThrows(HttpRequestFailure.class, work).code()); + } + assertEquals(0, server.connections.get()); assertEquals(0, server.requests.get()); + assertEquals(200, service.execute(context, get("ok")).status()); + assertEquals(1, server.requests.get()); + System.out.println("JAVA_HTTP_CONTRACT_CASE={\"id\":\"HTTP-01\",\"invalidInputs\":5,\"connectionsBeforeRecovery\":0,\"requestsBeforeRecovery\":0,\"recoveryRequests\":1}"); + } + + @Test public void persistentFailuresStopAtConfiguredPhysicalAttemptCeiling() { + var service = new JdkHttpRequestService(java.util.List.of(profile() + .retry(3, Duration.ofMillis(1), Set.of(HttpRequestService.Method.GET)).build())); + var response = service.execute(context(service), call(HttpRequestService.Method.GET, + "fail", HttpRequestService.RetryMode.CONFIRMED_IDEMPOTENT)); + assertEquals(503, response.status()); assertEquals(3, response.attempts()); assertEquals(3, server.requests.get()); + System.out.println("JAVA_HTTP_CONTRACT_CASE={\"id\":\"HTTP-07\",\"configuredAttempts\":3,\"physicalRequests\":3,\"reportedAttempts\":3}"); + } + + @Test public void incompleteOversizedBodyReleasesConnectionBeforeRecovery() throws Exception { + var service = new JdkHttpRequestService(java.util.List.of(profile().maxResponseBytes(16).build())); + assertEquals(HttpRequestFailure.Code.RESPONSE_TOO_LARGE, assertThrows(HttpRequestFailure.class, + () -> service.execute(context(service), get("incomplete-large"))).code()); + long deadline = System.nanoTime() + Duration.ofSeconds(2).toNanos(); + while (server.overflowPeerClosed.get() == 0 && System.nanoTime() < deadline) Thread.sleep(5); + assertEquals("overflow must release the incomplete response", 1, server.overflowPeerClosed.get()); + assertEquals(200, service.execute(context(service), get("ok")).status()); + assertEquals(2, server.requests.get()); + System.out.println("JAVA_HTTP_CONTRACT_CASE={\"id\":\"HTTP-09\",\"peerClosedBeforeRecovery\":1,\"physicalRequests\":2,\"sameServiceReused\":true}"); + } + + @Test public void successfulProbeClosesCircuitForConcurrentFollowups() throws Exception { + AtomicLong time = new AtomicLong(1); + HttpOperationalClock clock = new HttpOperationalClock() { + @Override public long nanoTime() { return time.get(); } + @Override public void pauseNanos(long nanos) { time.addAndGet(nanos); } + }; + var service = new JdkHttpRequestService(java.util.List.of(profile() + .circuit(1, Duration.ofSeconds(5), 1).build()), clock); + assertEquals(503, service.execute(context(service), get("fail")).status()); + time.addAndGet(Duration.ofSeconds(5).toNanos()); + assertEquals(200, service.execute(context(service), get("ok")).status()); + server.concurrentGate = new CountDownLatch(3); + var errors = new ConcurrentLinkedQueue(); + var workers = new java.util.ArrayList(); + for (int i = 0; i < 3; i++) { + Thread worker = new Thread(() -> { + try { assertEquals(200, service.execute(context(service), get("concurrent-after-probe")).status()); } + catch (Throwable error) { errors.add(error); } + }); workers.add(worker); worker.start(); + } + try { + for (Thread worker : workers) worker.join(5000); + assertTrue("closed circuit admits all three simultaneous requests", errors.isEmpty()); + for (Thread worker : workers) assertFalse(worker.isAlive()); + assertEquals(0, server.concurrentGate.getCount()); assertEquals(5, server.requests.get()); + } finally { + for (Thread worker : workers) { if (worker.isAlive()) worker.interrupt(); worker.join(2000); } + } + System.out.println("JAVA_HTTP_CONTRACT_CASE={\"id\":\"HTTP-11\",\"halfOpenLimit\":1,\"successfulConcurrentFollowups\":3,\"physicalRequests\":5}"); + } + @Test public void brokenObservationCannotChangeTransportOutcome() { var service = new JdkHttpRequestService(java.util.List.of(profile().build())); HttpObservation brokenStart = operation -> { throw new IllegalStateException("observer failed"); }; @@ -628,6 +697,9 @@ private static final class Fixture implements AutoCloseable { private final ServerSocket socket; private final Thread thread; private final AtomicInteger requests = new AtomicInteger(); + private final AtomicInteger connections = new AtomicInteger(); + private final AtomicInteger overflowPeerClosed = new AtomicInteger(); + private volatile CountDownLatch concurrentGate; private final AtomicInteger flaky = new AtomicInteger(); private final AtomicInteger retryPost = new AtomicInteger(); private final ConcurrentLinkedQueue traceparents = new ConcurrentLinkedQueue<>(); @@ -644,6 +716,7 @@ private void serve() { while (!closed) { try { Socket client = socket.accept(); + connections.incrementAndGet(); Thread handler = new Thread(() -> handle(client), "teaql-http-fixture-request"); handler.setDaemon(true); handler.start(); @@ -681,6 +754,18 @@ private void handle(Socket socket) { if (target.contains("/retry-post")) retryBodies.add(new String(body)); } if (target.contains("/close")) return; + if (target.contains("/incomplete-large")) { + client.getOutputStream().write(("HTTP/1.1 200 OK\r\nContent-Length: 4096\r\nConnection: keep-alive\r\n\r\n" + + "X".repeat(64)).getBytes(StandardCharsets.US_ASCII)); + client.getOutputStream().flush(); client.setSoTimeout(2000); + try { if (reader.read() == -1) overflowPeerClosed.incrementAndGet(); } + catch (java.net.SocketException peerReset) { overflowPeerClosed.incrementAndGet(); } + return; + } + if (target.contains("/concurrent-after-probe")) { + concurrentGate.countDown(); + if (!concurrentGate.await(3, TimeUnit.SECONDS)) throw new IOException("concurrent fixture budget exhausted"); + } if (target.endsWith("/slow")) Thread.sleep(300); int status = target.contains("/private-response") ? 503 : target.contains("/redirect") ? 302 : target.contains("/missing") ? 404 diff --git a/teaql-utils-json/pom.xml b/teaql-utils-json/pom.xml index 17a81f99c..1da001f2d 100644 --- a/teaql-utils-json/pom.xml +++ b/teaql-utils-json/pom.xml @@ -6,7 +6,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE teaql-utils-json diff --git a/teaql-utils-reflection/pom.xml b/teaql-utils-reflection/pom.xml index aa3ea01dc..04a068933 100644 --- a/teaql-utils-reflection/pom.xml +++ b/teaql-utils-reflection/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-utils-spring/pom.xml b/teaql-utils-spring/pom.xml index f9e391aff..cd41ab91a 100644 --- a/teaql-utils-spring/pom.xml +++ b/teaql-utils-spring/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-utils/pom.xml b/teaql-utils/pom.xml index 7394deded..6ff1e082d 100644 --- a/teaql-utils/pom.xml +++ b/teaql-utils/pom.xml @@ -7,7 +7,7 @@ io.teaql teaql-java-parent - 1.555-RELEASE + 1.556-RELEASE ../pom.xml diff --git a/teaql-utils/src/main/java/io/teaql/core/utils/LocalDateTimeUtil.java b/teaql-utils/src/main/java/io/teaql/core/utils/LocalDateTimeUtil.java index fa13a90ea..1fb2f3b84 100644 --- a/teaql-utils/src/main/java/io/teaql/core/utils/LocalDateTimeUtil.java +++ b/teaql-utils/src/main/java/io/teaql/core/utils/LocalDateTimeUtil.java @@ -7,6 +7,15 @@ public class LocalDateTimeUtil { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); private static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + private static final DateTimeFormatter SQL_DATETIME_FORMATTER = new java.time.format.DateTimeFormatterBuilder() + .appendPattern("uuuu-MM-dd HH:mm:ss") + .appendFraction(java.time.temporal.ChronoField.NANO_OF_SECOND, 1, 9, true) + .toFormatter(java.util.Locale.ROOT); + + /** JDBC-style text without creating an instant or consulting a time zone. */ + public static String formatSql(LocalDateTime value) { + return value == null ? null : SQL_DATETIME_FORMATTER.format(value); + } public static java.lang.String formatNormal(java.time.LocalDate p0) { if (p0 == null) { diff --git a/teaql-utils/src/main/java/io/teaql/core/utils/SensitiveValueProjection.java b/teaql-utils/src/main/java/io/teaql/core/utils/SensitiveValueProjection.java new file mode 100644 index 000000000..83cad2ffb --- /dev/null +++ b/teaql-utils/src/main/java/io/teaql/core/utils/SensitiveValueProjection.java @@ -0,0 +1,66 @@ +package io.teaql.core.utils; + +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; + +/** One shared audit/diagnostic policy, independent of runtime and providers. */ +public final class SensitiveValueProjection { + public static final String ENVIRONMENT = "TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS"; + public static final String ACKNOWLEDGEMENT = "I_UNDERSTAND_SENSITIVE_DATA_MAY_BE_WRITTEN_TO_DISK"; + public static final String REDACTED = "[REDACTED]"; + private static final AtomicBoolean WARNED = new AtomicBoolean(); + private SensitiveValueProjection() {} + + public static boolean plaintextEnabled() { + if (!ACKNOWLEDGEMENT.equals(System.getenv(ENVIRONMENT))) return false; + if (WARNED.compareAndSet(false,true)) System.err.println( + "[TeaQL WARNING] Sensitive plaintext logging enabled; business data may be written to disk. Credentials remain redacted."); + return true; + } + public static String maskAuditValue(String value) { + if (value == null || value.isEmpty()) return value; + int length = value.codePointCount(0,value.length()); + if (length < 8 || value.codePoints().allMatch(c -> c >= '0' && c <= '9')) return "*".repeat(length); + return value.substring(0,value.offsetByCodePoints(0,2)) + "*".repeat(length-4) + + value.substring(value.offsetByCodePoints(0,length-2)); + } + public static boolean hasCredentials(Object value) { + if (value instanceof Map map) return map.entrySet().stream() + .anyMatch(e -> SensitiveLogNames.credential(String.valueOf(e.getKey())) || hasCredentials(e.getValue())); + if (value instanceof Iterable items) for (Object item : items) if (hasCredentials(item)) return true; + if (value != null && value.getClass().isArray()) + for (int i=0;i output) { + if (value == null) return; + if (value instanceof Map map) { map.values().forEach(v -> collectStrings(v,output)); return; } + if (value instanceof Iterable items) { items.forEach(v -> collectStrings(v,output)); return; } + if (value.getClass().isArray()) { + for (int i=0;i values) { + if (text == null) return null; + List strings=new ArrayList<>(); values.forEach(v -> collectStrings(v,strings)); + strings.sort(Comparator.comparingInt(String::length).reversed()); + for (String value : strings) text=text.replace(value,REDACTED); + return text; + } + public static Object maskBusinessValue(Object value) { + if (value == null || REDACTED.equals(value)) return value; + if (value instanceof Map) return REDACTED; + if (value instanceof Iterable items) { + List safe=new ArrayList<>(); items.forEach(v -> safe.add(maskBusinessValue(v))); return safe; + } + if (value.getClass().isArray()) { + List safe=new ArrayList<>(); + for (int i=0;i