diff --git a/src/main/java/eu/dissco/orchestration/backend/database/jooq/Keys.java b/src/main/java/eu/dissco/orchestration/backend/database/jooq/Keys.java index 23dba70..cd0d5f3 100644 --- a/src/main/java/eu/dissco/orchestration/backend/database/jooq/Keys.java +++ b/src/main/java/eu/dissco/orchestration/backend/database/jooq/Keys.java @@ -5,14 +5,13 @@ import eu.dissco.orchestration.backend.database.jooq.tables.Handles; -import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServices; +import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServicesTmp; import eu.dissco.orchestration.backend.database.jooq.tables.Mapping; import eu.dissco.orchestration.backend.database.jooq.tables.SourceSystem; import eu.dissco.orchestration.backend.database.jooq.tables.records.HandlesRecord; -import eu.dissco.orchestration.backend.database.jooq.tables.records.MachineAnnotationServicesRecord; +import eu.dissco.orchestration.backend.database.jooq.tables.records.MachineAnnotationServicesTmpRecord; import eu.dissco.orchestration.backend.database.jooq.tables.records.MappingRecord; import eu.dissco.orchestration.backend.database.jooq.tables.records.SourceSystemRecord; - import org.jooq.TableField; import org.jooq.UniqueKey; import org.jooq.impl.DSL; @@ -31,7 +30,7 @@ public class Keys { // ------------------------------------------------------------------------- public static final UniqueKey HANDLES_PKEY = Internal.createUniqueKey(Handles.HANDLES, DSL.name("handles_pkey"), new TableField[] { Handles.HANDLES.HANDLE, Handles.HANDLES.IDX }, true); - public static final UniqueKey MACHINE_ANNOTATION_SERVICES_PKEY = Internal.createUniqueKey(MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES, DSL.name("machine_annotation_services_pkey"), new TableField[] { MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.ID }, true); + public static final UniqueKey MACHINE_ANNOTATION_SERVICES_TMP_PKEY = Internal.createUniqueKey(MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP, DSL.name("machine_annotation_services_tmp_pkey"), new TableField[] { MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.ID }, true); public static final UniqueKey NEW_MAPPING_PK = Internal.createUniqueKey(Mapping.MAPPING, DSL.name("new_mapping_pk"), new TableField[] { Mapping.MAPPING.ID, Mapping.MAPPING.VERSION }, true); public static final UniqueKey NEW_SOURCE_SYSTEM_PKEY = Internal.createUniqueKey(SourceSystem.SOURCE_SYSTEM, DSL.name("new_source_system_pkey"), new TableField[] { SourceSystem.SOURCE_SYSTEM.ID }, true); } diff --git a/src/main/java/eu/dissco/orchestration/backend/database/jooq/Public.java b/src/main/java/eu/dissco/orchestration/backend/database/jooq/Public.java index 8a00851..fbc9951 100644 --- a/src/main/java/eu/dissco/orchestration/backend/database/jooq/Public.java +++ b/src/main/java/eu/dissco/orchestration/backend/database/jooq/Public.java @@ -5,13 +5,11 @@ import eu.dissco.orchestration.backend.database.jooq.tables.Handles; -import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServices; +import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServicesTmp; import eu.dissco.orchestration.backend.database.jooq.tables.Mapping; import eu.dissco.orchestration.backend.database.jooq.tables.SourceSystem; - import java.util.Arrays; import java.util.List; - import org.jooq.Catalog; import org.jooq.Table; import org.jooq.impl.SchemaImpl; @@ -36,9 +34,9 @@ public class Public extends SchemaImpl { public final Handles HANDLES = Handles.HANDLES; /** - * The table public.machine_annotation_services. + * The table public.machine_annotation_services_tmp. */ - public final MachineAnnotationServices MACHINE_ANNOTATION_SERVICES = MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES; + public final MachineAnnotationServicesTmp MACHINE_ANNOTATION_SERVICES_TMP = MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP; /** * The table public.mapping. @@ -67,7 +65,7 @@ public Catalog getCatalog() { public final List> getTables() { return Arrays.asList( Handles.HANDLES, - MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES, + MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP, Mapping.MAPPING, SourceSystem.SOURCE_SYSTEM ); diff --git a/src/main/java/eu/dissco/orchestration/backend/database/jooq/Tables.java b/src/main/java/eu/dissco/orchestration/backend/database/jooq/Tables.java index b3cc42d..fb84c68 100644 --- a/src/main/java/eu/dissco/orchestration/backend/database/jooq/Tables.java +++ b/src/main/java/eu/dissco/orchestration/backend/database/jooq/Tables.java @@ -5,7 +5,7 @@ import eu.dissco.orchestration.backend.database.jooq.tables.Handles; -import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServices; +import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServicesTmp; import eu.dissco.orchestration.backend.database.jooq.tables.Mapping; import eu.dissco.orchestration.backend.database.jooq.tables.SourceSystem; @@ -22,9 +22,9 @@ public class Tables { public static final Handles HANDLES = Handles.HANDLES; /** - * The table public.machine_annotation_services. + * The table public.machine_annotation_services_tmp. */ - public static final MachineAnnotationServices MACHINE_ANNOTATION_SERVICES = MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES; + public static final MachineAnnotationServicesTmp MACHINE_ANNOTATION_SERVICES_TMP = MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP; /** * The table public.mapping. diff --git a/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/MachineAnnotationServices.java b/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/MachineAnnotationServices.java deleted file mode 100644 index 865320f..0000000 --- a/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/MachineAnnotationServices.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package eu.dissco.orchestration.backend.database.jooq.tables; - - -import eu.dissco.orchestration.backend.database.jooq.Keys; -import eu.dissco.orchestration.backend.database.jooq.Public; -import eu.dissco.orchestration.backend.database.jooq.tables.records.MachineAnnotationServicesRecord; - -import java.time.Instant; -import java.util.function.Function; - -import org.jooq.Field; -import org.jooq.ForeignKey; -import org.jooq.Function21; -import org.jooq.JSONB; -import org.jooq.Name; -import org.jooq.Record; -import org.jooq.Records; -import org.jooq.Row21; -import org.jooq.Schema; -import org.jooq.SelectField; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.UniqueKey; -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" }) -public class MachineAnnotationServices extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.machine_annotation_services - */ - public static final MachineAnnotationServices MACHINE_ANNOTATION_SERVICES = new MachineAnnotationServices(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return MachineAnnotationServicesRecord.class; - } - - /** - * The column public.machine_annotation_services.id. - */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.CLOB.nullable(false), this, ""); - - /** - * The column public.machine_annotation_services.version. - */ - public final TableField VERSION = createField(DSL.name("version"), SQLDataType.INTEGER.nullable(false), this, ""); - - /** - * The column public.machine_annotation_services.name. - */ - public final TableField NAME = createField(DSL.name("name"), SQLDataType.VARCHAR.nullable(false), this, ""); - - /** - * The column public.machine_annotation_services.created. - */ - public final TableField CREATED = createField(DSL.name("created"), SQLDataType.INSTANT.nullable(false), this, ""); - - /** - * The column public.machine_annotation_services.administrator. - */ - public final TableField ADMINISTRATOR = createField(DSL.name("administrator"), SQLDataType.CLOB.nullable(false), this, ""); - - /** - * The column - * public.machine_annotation_services.container_image. - */ - public final TableField CONTAINER_IMAGE = createField(DSL.name("container_image"), SQLDataType.CLOB.nullable(false), this, ""); - - /** - * The column - * public.machine_annotation_services.container_image_tag. - */ - public final TableField CONTAINER_IMAGE_TAG = createField(DSL.name("container_image_tag"), SQLDataType.CLOB.nullable(false), this, ""); - - /** - * The column - * public.machine_annotation_services.target_digital_object_filters. - */ - public final TableField TARGET_DIGITAL_OBJECT_FILTERS = createField(DSL.name("target_digital_object_filters"), SQLDataType.JSONB, this, ""); - - /** - * The column - * public.machine_annotation_services.service_description. - */ - public final TableField SERVICE_DESCRIPTION = createField(DSL.name("service_description"), SQLDataType.CLOB, this, ""); - - /** - * The column public.machine_annotation_services.service_state. - */ - public final TableField SERVICE_STATE = createField(DSL.name("service_state"), SQLDataType.CLOB, this, ""); - - /** - * The column - * public.machine_annotation_services.source_code_repository. - */ - public final TableField SOURCE_CODE_REPOSITORY = createField(DSL.name("source_code_repository"), SQLDataType.CLOB, this, ""); - - /** - * The column - * public.machine_annotation_services.service_availability. - */ - public final TableField SERVICE_AVAILABILITY = createField(DSL.name("service_availability"), SQLDataType.CLOB, this, ""); - - /** - * The column - * public.machine_annotation_services.code_maintainer. - */ - public final TableField CODE_MAINTAINER = createField(DSL.name("code_maintainer"), SQLDataType.CLOB, this, ""); - - /** - * The column public.machine_annotation_services.code_license. - */ - public final TableField CODE_LICENSE = createField(DSL.name("code_license"), SQLDataType.CLOB, this, ""); - - /** - * The column public.machine_annotation_services.dependencies. - */ - public final TableField DEPENDENCIES = createField(DSL.name("dependencies"), SQLDataType.CLOB.array(), this, ""); - - /** - * The column - * public.machine_annotation_services.support_contact. - */ - public final TableField SUPPORT_CONTACT = createField(DSL.name("support_contact"), SQLDataType.CLOB, this, ""); - - /** - * The column - * public.machine_annotation_services.sla_documentation. - */ - public final TableField SLA_DOCUMENTATION = createField(DSL.name("sla_documentation"), SQLDataType.CLOB, this, ""); - - /** - * The column public.machine_annotation_services.topicname. - */ - public final TableField TOPICNAME = createField(DSL.name("topicname"), SQLDataType.CLOB, this, ""); - - /** - * The column public.machine_annotation_services.maxreplicas. - */ - public final TableField MAXREPLICAS = createField(DSL.name("maxreplicas"), SQLDataType.INTEGER, this, ""); - - /** - * The column public.machine_annotation_services.deleted_on. - */ - public final TableField DELETED_ON = createField(DSL.name("deleted_on"), SQLDataType.INSTANT, this, ""); - - /** - * The column public.machine_annotation_services.mas_input. - * Optional information used to create elastic query for batch annotations - */ - public final TableField MAS_INPUT = createField(DSL.name("mas_input"), SQLDataType.JSONB, this, "Optional information used to create elastic query for batch annotations"); - - private MachineAnnotationServices(Name alias, Table aliased) { - this(alias, aliased, null); - } - - private MachineAnnotationServices(Name alias, Table aliased, Field[] parameters) { - super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table()); - } - - /** - * Create an aliased public.machine_annotation_services table - * reference - */ - public MachineAnnotationServices(String alias) { - this(DSL.name(alias), MACHINE_ANNOTATION_SERVICES); - } - - /** - * Create an aliased public.machine_annotation_services table - * reference - */ - public MachineAnnotationServices(Name alias) { - this(alias, MACHINE_ANNOTATION_SERVICES); - } - - /** - * Create a public.machine_annotation_services table reference - */ - public MachineAnnotationServices() { - this(DSL.name("machine_annotation_services"), null); - } - - public MachineAnnotationServices(Table child, ForeignKey key) { - super(child, key, MACHINE_ANNOTATION_SERVICES); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public UniqueKey getPrimaryKey() { - return Keys.MACHINE_ANNOTATION_SERVICES_PKEY; - } - - @Override - public MachineAnnotationServices as(String alias) { - return new MachineAnnotationServices(DSL.name(alias), this); - } - - @Override - public MachineAnnotationServices as(Name alias) { - return new MachineAnnotationServices(alias, this); - } - - @Override - public MachineAnnotationServices as(Table alias) { - return new MachineAnnotationServices(alias.getQualifiedName(), this); - } - - /** - * Rename this table - */ - @Override - public MachineAnnotationServices rename(String name) { - return new MachineAnnotationServices(DSL.name(name), null); - } - - /** - * Rename this table - */ - @Override - public MachineAnnotationServices rename(Name name) { - return new MachineAnnotationServices(name, null); - } - - /** - * Rename this table - */ - @Override - public MachineAnnotationServices rename(Table name) { - return new MachineAnnotationServices(name.getQualifiedName(), null); - } - - // ------------------------------------------------------------------------- - // Row21 type methods - // ------------------------------------------------------------------------- - - @Override - public Row21 fieldsRow() { - return (Row21) super.fieldsRow(); - } - - /** - * Convenience mapping calling {@link SelectField#convertFrom(Function)}. - */ - public SelectField mapping(Function21 from) { - return convertFrom(Records.mapping(from)); - } - - /** - * Convenience mapping calling {@link SelectField#convertFrom(Class, - * Function)}. - */ - public SelectField mapping(Class toType, Function21 from) { - return convertFrom(toType, Records.mapping(from)); - } -} diff --git a/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/MachineAnnotationServicesTmp.java b/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/MachineAnnotationServicesTmp.java new file mode 100644 index 0000000..bcf8678 --- /dev/null +++ b/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/MachineAnnotationServicesTmp.java @@ -0,0 +1,282 @@ +/* + * This file is generated by jOOQ. + */ +package eu.dissco.orchestration.backend.database.jooq.tables; + + +import eu.dissco.orchestration.backend.database.jooq.Keys; +import eu.dissco.orchestration.backend.database.jooq.Public; +import eu.dissco.orchestration.backend.database.jooq.tables.records.MachineAnnotationServicesTmpRecord; +import java.time.Instant; +import java.util.function.Function; +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Function21; +import org.jooq.JSONB; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Records; +import org.jooq.Row21; +import org.jooq.Schema; +import org.jooq.SelectField; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +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" }) +public class MachineAnnotationServicesTmp extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of + * public.machine_annotation_services_tmp + */ + public static final MachineAnnotationServicesTmp MACHINE_ANNOTATION_SERVICES_TMP = new MachineAnnotationServicesTmp(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return MachineAnnotationServicesTmpRecord.class; + } + + /** + * The column public.machine_annotation_services_tmp.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column public.machine_annotation_services_tmp.version. + */ + public final TableField VERSION = createField(DSL.name("version"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column public.machine_annotation_services_tmp.name. + */ + public final TableField NAME = createField(DSL.name("name"), SQLDataType.VARCHAR.nullable(false), this, ""); + + /** + * The column public.machine_annotation_services_tmp.created. + */ + public final TableField CREATED = createField(DSL.name("created"), SQLDataType.INSTANT.nullable(false), this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.administrator. + */ + public final TableField ADMINISTRATOR = createField(DSL.name("administrator"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.container_image. + */ + public final TableField CONTAINER_IMAGE = createField(DSL.name("container_image"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.container_image_tag. + */ + public final TableField CONTAINER_IMAGE_TAG = createField(DSL.name("container_image_tag"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.target_digital_object_filters. + */ + public final TableField TARGET_DIGITAL_OBJECT_FILTERS = createField(DSL.name("target_digital_object_filters"), SQLDataType.JSONB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.service_description. + */ + public final TableField SERVICE_DESCRIPTION = createField(DSL.name("service_description"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.service_state. + */ + public final TableField SERVICE_STATE = createField(DSL.name("service_state"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.source_code_repository. + */ + public final TableField SOURCE_CODE_REPOSITORY = createField(DSL.name("source_code_repository"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.service_availability. + */ + public final TableField SERVICE_AVAILABILITY = createField(DSL.name("service_availability"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.code_maintainer. + */ + public final TableField CODE_MAINTAINER = createField(DSL.name("code_maintainer"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.code_license. + */ + public final TableField CODE_LICENSE = createField(DSL.name("code_license"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.dependencies. + */ + public final TableField DEPENDENCIES = createField(DSL.name("dependencies"), SQLDataType.CLOB.array(), this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.support_contact. + */ + public final TableField SUPPORT_CONTACT = createField(DSL.name("support_contact"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.sla_documentation. + */ + public final TableField SLA_DOCUMENTATION = createField(DSL.name("sla_documentation"), SQLDataType.CLOB, this, ""); + + /** + * The column public.machine_annotation_services_tmp.topicname. + */ + public final TableField TOPICNAME = createField(DSL.name("topicname"), SQLDataType.CLOB, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.maxreplicas. + */ + public final TableField MAXREPLICAS = createField(DSL.name("maxreplicas"), SQLDataType.INTEGER, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.deleted_on. + */ + public final TableField DELETED_ON = createField(DSL.name("deleted_on"), SQLDataType.INSTANT, this, ""); + + /** + * The column + * public.machine_annotation_services_tmp.batching_permitted. + */ + public final TableField BATCHING_PERMITTED = createField(DSL.name("batching_permitted"), SQLDataType.BOOLEAN.nullable(false), this, ""); + + private MachineAnnotationServicesTmp(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private MachineAnnotationServicesTmp(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table()); + } + + /** + * Create an aliased public.machine_annotation_services_tmp + * table reference + */ + public MachineAnnotationServicesTmp(String alias) { + this(DSL.name(alias), MACHINE_ANNOTATION_SERVICES_TMP); + } + + /** + * Create an aliased public.machine_annotation_services_tmp + * table reference + */ + public MachineAnnotationServicesTmp(Name alias) { + this(alias, MACHINE_ANNOTATION_SERVICES_TMP); + } + + /** + * Create a public.machine_annotation_services_tmp table + * reference + */ + public MachineAnnotationServicesTmp() { + this(DSL.name("machine_annotation_services_tmp"), null); + } + + public MachineAnnotationServicesTmp(Table child, ForeignKey key) { + super(child, key, MACHINE_ANNOTATION_SERVICES_TMP); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.MACHINE_ANNOTATION_SERVICES_TMP_PKEY; + } + + @Override + public MachineAnnotationServicesTmp as(String alias) { + return new MachineAnnotationServicesTmp(DSL.name(alias), this); + } + + @Override + public MachineAnnotationServicesTmp as(Name alias) { + return new MachineAnnotationServicesTmp(alias, this); + } + + @Override + public MachineAnnotationServicesTmp as(Table alias) { + return new MachineAnnotationServicesTmp(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public MachineAnnotationServicesTmp rename(String name) { + return new MachineAnnotationServicesTmp(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public MachineAnnotationServicesTmp rename(Name name) { + return new MachineAnnotationServicesTmp(name, null); + } + + /** + * Rename this table + */ + @Override + public MachineAnnotationServicesTmp rename(Table name) { + return new MachineAnnotationServicesTmp(name.getQualifiedName(), null); + } + + // ------------------------------------------------------------------------- + // Row21 type methods + // ------------------------------------------------------------------------- + + @Override + public Row21 fieldsRow() { + return (Row21) super.fieldsRow(); + } + + /** + * Convenience mapping calling {@link SelectField#convertFrom(Function)}. + */ + public SelectField mapping(Function21 from) { + return convertFrom(Records.mapping(from)); + } + + /** + * Convenience mapping calling {@link SelectField#convertFrom(Class, + * Function)}. + */ + public SelectField mapping(Class toType, Function21 from) { + return convertFrom(toType, Records.mapping(from)); + } +} diff --git a/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/records/MachineAnnotationServicesRecord.java b/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/records/MachineAnnotationServicesTmpRecord.java similarity index 60% rename from src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/records/MachineAnnotationServicesRecord.java rename to src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/records/MachineAnnotationServicesTmpRecord.java index 1541e0c..8add7ff 100644 --- a/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/records/MachineAnnotationServicesRecord.java +++ b/src/main/java/eu/dissco/orchestration/backend/database/jooq/tables/records/MachineAnnotationServicesTmpRecord.java @@ -4,7 +4,7 @@ package eu.dissco.orchestration.backend.database.jooq.tables.records; -import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServices; +import eu.dissco.orchestration.backend.database.jooq.tables.MachineAnnotationServicesTmp; import java.time.Instant; @@ -20,75 +20,77 @@ * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class MachineAnnotationServicesRecord extends UpdatableRecordImpl implements Record21 { +public class MachineAnnotationServicesTmpRecord extends UpdatableRecordImpl implements Record21 { private static final long serialVersionUID = 1L; /** - * Setter for public.machine_annotation_services.id. + * Setter for public.machine_annotation_services_tmp.id. */ public void setId(String value) { set(0, value); } /** - * Getter for public.machine_annotation_services.id. + * Getter for public.machine_annotation_services_tmp.id. */ public String getId() { return (String) get(0); } /** - * Setter for public.machine_annotation_services.version. + * Setter for public.machine_annotation_services_tmp.version. */ public void setVersion(Integer value) { set(1, value); } /** - * Getter for public.machine_annotation_services.version. + * Getter for public.machine_annotation_services_tmp.version. */ public Integer getVersion() { return (Integer) get(1); } /** - * Setter for public.machine_annotation_services.name. + * Setter for public.machine_annotation_services_tmp.name. */ public void setName(String value) { set(2, value); } /** - * Getter for public.machine_annotation_services.name. + * Getter for public.machine_annotation_services_tmp.name. */ public String getName() { return (String) get(2); } /** - * Setter for public.machine_annotation_services.created. + * Setter for public.machine_annotation_services_tmp.created. */ public void setCreated(Instant value) { set(3, value); } /** - * Getter for public.machine_annotation_services.created. + * Getter for public.machine_annotation_services_tmp.created. */ public Instant getCreated() { return (Instant) get(3); } /** - * Setter for public.machine_annotation_services.administrator. + * Setter for + * public.machine_annotation_services_tmp.administrator. */ public void setAdministrator(String value) { set(4, value); } /** - * Getter for public.machine_annotation_services.administrator. + * Getter for + * public.machine_annotation_services_tmp.administrator. */ public String getAdministrator() { return (String) get(4); @@ -96,7 +98,7 @@ public String getAdministrator() { /** * Setter for - * public.machine_annotation_services.container_image. + * public.machine_annotation_services_tmp.container_image. */ public void setContainerImage(String value) { set(5, value); @@ -104,7 +106,7 @@ public void setContainerImage(String value) { /** * Getter for - * public.machine_annotation_services.container_image. + * public.machine_annotation_services_tmp.container_image. */ public String getContainerImage() { return (String) get(5); @@ -112,7 +114,7 @@ public String getContainerImage() { /** * Setter for - * public.machine_annotation_services.container_image_tag. + * public.machine_annotation_services_tmp.container_image_tag. */ public void setContainerImageTag(String value) { set(6, value); @@ -120,7 +122,7 @@ public void setContainerImageTag(String value) { /** * Getter for - * public.machine_annotation_services.container_image_tag. + * public.machine_annotation_services_tmp.container_image_tag. */ public String getContainerImageTag() { return (String) get(6); @@ -128,7 +130,7 @@ public String getContainerImageTag() { /** * Setter for - * public.machine_annotation_services.target_digital_object_filters. + * public.machine_annotation_services_tmp.target_digital_object_filters. */ public void setTargetDigitalObjectFilters(JSONB value) { set(7, value); @@ -136,7 +138,7 @@ public void setTargetDigitalObjectFilters(JSONB value) { /** * Getter for - * public.machine_annotation_services.target_digital_object_filters. + * public.machine_annotation_services_tmp.target_digital_object_filters. */ public JSONB getTargetDigitalObjectFilters() { return (JSONB) get(7); @@ -144,7 +146,7 @@ public JSONB getTargetDigitalObjectFilters() { /** * Setter for - * public.machine_annotation_services.service_description. + * public.machine_annotation_services_tmp.service_description. */ public void setServiceDescription(String value) { set(8, value); @@ -152,21 +154,23 @@ public void setServiceDescription(String value) { /** * Getter for - * public.machine_annotation_services.service_description. + * public.machine_annotation_services_tmp.service_description. */ public String getServiceDescription() { return (String) get(8); } /** - * Setter for public.machine_annotation_services.service_state. + * Setter for + * public.machine_annotation_services_tmp.service_state. */ public void setServiceState(String value) { set(9, value); } /** - * Getter for public.machine_annotation_services.service_state. + * Getter for + * public.machine_annotation_services_tmp.service_state. */ public String getServiceState() { return (String) get(9); @@ -174,7 +178,7 @@ public String getServiceState() { /** * Setter for - * public.machine_annotation_services.source_code_repository. + * public.machine_annotation_services_tmp.source_code_repository. */ public void setSourceCodeRepository(String value) { set(10, value); @@ -182,7 +186,7 @@ public void setSourceCodeRepository(String value) { /** * Getter for - * public.machine_annotation_services.source_code_repository. + * public.machine_annotation_services_tmp.source_code_repository. */ public String getSourceCodeRepository() { return (String) get(10); @@ -190,7 +194,7 @@ public String getSourceCodeRepository() { /** * Setter for - * public.machine_annotation_services.service_availability. + * public.machine_annotation_services_tmp.service_availability. */ public void setServiceAvailability(String value) { set(11, value); @@ -198,7 +202,7 @@ public void setServiceAvailability(String value) { /** * Getter for - * public.machine_annotation_services.service_availability. + * public.machine_annotation_services_tmp.service_availability. */ public String getServiceAvailability() { return (String) get(11); @@ -206,7 +210,7 @@ public String getServiceAvailability() { /** * Setter for - * public.machine_annotation_services.code_maintainer. + * public.machine_annotation_services_tmp.code_maintainer. */ public void setCodeMaintainer(String value) { set(12, value); @@ -214,35 +218,39 @@ public void setCodeMaintainer(String value) { /** * Getter for - * public.machine_annotation_services.code_maintainer. + * public.machine_annotation_services_tmp.code_maintainer. */ public String getCodeMaintainer() { return (String) get(12); } /** - * Setter for public.machine_annotation_services.code_license. + * Setter for + * public.machine_annotation_services_tmp.code_license. */ public void setCodeLicense(String value) { set(13, value); } /** - * Getter for public.machine_annotation_services.code_license. + * Getter for + * public.machine_annotation_services_tmp.code_license. */ public String getCodeLicense() { return (String) get(13); } /** - * Setter for public.machine_annotation_services.dependencies. + * Setter for + * public.machine_annotation_services_tmp.dependencies. */ public void setDependencies(String[] value) { set(14, value); } /** - * Getter for public.machine_annotation_services.dependencies. + * Getter for + * public.machine_annotation_services_tmp.dependencies. */ public String[] getDependencies() { return (String[]) get(14); @@ -250,7 +258,7 @@ public String[] getDependencies() { /** * Setter for - * public.machine_annotation_services.support_contact. + * public.machine_annotation_services_tmp.support_contact. */ public void setSupportContact(String value) { set(15, value); @@ -258,7 +266,7 @@ public void setSupportContact(String value) { /** * Getter for - * public.machine_annotation_services.support_contact. + * public.machine_annotation_services_tmp.support_contact. */ public String getSupportContact() { return (String) get(15); @@ -266,7 +274,7 @@ public String getSupportContact() { /** * Setter for - * public.machine_annotation_services.sla_documentation. + * public.machine_annotation_services_tmp.sla_documentation. */ public void setSlaDocumentation(String value) { set(16, value); @@ -274,68 +282,72 @@ public void setSlaDocumentation(String value) { /** * Getter for - * public.machine_annotation_services.sla_documentation. + * public.machine_annotation_services_tmp.sla_documentation. */ public String getSlaDocumentation() { return (String) get(16); } /** - * Setter for public.machine_annotation_services.topicname. + * Setter for public.machine_annotation_services_tmp.topicname. */ public void setTopicname(String value) { set(17, value); } /** - * Getter for public.machine_annotation_services.topicname. + * Getter for public.machine_annotation_services_tmp.topicname. */ public String getTopicname() { return (String) get(17); } /** - * Setter for public.machine_annotation_services.maxreplicas. + * Setter for + * public.machine_annotation_services_tmp.maxreplicas. */ public void setMaxreplicas(Integer value) { set(18, value); } /** - * Getter for public.machine_annotation_services.maxreplicas. + * Getter for + * public.machine_annotation_services_tmp.maxreplicas. */ public Integer getMaxreplicas() { return (Integer) get(18); } /** - * Setter for public.machine_annotation_services.deleted_on. + * Setter for + * public.machine_annotation_services_tmp.deleted_on. */ public void setDeletedOn(Instant value) { set(19, value); } /** - * Getter for public.machine_annotation_services.deleted_on. + * Getter for + * public.machine_annotation_services_tmp.deleted_on. */ public Instant getDeletedOn() { return (Instant) get(19); } /** - * Setter for public.machine_annotation_services.mas_input. - * Optional information used to create elastic query for batch annotations + * Setter for + * public.machine_annotation_services_tmp.batching_permitted. */ - public void setMasInput(JSONB value) { + public void setBatchingPermitted(Boolean value) { set(20, value); } /** - * Getter for public.machine_annotation_services.mas_input. - * Optional information used to create elastic query for batch annotations + * Getter for + * public.machine_annotation_services_tmp.batching_permitted. */ - public JSONB getMasInput() { - return (JSONB) get(20); + public Boolean getBatchingPermitted() { + return (Boolean) get(20); } // ------------------------------------------------------------------------- @@ -352,118 +364,118 @@ public Record1 key() { // ------------------------------------------------------------------------- @Override - public Row21 fieldsRow() { + public Row21 fieldsRow() { return (Row21) super.fieldsRow(); } @Override - public Row21 valuesRow() { + public Row21 valuesRow() { return (Row21) super.valuesRow(); } @Override public Field field1() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.ID; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.ID; } @Override public Field field2() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.VERSION; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.VERSION; } @Override public Field field3() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.NAME; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.NAME; } @Override public Field field4() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.CREATED; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.CREATED; } @Override public Field field5() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.ADMINISTRATOR; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.ADMINISTRATOR; } @Override public Field field6() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.CONTAINER_IMAGE; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.CONTAINER_IMAGE; } @Override public Field field7() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.CONTAINER_IMAGE_TAG; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.CONTAINER_IMAGE_TAG; } @Override public Field field8() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.TARGET_DIGITAL_OBJECT_FILTERS; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.TARGET_DIGITAL_OBJECT_FILTERS; } @Override public Field field9() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.SERVICE_DESCRIPTION; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_DESCRIPTION; } @Override public Field field10() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.SERVICE_STATE; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_STATE; } @Override public Field field11() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.SOURCE_CODE_REPOSITORY; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.SOURCE_CODE_REPOSITORY; } @Override public Field field12() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.SERVICE_AVAILABILITY; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_AVAILABILITY; } @Override public Field field13() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.CODE_MAINTAINER; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.CODE_MAINTAINER; } @Override public Field field14() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.CODE_LICENSE; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.CODE_LICENSE; } @Override public Field field15() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.DEPENDENCIES; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.DEPENDENCIES; } @Override public Field field16() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.SUPPORT_CONTACT; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.SUPPORT_CONTACT; } @Override public Field field17() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.SLA_DOCUMENTATION; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.SLA_DOCUMENTATION; } @Override public Field field18() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.TOPICNAME; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.TOPICNAME; } @Override public Field field19() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.MAXREPLICAS; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.MAXREPLICAS; } @Override public Field field20() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.DELETED_ON; + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.DELETED_ON; } @Override - public Field field21() { - return MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES.MAS_INPUT; + public Field field21() { + return MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP.BATCHING_PERMITTED; } @Override @@ -567,8 +579,8 @@ public Instant component20() { } @Override - public JSONB component21() { - return getMasInput(); + public Boolean component21() { + return getBatchingPermitted(); } @Override @@ -672,138 +684,138 @@ public Instant value20() { } @Override - public JSONB value21() { - return getMasInput(); + public Boolean value21() { + return getBatchingPermitted(); } @Override - public MachineAnnotationServicesRecord value1(String value) { + public MachineAnnotationServicesTmpRecord value1(String value) { setId(value); return this; } @Override - public MachineAnnotationServicesRecord value2(Integer value) { + public MachineAnnotationServicesTmpRecord value2(Integer value) { setVersion(value); return this; } @Override - public MachineAnnotationServicesRecord value3(String value) { + public MachineAnnotationServicesTmpRecord value3(String value) { setName(value); return this; } @Override - public MachineAnnotationServicesRecord value4(Instant value) { + public MachineAnnotationServicesTmpRecord value4(Instant value) { setCreated(value); return this; } @Override - public MachineAnnotationServicesRecord value5(String value) { + public MachineAnnotationServicesTmpRecord value5(String value) { setAdministrator(value); return this; } @Override - public MachineAnnotationServicesRecord value6(String value) { + public MachineAnnotationServicesTmpRecord value6(String value) { setContainerImage(value); return this; } @Override - public MachineAnnotationServicesRecord value7(String value) { + public MachineAnnotationServicesTmpRecord value7(String value) { setContainerImageTag(value); return this; } @Override - public MachineAnnotationServicesRecord value8(JSONB value) { + public MachineAnnotationServicesTmpRecord value8(JSONB value) { setTargetDigitalObjectFilters(value); return this; } @Override - public MachineAnnotationServicesRecord value9(String value) { + public MachineAnnotationServicesTmpRecord value9(String value) { setServiceDescription(value); return this; } @Override - public MachineAnnotationServicesRecord value10(String value) { + public MachineAnnotationServicesTmpRecord value10(String value) { setServiceState(value); return this; } @Override - public MachineAnnotationServicesRecord value11(String value) { + public MachineAnnotationServicesTmpRecord value11(String value) { setSourceCodeRepository(value); return this; } @Override - public MachineAnnotationServicesRecord value12(String value) { + public MachineAnnotationServicesTmpRecord value12(String value) { setServiceAvailability(value); return this; } @Override - public MachineAnnotationServicesRecord value13(String value) { + public MachineAnnotationServicesTmpRecord value13(String value) { setCodeMaintainer(value); return this; } @Override - public MachineAnnotationServicesRecord value14(String value) { + public MachineAnnotationServicesTmpRecord value14(String value) { setCodeLicense(value); return this; } @Override - public MachineAnnotationServicesRecord value15(String[] value) { + public MachineAnnotationServicesTmpRecord value15(String[] value) { setDependencies(value); return this; } @Override - public MachineAnnotationServicesRecord value16(String value) { + public MachineAnnotationServicesTmpRecord value16(String value) { setSupportContact(value); return this; } @Override - public MachineAnnotationServicesRecord value17(String value) { + public MachineAnnotationServicesTmpRecord value17(String value) { setSlaDocumentation(value); return this; } @Override - public MachineAnnotationServicesRecord value18(String value) { + public MachineAnnotationServicesTmpRecord value18(String value) { setTopicname(value); return this; } @Override - public MachineAnnotationServicesRecord value19(Integer value) { + public MachineAnnotationServicesTmpRecord value19(Integer value) { setMaxreplicas(value); return this; } @Override - public MachineAnnotationServicesRecord value20(Instant value) { + public MachineAnnotationServicesTmpRecord value20(Instant value) { setDeletedOn(value); return this; } @Override - public MachineAnnotationServicesRecord value21(JSONB value) { - setMasInput(value); + public MachineAnnotationServicesTmpRecord value21(Boolean value) { + setBatchingPermitted(value); return this; } @Override - public MachineAnnotationServicesRecord values(String value1, Integer value2, String value3, Instant value4, String value5, String value6, String value7, JSONB value8, String value9, String value10, String value11, String value12, String value13, String value14, String[] value15, String value16, String value17, String value18, Integer value19, Instant value20, JSONB value21) { + public MachineAnnotationServicesTmpRecord values(String value1, Integer value2, String value3, Instant value4, String value5, String value6, String value7, JSONB value8, String value9, String value10, String value11, String value12, String value13, String value14, String[] value15, String value16, String value17, String value18, Integer value19, Instant value20, Boolean value21) { value1(value1); value2(value2); value3(value3); @@ -833,17 +845,17 @@ public MachineAnnotationServicesRecord values(String value1, Integer value2, Str // ------------------------------------------------------------------------- /** - * Create a detached MachineAnnotationServicesRecord + * Create a detached MachineAnnotationServicesTmpRecord */ - public MachineAnnotationServicesRecord() { - super(MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES); + public MachineAnnotationServicesTmpRecord() { + super(MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP); } /** - * Create a detached, initialised MachineAnnotationServicesRecord + * Create a detached, initialised MachineAnnotationServicesTmpRecord */ - public MachineAnnotationServicesRecord(String id, Integer version, String name, Instant created, String administrator, String containerImage, String containerImageTag, JSONB targetDigitalObjectFilters, String serviceDescription, String serviceState, String sourceCodeRepository, String serviceAvailability, String codeMaintainer, String codeLicense, String[] dependencies, String supportContact, String slaDocumentation, String topicname, Integer maxreplicas, Instant deletedOn, JSONB masInput) { - super(MachineAnnotationServices.MACHINE_ANNOTATION_SERVICES); + public MachineAnnotationServicesTmpRecord(String id, Integer version, String name, Instant created, String administrator, String containerImage, String containerImageTag, JSONB targetDigitalObjectFilters, String serviceDescription, String serviceState, String sourceCodeRepository, String serviceAvailability, String codeMaintainer, String codeLicense, String[] dependencies, String supportContact, String slaDocumentation, String topicname, Integer maxreplicas, Instant deletedOn, Boolean batchingPermitted) { + super(MachineAnnotationServicesTmp.MACHINE_ANNOTATION_SERVICES_TMP); setId(id); setVersion(version); @@ -865,7 +877,7 @@ public MachineAnnotationServicesRecord(String id, Integer version, String name, setTopicname(topicname); setMaxreplicas(maxreplicas); setDeletedOn(deletedOn); - setMasInput(masInput); + setBatchingPermitted(batchingPermitted); resetChangedOnNotNull(); } } diff --git a/src/main/java/eu/dissco/orchestration/backend/domain/MachineAnnotationService.java b/src/main/java/eu/dissco/orchestration/backend/domain/MachineAnnotationService.java index bc5eeb4..731d1a8 100644 --- a/src/main/java/eu/dissco/orchestration/backend/domain/MachineAnnotationService.java +++ b/src/main/java/eu/dissco/orchestration/backend/domain/MachineAnnotationService.java @@ -25,5 +25,5 @@ public final class MachineAnnotationService { private final String slaDocumentation; private String topicName; private int maxReplicas; - private MasInput masInput; + private @NotBlank boolean batchingPermitted; } diff --git a/src/main/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepository.java b/src/main/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepository.java index 42019f6..b4320a5 100644 --- a/src/main/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepository.java +++ b/src/main/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepository.java @@ -1,15 +1,14 @@ package eu.dissco.orchestration.backend.repository; -import static eu.dissco.orchestration.backend.database.jooq.Tables.MACHINE_ANNOTATION_SERVICES; +import static eu.dissco.orchestration.backend.database.jooq.Tables.MACHINE_ANNOTATION_SERVICES_TMP; import static eu.dissco.orchestration.backend.repository.RepositoryUtils.getOffset; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import eu.dissco.orchestration.backend.database.jooq.tables.records.MachineAnnotationServicesRecord; +import eu.dissco.orchestration.backend.database.jooq.tables.records.MachineAnnotationServicesTmpRecord; import eu.dissco.orchestration.backend.domain.MachineAnnotationService; import eu.dissco.orchestration.backend.domain.MachineAnnotationServiceRecord; -import eu.dissco.orchestration.backend.domain.MasInput; import eu.dissco.orchestration.backend.exception.DisscoJsonBMappingException; import java.time.Instant; import java.util.Arrays; @@ -28,94 +27,77 @@ public class MachineAnnotationServiceRepository { private final ObjectMapper mapper; public void createMachineAnnotationService(MachineAnnotationServiceRecord masRecord) { - context.insertInto(MACHINE_ANNOTATION_SERVICES) - .set(MACHINE_ANNOTATION_SERVICES.ID, masRecord.id()) - .set(MACHINE_ANNOTATION_SERVICES.VERSION, masRecord.version()) - .set(MACHINE_ANNOTATION_SERVICES.NAME, masRecord.mas().getName()) - .set(MACHINE_ANNOTATION_SERVICES.CREATED, masRecord.created()) - .set(MACHINE_ANNOTATION_SERVICES.ADMINISTRATOR, masRecord.administrator()) - .set(MACHINE_ANNOTATION_SERVICES.CONTAINER_IMAGE, masRecord.mas().getContainerImage()) - .set(MACHINE_ANNOTATION_SERVICES.CONTAINER_IMAGE_TAG, masRecord.mas().getContainerTag()) - .set(MACHINE_ANNOTATION_SERVICES.TARGET_DIGITAL_OBJECT_FILTERS, + context.insertInto(MACHINE_ANNOTATION_SERVICES_TMP) + .set(MACHINE_ANNOTATION_SERVICES_TMP.ID, masRecord.id()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.VERSION, masRecord.version()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.NAME, masRecord.mas().getName()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CREATED, masRecord.created()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.ADMINISTRATOR, masRecord.administrator()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CONTAINER_IMAGE, masRecord.mas().getContainerImage()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CONTAINER_IMAGE_TAG, masRecord.mas().getContainerTag()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.TARGET_DIGITAL_OBJECT_FILTERS, masRecord.mas().getTargetDigitalObjectFilters() != null ? JSONB.jsonb( masRecord.mas().getTargetDigitalObjectFilters().toString()) : null ) - .set(MACHINE_ANNOTATION_SERVICES.SERVICE_DESCRIPTION, + .set(MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_DESCRIPTION, masRecord.mas().getServiceDescription()) - .set(MACHINE_ANNOTATION_SERVICES.SERVICE_STATE, masRecord.mas().getServiceState()) - .set(MACHINE_ANNOTATION_SERVICES.SERVICE_AVAILABILITY, + .set(MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_STATE, masRecord.mas().getServiceState()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_AVAILABILITY, masRecord.mas().getServiceAvailability()) - .set(MACHINE_ANNOTATION_SERVICES.SOURCE_CODE_REPOSITORY, + .set(MACHINE_ANNOTATION_SERVICES_TMP.SOURCE_CODE_REPOSITORY, masRecord.mas().getSourceCodeRepository()) - .set(MACHINE_ANNOTATION_SERVICES.CODE_MAINTAINER, masRecord.mas().getCodeMaintainer()) - .set(MACHINE_ANNOTATION_SERVICES.CODE_LICENSE, masRecord.mas().getCodeLicense()) - .set(MACHINE_ANNOTATION_SERVICES.DEPENDENCIES, + .set(MACHINE_ANNOTATION_SERVICES_TMP.CODE_MAINTAINER, masRecord.mas().getCodeMaintainer()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CODE_LICENSE, masRecord.mas().getCodeLicense()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.DEPENDENCIES, masRecord.mas().getDependencies() != null ? masRecord.mas().getDependencies() .toArray(new String[0]) : null ) - .set(MACHINE_ANNOTATION_SERVICES.SUPPORT_CONTACT, masRecord.mas().getSupportContact()) - .set(MACHINE_ANNOTATION_SERVICES.SLA_DOCUMENTATION, masRecord.mas().getSlaDocumentation()) - .set(MACHINE_ANNOTATION_SERVICES.TOPICNAME, masRecord.mas().getTopicName()) - .set(MACHINE_ANNOTATION_SERVICES.MAXREPLICAS, masRecord.mas().getMaxReplicas()) - .set(MACHINE_ANNOTATION_SERVICES.DELETED_ON, masRecord.deleted()) - .set(MACHINE_ANNOTATION_SERVICES.MAS_INPUT, setToJSONB(masRecord.mas().getMasInput())) + .set(MACHINE_ANNOTATION_SERVICES_TMP.SUPPORT_CONTACT, masRecord.mas().getSupportContact()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.SLA_DOCUMENTATION, masRecord.mas().getSlaDocumentation()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.TOPICNAME, masRecord.mas().getTopicName()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.MAXREPLICAS, masRecord.mas().getMaxReplicas()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.DELETED_ON, masRecord.deleted()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.BATCHING_PERMITTED, masRecord.mas().isBatchingPermitted()) .execute(); } - private JSONB setToJSONB(MasInput masInput) { - try { - return masInput != null ? JSONB.jsonb(mapper.writeValueAsString(masInput)) : null; - } catch (JsonProcessingException e) { - throw new DisscoJsonBMappingException("Failed to parse field to jsonb: " + masInput, e); - } - } - public Optional getActiveMachineAnnotationService(String id) { - return context.selectFrom(MACHINE_ANNOTATION_SERVICES) - .where(MACHINE_ANNOTATION_SERVICES.ID.eq(id)) - .and(MACHINE_ANNOTATION_SERVICES.DELETED_ON.isNull()) + return context.selectFrom(MACHINE_ANNOTATION_SERVICES_TMP) + .where(MACHINE_ANNOTATION_SERVICES_TMP.ID.eq(id)) + .and(MACHINE_ANNOTATION_SERVICES_TMP.DELETED_ON.isNull()) .fetchOptional(this::mapToMasRecord); } private MachineAnnotationServiceRecord mapToMasRecord( - MachineAnnotationServicesRecord machineAnnotationServicesRecord) { + MachineAnnotationServicesTmpRecord machineAnnotationServicesTmpRecord) { return new MachineAnnotationServiceRecord( - machineAnnotationServicesRecord.getId(), - machineAnnotationServicesRecord.getVersion(), - machineAnnotationServicesRecord.getCreated(), - machineAnnotationServicesRecord.getAdministrator(), + machineAnnotationServicesTmpRecord.getId(), + machineAnnotationServicesTmpRecord.getVersion(), + machineAnnotationServicesTmpRecord.getCreated(), + machineAnnotationServicesTmpRecord.getAdministrator(), new MachineAnnotationService( - machineAnnotationServicesRecord.getName(), - machineAnnotationServicesRecord.getContainerImage(), - machineAnnotationServicesRecord.getContainerImageTag(), - mapToJson(machineAnnotationServicesRecord.getTargetDigitalObjectFilters()), - machineAnnotationServicesRecord.getServiceDescription(), - machineAnnotationServicesRecord.getServiceState(), - machineAnnotationServicesRecord.getSourceCodeRepository(), - machineAnnotationServicesRecord.getServiceAvailability(), - machineAnnotationServicesRecord.getCodeMaintainer(), - machineAnnotationServicesRecord.getCodeLicense(), - machineAnnotationServicesRecord.getDependencies() != null ? Arrays.stream( - machineAnnotationServicesRecord.getDependencies()).toList() : null, - machineAnnotationServicesRecord.getSupportContact(), - machineAnnotationServicesRecord.getSlaDocumentation(), - machineAnnotationServicesRecord.getTopicname(), - machineAnnotationServicesRecord.getMaxreplicas(), - mapToMasInput(machineAnnotationServicesRecord.getMasInput()) + machineAnnotationServicesTmpRecord.getName(), + machineAnnotationServicesTmpRecord.getContainerImage(), + machineAnnotationServicesTmpRecord.getContainerImageTag(), + mapToJson(machineAnnotationServicesTmpRecord.getTargetDigitalObjectFilters()), + machineAnnotationServicesTmpRecord.getServiceDescription(), + machineAnnotationServicesTmpRecord.getServiceState(), + machineAnnotationServicesTmpRecord.getSourceCodeRepository(), + machineAnnotationServicesTmpRecord.getServiceAvailability(), + machineAnnotationServicesTmpRecord.getCodeMaintainer(), + machineAnnotationServicesTmpRecord.getCodeLicense(), + machineAnnotationServicesTmpRecord.getDependencies() != null ? Arrays.stream( + machineAnnotationServicesTmpRecord.getDependencies()).toList() : null, + machineAnnotationServicesTmpRecord.getSupportContact(), + machineAnnotationServicesTmpRecord.getSlaDocumentation(), + machineAnnotationServicesTmpRecord.getTopicname(), + machineAnnotationServicesTmpRecord.getMaxreplicas(), + machineAnnotationServicesTmpRecord.getBatchingPermitted() ), - machineAnnotationServicesRecord.getDeletedOn() + machineAnnotationServicesTmpRecord.getDeletedOn() ); } - private MasInput mapToMasInput(JSONB masInput) { - try { - return masInput != null ? mapper.readValue(masInput.data(), MasInput.class) : null; - } catch (JsonProcessingException e) { - throw new DisscoJsonBMappingException("Failed to parse masInput to json: " + masInput.data(), - e); - } - } - private JsonNode mapToJson(JSONB jsonb) { try { if (jsonb != null) { @@ -129,66 +111,66 @@ private JsonNode mapToJson(JSONB jsonb) { } public void deleteMachineAnnotationService(String id, Instant deleted) { - context.update(MACHINE_ANNOTATION_SERVICES) - .set(MACHINE_ANNOTATION_SERVICES.DELETED_ON, deleted) - .where(MACHINE_ANNOTATION_SERVICES.ID.eq(id)) + context.update(MACHINE_ANNOTATION_SERVICES_TMP) + .set(MACHINE_ANNOTATION_SERVICES_TMP.DELETED_ON, deleted) + .where(MACHINE_ANNOTATION_SERVICES_TMP.ID.eq(id)) .execute(); } public MachineAnnotationServiceRecord getMachineAnnotationService(String id) { - return context.selectFrom(MACHINE_ANNOTATION_SERVICES) - .where(MACHINE_ANNOTATION_SERVICES.ID.eq(id)) + return context.selectFrom(MACHINE_ANNOTATION_SERVICES_TMP) + .where(MACHINE_ANNOTATION_SERVICES_TMP.ID.eq(id)) .fetchOne(this::mapToMasRecord); } public List getMachineAnnotationServices(int pageNum, int pageSize) { int offset = getOffset(pageNum, pageSize); - return context.selectFrom(MACHINE_ANNOTATION_SERVICES) - .where(MACHINE_ANNOTATION_SERVICES.DELETED_ON.isNull()) + return context.selectFrom(MACHINE_ANNOTATION_SERVICES_TMP) + .where(MACHINE_ANNOTATION_SERVICES_TMP.DELETED_ON.isNull()) .limit(pageSize + 1) .offset(offset) .fetch(this::mapToMasRecord); } public void updateMachineAnnotationService(MachineAnnotationServiceRecord masRecord) { - context.update(MACHINE_ANNOTATION_SERVICES) - .set(MACHINE_ANNOTATION_SERVICES.VERSION, masRecord.version()) - .set(MACHINE_ANNOTATION_SERVICES.NAME, masRecord.mas().getName()) - .set(MACHINE_ANNOTATION_SERVICES.CREATED, masRecord.created()) - .set(MACHINE_ANNOTATION_SERVICES.ADMINISTRATOR, masRecord.administrator()) - .set(MACHINE_ANNOTATION_SERVICES.CONTAINER_IMAGE, masRecord.mas().getContainerImage()) - .set(MACHINE_ANNOTATION_SERVICES.CONTAINER_IMAGE_TAG, masRecord.mas().getContainerTag()) - .set(MACHINE_ANNOTATION_SERVICES.TARGET_DIGITAL_OBJECT_FILTERS, + context.update(MACHINE_ANNOTATION_SERVICES_TMP) + .set(MACHINE_ANNOTATION_SERVICES_TMP.VERSION, masRecord.version()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.NAME, masRecord.mas().getName()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CREATED, masRecord.created()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.ADMINISTRATOR, masRecord.administrator()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CONTAINER_IMAGE, masRecord.mas().getContainerImage()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CONTAINER_IMAGE_TAG, masRecord.mas().getContainerTag()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.TARGET_DIGITAL_OBJECT_FILTERS, masRecord.mas().getTargetDigitalObjectFilters() != null ? JSONB.jsonb( masRecord.mas().getTargetDigitalObjectFilters().toString()) : null ) - .set(MACHINE_ANNOTATION_SERVICES.SERVICE_DESCRIPTION, + .set(MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_DESCRIPTION, masRecord.mas().getServiceDescription()) - .set(MACHINE_ANNOTATION_SERVICES.SERVICE_STATE, masRecord.mas().getServiceState()) - .set(MACHINE_ANNOTATION_SERVICES.SERVICE_AVAILABILITY, + .set(MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_STATE, masRecord.mas().getServiceState()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.SERVICE_AVAILABILITY, masRecord.mas().getServiceAvailability()) - .set(MACHINE_ANNOTATION_SERVICES.SOURCE_CODE_REPOSITORY, + .set(MACHINE_ANNOTATION_SERVICES_TMP.SOURCE_CODE_REPOSITORY, masRecord.mas().getSourceCodeRepository()) - .set(MACHINE_ANNOTATION_SERVICES.CODE_MAINTAINER, masRecord.mas().getCodeMaintainer()) - .set(MACHINE_ANNOTATION_SERVICES.CODE_LICENSE, masRecord.mas().getCodeLicense()) - .set(MACHINE_ANNOTATION_SERVICES.DEPENDENCIES, + .set(MACHINE_ANNOTATION_SERVICES_TMP.CODE_MAINTAINER, masRecord.mas().getCodeMaintainer()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.CODE_LICENSE, masRecord.mas().getCodeLicense()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.DEPENDENCIES, masRecord.mas().getDependencies() != null ? masRecord.mas().getDependencies() .toArray(new String[0]) : null ) - .set(MACHINE_ANNOTATION_SERVICES.SUPPORT_CONTACT, masRecord.mas().getSupportContact()) - .set(MACHINE_ANNOTATION_SERVICES.SLA_DOCUMENTATION, masRecord.mas().getSlaDocumentation()) - .set(MACHINE_ANNOTATION_SERVICES.TOPICNAME, masRecord.mas().getTopicName()) - .set(MACHINE_ANNOTATION_SERVICES.MAXREPLICAS, masRecord.mas().getMaxReplicas()) - .set(MACHINE_ANNOTATION_SERVICES.DELETED_ON, masRecord.deleted()) - .set(MACHINE_ANNOTATION_SERVICES.MAS_INPUT, setToJSONB(masRecord.mas().getMasInput())) - .where(MACHINE_ANNOTATION_SERVICES.ID.eq(masRecord.id())) + .set(MACHINE_ANNOTATION_SERVICES_TMP.SUPPORT_CONTACT, masRecord.mas().getSupportContact()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.SLA_DOCUMENTATION, masRecord.mas().getSlaDocumentation()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.TOPICNAME, masRecord.mas().getTopicName()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.MAXREPLICAS, masRecord.mas().getMaxReplicas()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.DELETED_ON, masRecord.deleted()) + .set(MACHINE_ANNOTATION_SERVICES_TMP.BATCHING_PERMITTED, masRecord.mas().isBatchingPermitted()) + .where(MACHINE_ANNOTATION_SERVICES_TMP.ID.eq(masRecord.id())) .execute(); } public void rollbackMasCreation(String pid) { - context.deleteFrom(MACHINE_ANNOTATION_SERVICES) - .where(MACHINE_ANNOTATION_SERVICES.ID.eq(pid)) + context.deleteFrom(MACHINE_ANNOTATION_SERVICES_TMP) + .where(MACHINE_ANNOTATION_SERVICES_TMP.ID.eq(pid)) .execute(); } } diff --git a/src/test/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepositoryIT.java b/src/test/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepositoryIT.java index 4bd6994..3c7c460 100644 --- a/src/test/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepositoryIT.java +++ b/src/test/java/eu/dissco/orchestration/backend/repository/MachineAnnotationServiceRepositoryIT.java @@ -1,12 +1,11 @@ package eu.dissco.orchestration.backend.repository; -import static eu.dissco.orchestration.backend.database.jooq.Tables.MACHINE_ANNOTATION_SERVICES; +import static eu.dissco.orchestration.backend.database.jooq.Tables.MACHINE_ANNOTATION_SERVICES_TMP; import static eu.dissco.orchestration.backend.testutils.TestUtils.CREATED; import static eu.dissco.orchestration.backend.testutils.TestUtils.HANDLE; import static eu.dissco.orchestration.backend.testutils.TestUtils.MAPPER; import static eu.dissco.orchestration.backend.testutils.TestUtils.OBJECT_CREATOR; import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMas; -import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMasInput; import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMasRecord; import static org.assertj.core.api.Assertions.assertThat; @@ -30,7 +29,7 @@ void setup() { @AfterEach void destroy() { - context.truncate(MACHINE_ANNOTATION_SERVICES).execute(); + context.truncate(MACHINE_ANNOTATION_SERVICES_TMP).execute(); } @Test @@ -49,7 +48,7 @@ void testCreateMas() { @Test void testCreateMasNoMasInput() { // Given - var masRecord = givenMasRecord(1, null); + var masRecord = givenMasRecord(1); // When repository.createMachineAnnotationService(masRecord); @@ -91,7 +90,7 @@ void testGetMasById() { @Test void testGetMasByIdNoMasInput() { // Given - var expected = givenMasRecord(1, null); + var expected = givenMasRecord(1); postMass(List.of(expected)); // When @@ -215,7 +214,7 @@ private MachineAnnotationServiceRecord givenUpdatedRecord() { "https://www.know.dissco.tech/no_sla", "fancy-topic-name", 2, - givenMasInput() + false ), null ); diff --git a/src/test/java/eu/dissco/orchestration/backend/service/MachineAnnotationServiceServiceTest.java b/src/test/java/eu/dissco/orchestration/backend/service/MachineAnnotationServiceServiceTest.java index ed8ba79..0a07f24 100644 --- a/src/test/java/eu/dissco/orchestration/backend/service/MachineAnnotationServiceServiceTest.java +++ b/src/test/java/eu/dissco/orchestration/backend/service/MachineAnnotationServiceServiceTest.java @@ -8,7 +8,6 @@ import static eu.dissco.orchestration.backend.testutils.TestUtils.OBJECT_CREATOR; import static eu.dissco.orchestration.backend.testutils.TestUtils.SUFFIX; import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMas; -import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMasInput; import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMasRecord; import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMasRecordResponse; import static eu.dissco.orchestration.backend.testutils.TestUtils.givenMasSingleJsonApiWrapper; @@ -21,7 +20,6 @@ import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mockStatic; import static org.mockito.Mockito.times; @@ -642,7 +640,7 @@ private Optional buildOptionalPrevRecord() { OBJECT_CREATOR, new MachineAnnotationService("Another name", "public.ecr.aws/dissco/fancy-mas", "less-fancy", MAPPER.createObjectNode(), null, null, null, null, null, null, null, null, - null, "another-topic-name", 1, givenMasInput()), + null, "another-topic-name", 1, false), null )); } diff --git a/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java b/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java index db778ac..27a658e 100644 --- a/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java +++ b/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java @@ -8,7 +8,6 @@ import eu.dissco.orchestration.backend.domain.MachineAnnotationServiceRecord; import eu.dissco.orchestration.backend.domain.Mapping; import eu.dissco.orchestration.backend.domain.MappingRecord; -import eu.dissco.orchestration.backend.domain.MasInput; import eu.dissco.orchestration.backend.domain.SourceSystem; import eu.dissco.orchestration.backend.domain.SourceSystemRecord; import eu.dissco.orchestration.backend.domain.jsonapi.JsonApiData; @@ -17,12 +16,9 @@ import eu.dissco.orchestration.backend.domain.jsonapi.JsonApiRequest; import eu.dissco.orchestration.backend.domain.jsonapi.JsonApiRequestWrapper; import eu.dissco.orchestration.backend.domain.jsonapi.JsonApiWrapper; -import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.time.Instant; import java.util.ArrayList; import java.util.List; -import org.springframework.core.io.ClassPathResource; public class TestUtils { @@ -224,18 +220,7 @@ public static MachineAnnotationServiceRecord givenMasRecord(int version) { ); } - public static MachineAnnotationServiceRecord givenMasRecord(int version, MasInput masInput) { - return new MachineAnnotationServiceRecord( - HANDLE, - version, - CREATED, - OBJECT_CREATOR, - givenMas(masInput), - null - ); - } - - public static MachineAnnotationService givenMas(MasInput masInput) { + public static MachineAnnotationService givenMas() { return new MachineAnnotationService( "A Machine Annotation Service", "public.ecr.aws/dissco/fancy-mas", @@ -252,19 +237,10 @@ public static MachineAnnotationService givenMas(MasInput masInput) { "https://www.know.dissco.tech/no_sla", "fancy-topic-name", 5, - masInput + false ); } - public static MachineAnnotationService givenMas() { - return givenMas(givenMasInput()); - } - - public static MasInput givenMasInput(){ - return new MasInput("input", "target"); - - } - public static JsonNode givenMasHandleRequest() throws Exception { return MAPPER.readTree(""" { diff --git a/src/test/resources/db/migration/V1__init_db.sql b/src/test/resources/db/migration/V1__init_db.sql index 4bd12d6..719cda4 100644 --- a/src/test/resources/db/migration/V1__init_db.sql +++ b/src/test/resources/db/migration/V1__init_db.sql @@ -28,7 +28,7 @@ create table mapping primary key (id, version) ); -create table machine_annotation_services +create table machine_annotation_services_tmp ( id text not null primary key, @@ -51,5 +51,5 @@ create table machine_annotation_services topicname text, maxreplicas integer, deleted_on timestamp with time zone, - mas_input jsonb + batching_permitted boolean not null ); \ No newline at end of file