From 14ed48408c3ab073f1aca2a4bddc9c2eeb35cc23 Mon Sep 17 00:00:00 2001 From: Jottyfan Date: Wed, 15 Jan 2025 21:41:51 +0100 Subject: [PATCH] additional flags for camp registration --- build.gradle | 8 +- .../java/de/jottyfan/bico/db/camp/Camp.java | 9 +- .../java/de/jottyfan/bico/db/camp/Tables.java | 6 + .../bico/db/camp/tables/TRegistration.java | 15 ++ .../bico/db/camp/tables/VVersion.java | 213 ++++++++++++++++++ .../db/camp/tables/pojos/TRegistration.java | 59 ++++- .../bico/db/camp/tables/pojos/VVersion.java | 72 ++++++ .../tables/records/TRegistrationRecord.java | 53 ++++- .../camp/tables/records/VVersionRecord.java | 67 ++++++ .../bico/db/public_/tables/VVersion.java | 2 +- src/main/resources/v8.sql | 6 + 11 files changed, 502 insertions(+), 8 deletions(-) create mode 100644 src/main/java/de/jottyfan/bico/db/camp/tables/VVersion.java create mode 100644 src/main/java/de/jottyfan/bico/db/camp/tables/pojos/VVersion.java create mode 100644 src/main/java/de/jottyfan/bico/db/camp/tables/records/VVersionRecord.java create mode 100644 src/main/resources/v8.sql diff --git a/build.gradle b/build.gradle index 65134fd..b12855e 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'org.jooq:jooq-codegen:latest.release' + classpath 'org.jooq:jooq-codegen:3.19.15' classpath 'org.postgresql:postgresql:latest.release' classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:latest.release' classpath 'nu.studer.jooq:nu.studer.jooq.gradle.plugin:latest.release' @@ -22,7 +22,7 @@ apply plugin: 'java' apply plugin: 'maven-publish' group = 'de.jottyfan' -version = '7' +version = '8' description = """bicolib""" @@ -36,8 +36,8 @@ repositories { } dependencies { - implementation 'org.jooq:jooq:latest.release' - implementation 'org.jooq:jooq-codegen:latest.release' + implementation 'org.jooq:jooq:3.19.15' + implementation 'org.jooq:jooq-codegen:3.19.15' implementation 'org.postgresql:postgresql:latest.release' diff --git a/src/main/java/de/jottyfan/bico/db/camp/Camp.java b/src/main/java/de/jottyfan/bico/db/camp/Camp.java index 6904bba..2223be0 100644 --- a/src/main/java/de/jottyfan/bico/db/camp/Camp.java +++ b/src/main/java/de/jottyfan/bico/db/camp/Camp.java @@ -8,6 +8,7 @@ import de.jottyfan.bico.db.DefaultCatalog; import de.jottyfan.bico.db.camp.tables.TAge; import de.jottyfan.bico.db.camp.tables.TRegistration; import de.jottyfan.bico.db.camp.tables.VParticipant; +import de.jottyfan.bico.db.camp.tables.VVersion; import java.util.Arrays; import java.util.List; @@ -45,6 +46,11 @@ public class Camp extends SchemaImpl { */ public final VParticipant V_PARTICIPANT = VParticipant.V_PARTICIPANT; + /** + * The table camp.v_version. + */ + public final VVersion V_VERSION = VVersion.V_VERSION; + /** * No further instances allowed */ @@ -63,7 +69,8 @@ public class Camp extends SchemaImpl { return Arrays.asList( TAge.T_AGE, TRegistration.T_REGISTRATION, - VParticipant.V_PARTICIPANT + VParticipant.V_PARTICIPANT, + VVersion.V_VERSION ); } } diff --git a/src/main/java/de/jottyfan/bico/db/camp/Tables.java b/src/main/java/de/jottyfan/bico/db/camp/Tables.java index d2eb711..f79675f 100644 --- a/src/main/java/de/jottyfan/bico/db/camp/Tables.java +++ b/src/main/java/de/jottyfan/bico/db/camp/Tables.java @@ -7,6 +7,7 @@ package de.jottyfan.bico.db.camp; import de.jottyfan.bico.db.camp.tables.TAge; import de.jottyfan.bico.db.camp.tables.TRegistration; import de.jottyfan.bico.db.camp.tables.VParticipant; +import de.jottyfan.bico.db.camp.tables.VVersion; /** @@ -29,4 +30,9 @@ public class Tables { * The table camp.v_participant. */ public static final VParticipant V_PARTICIPANT = VParticipant.V_PARTICIPANT; + + /** + * The table camp.v_version. + */ + public static final VVersion V_VERSION = VVersion.V_VERSION; } diff --git a/src/main/java/de/jottyfan/bico/db/camp/tables/TRegistration.java b/src/main/java/de/jottyfan/bico/db/camp/tables/TRegistration.java index 2e39aa4..e77d868 100644 --- a/src/main/java/de/jottyfan/bico/db/camp/tables/TRegistration.java +++ b/src/main/java/de/jottyfan/bico/db/camp/tables/TRegistration.java @@ -155,6 +155,21 @@ public class TRegistration extends TableImpl { */ public final TableField DAY4 = createField(DSL.name("day4"), SQLDataType.BOOLEAN, this, ""); + /** + * The column camp.t_registration.towels. + */ + public final TableField TOWELS = createField(DSL.name("towels"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column camp.t_registration.bed_linen. + */ + public final TableField BED_LINEN = createField(DSL.name("bed_linen"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column camp.t_registration.cot. + */ + public final TableField COT = createField(DSL.name("cot"), SQLDataType.BOOLEAN, this, ""); + private TRegistration(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } diff --git a/src/main/java/de/jottyfan/bico/db/camp/tables/VVersion.java b/src/main/java/de/jottyfan/bico/db/camp/tables/VVersion.java new file mode 100644 index 0000000..e929923 --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/camp/tables/VVersion.java @@ -0,0 +1,213 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.camp.tables; + + +import de.jottyfan.bico.db.camp.Camp; +import de.jottyfan.bico.db.camp.tables.records.VVersionRecord; + +import java.util.Collection; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class VVersion extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of camp.v_version + */ + public static final VVersion V_VERSION = new VVersion(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return VVersionRecord.class; + } + + /** + * The column camp.v_version.version. + */ + public final TableField VERSION = createField(DSL.name("version"), SQLDataType.INTEGER, this, ""); + + private VVersion(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private VVersion(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view(""" + create view "v_version" as SELECT 6 AS version; + """), where); + } + + /** + * Create an aliased camp.v_version table reference + */ + public VVersion(String alias) { + this(DSL.name(alias), V_VERSION); + } + + /** + * Create an aliased camp.v_version table reference + */ + public VVersion(Name alias) { + this(alias, V_VERSION); + } + + /** + * Create a camp.v_version table reference + */ + public VVersion() { + this(DSL.name("v_version"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Camp.CAMP; + } + + @Override + public VVersion as(String alias) { + return new VVersion(DSL.name(alias), this); + } + + @Override + public VVersion as(Name alias) { + return new VVersion(alias, this); + } + + @Override + public VVersion as(Table alias) { + return new VVersion(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public VVersion rename(String name) { + return new VVersion(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public VVersion rename(Name name) { + return new VVersion(name, null); + } + + /** + * Rename this table + */ + @Override + public VVersion rename(Table name) { + return new VVersion(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VVersion where(Condition condition) { + return new VVersion(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VVersion where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VVersion where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VVersion where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VVersion where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VVersion where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VVersion where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VVersion where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VVersion whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VVersion whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/java/de/jottyfan/bico/db/camp/tables/pojos/TRegistration.java b/src/main/java/de/jottyfan/bico/db/camp/tables/pojos/TRegistration.java index 79fd846..4afc820 100644 --- a/src/main/java/de/jottyfan/bico/db/camp/tables/pojos/TRegistration.java +++ b/src/main/java/de/jottyfan/bico/db/camp/tables/pojos/TRegistration.java @@ -38,6 +38,9 @@ public class TRegistration implements Serializable { private final Boolean day2; private final Boolean day3; private final Boolean day4; + private final Boolean towels; + private final Boolean bedLinen; + private final Boolean cot; public TRegistration(TRegistration value) { this.created = value.created; @@ -59,6 +62,9 @@ public class TRegistration implements Serializable { this.day2 = value.day2; this.day3 = value.day3; this.day4 = value.day4; + this.towels = value.towels; + this.bedLinen = value.bedLinen; + this.cot = value.cot; } public TRegistration( @@ -80,7 +86,10 @@ public class TRegistration implements Serializable { Boolean day1, Boolean day2, Boolean day3, - Boolean day4 + Boolean day4, + Boolean towels, + Boolean bedLinen, + Boolean cot ) { this.created = created; this.pkRegistration = pkRegistration; @@ -101,6 +110,9 @@ public class TRegistration implements Serializable { this.day2 = day2; this.day3 = day3; this.day4 = day4; + this.towels = towels; + this.bedLinen = bedLinen; + this.cot = cot; } /** @@ -236,6 +248,27 @@ public class TRegistration implements Serializable { return this.day4; } + /** + * Getter for camp.t_registration.towels. + */ + public Boolean getTowels() { + return this.towels; + } + + /** + * Getter for camp.t_registration.bed_linen. + */ + public Boolean getBedLinen() { + return this.bedLinen; + } + + /** + * Getter for camp.t_registration.cot. + */ + public Boolean getCot() { + return this.cot; + } + @Override public boolean equals(Object obj) { if (this == obj) @@ -359,6 +392,24 @@ public class TRegistration implements Serializable { } else if (!this.day4.equals(other.day4)) return false; + if (this.towels == null) { + if (other.towels != null) + return false; + } + else if (!this.towels.equals(other.towels)) + return false; + if (this.bedLinen == null) { + if (other.bedLinen != null) + return false; + } + else if (!this.bedLinen.equals(other.bedLinen)) + return false; + if (this.cot == null) { + if (other.cot != null) + return false; + } + else if (!this.cot.equals(other.cot)) + return false; return true; } @@ -385,6 +436,9 @@ public class TRegistration implements Serializable { result = prime * result + ((this.day2 == null) ? 0 : this.day2.hashCode()); result = prime * result + ((this.day3 == null) ? 0 : this.day3.hashCode()); result = prime * result + ((this.day4 == null) ? 0 : this.day4.hashCode()); + result = prime * result + ((this.towels == null) ? 0 : this.towels.hashCode()); + result = prime * result + ((this.bedLinen == null) ? 0 : this.bedLinen.hashCode()); + result = prime * result + ((this.cot == null) ? 0 : this.cot.hashCode()); return result; } @@ -411,6 +465,9 @@ public class TRegistration implements Serializable { sb.append(", ").append(day2); sb.append(", ").append(day3); sb.append(", ").append(day4); + sb.append(", ").append(towels); + sb.append(", ").append(bedLinen); + sb.append(", ").append(cot); sb.append(")"); return sb.toString(); diff --git a/src/main/java/de/jottyfan/bico/db/camp/tables/pojos/VVersion.java b/src/main/java/de/jottyfan/bico/db/camp/tables/pojos/VVersion.java new file mode 100644 index 0000000..c84e646 --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/camp/tables/pojos/VVersion.java @@ -0,0 +1,72 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.camp.tables.pojos; + + +import java.io.Serializable; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class VVersion implements Serializable { + + private static final long serialVersionUID = 1L; + + private final Integer version; + + public VVersion(VVersion value) { + this.version = value.version; + } + + public VVersion( + Integer version + ) { + this.version = version; + } + + /** + * Getter for camp.v_version.version. + */ + public Integer getVersion() { + return this.version; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final VVersion other = (VVersion) obj; + if (this.version == null) { + if (other.version != null) + return false; + } + else if (!this.version.equals(other.version)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.version == null) ? 0 : this.version.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("VVersion ("); + + sb.append(version); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/java/de/jottyfan/bico/db/camp/tables/records/TRegistrationRecord.java b/src/main/java/de/jottyfan/bico/db/camp/tables/records/TRegistrationRecord.java index 77e5811..8ee9481 100644 --- a/src/main/java/de/jottyfan/bico/db/camp/tables/records/TRegistrationRecord.java +++ b/src/main/java/de/jottyfan/bico/db/camp/tables/records/TRegistrationRecord.java @@ -307,6 +307,51 @@ public class TRegistrationRecord extends UpdatableRecordImplcamp.t_registration.towels. + */ + public TRegistrationRecord setTowels(Boolean value) { + set(19, value); + return this; + } + + /** + * Getter for camp.t_registration.towels. + */ + public Boolean getTowels() { + return (Boolean) get(19); + } + + /** + * Setter for camp.t_registration.bed_linen. + */ + public TRegistrationRecord setBedLinen(Boolean value) { + set(20, value); + return this; + } + + /** + * Getter for camp.t_registration.bed_linen. + */ + public Boolean getBedLinen() { + return (Boolean) get(20); + } + + /** + * Setter for camp.t_registration.cot. + */ + public TRegistrationRecord setCot(Boolean value) { + set(21, value); + return this; + } + + /** + * Getter for camp.t_registration.cot. + */ + public Boolean getCot() { + return (Boolean) get(21); + } + // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -330,7 +375,7 @@ public class TRegistrationRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for camp.v_version.version. + */ + public VVersionRecord setVersion(Integer value) { + set(0, value); + return this; + } + + /** + * Getter for camp.v_version.version. + */ + public Integer getVersion() { + return (Integer) get(0); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached VVersionRecord + */ + public VVersionRecord() { + super(VVersion.V_VERSION); + } + + /** + * Create a detached, initialised VVersionRecord + */ + public VVersionRecord(Integer version) { + super(VVersion.V_VERSION); + + setVersion(version); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised VVersionRecord + */ + public VVersionRecord(de.jottyfan.bico.db.camp.tables.pojos.VVersion value) { + super(VVersion.V_VERSION); + + if (value != null) { + setVersion(value.getVersion()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/java/de/jottyfan/bico/db/public_/tables/VVersion.java b/src/main/java/de/jottyfan/bico/db/public_/tables/VVersion.java index fc7f3e8..6b6b91e 100644 --- a/src/main/java/de/jottyfan/bico/db/public_/tables/VVersion.java +++ b/src/main/java/de/jottyfan/bico/db/public_/tables/VVersion.java @@ -58,7 +58,7 @@ public class VVersion extends TableImpl { private VVersion(Name alias, Table aliased, Field[] parameters, Condition where) { super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view(""" - create view "v_version" as SELECT 7 AS version; + create view "v_version" as SELECT 8 AS version; """), where); } diff --git a/src/main/resources/v8.sql b/src/main/resources/v8.sql new file mode 100644 index 0000000..44fd435 --- /dev/null +++ b/src/main/resources/v8.sql @@ -0,0 +1,6 @@ +alter table camp.t_registration add column towels boolean; +alter table camp.t_registration add column bed_linen boolean; +alter table camp.t_registration add column cot boolean; + +create or replace view v_version as +select 8 as version;