From 74cee033853407cd0f84fd77a5d7407fcaedbb4c Mon Sep 17 00:00:00 2001 From: Jiadong Bai Date: Tue, 27 Feb 2024 22:00:12 -0800 Subject: [PATCH 1/6] add db schemas --- .../web/model/jooq/generated/Indexes.java | 12 + .../texera/web/model/jooq/generated/Keys.java | 18 ++ .../web/model/jooq/generated/Tables.java | 12 + .../web/model/jooq/generated/TexeraDb.java | 16 +- .../jooq/generated/tables/Environment.java | 179 +++++++++++ .../tables/EnvironmentOfWorkflow.java | 161 ++++++++++ .../generated/tables/WorkflowExecutions.java | 23 +- .../generated/tables/daos/EnvironmentDao.java | 119 ++++++++ .../tables/daos/EnvironmentOfWorkflowDao.java | 70 +++++ .../tables/daos/WorkflowExecutionsDao.java | 14 + .../tables/interfaces/IEnvironment.java | 82 +++++ .../interfaces/IEnvironmentOfWorkflow.java | 51 ++++ .../interfaces/IWorkflowExecutions.java | 10 + .../generated/tables/pojos/Environment.java | 134 ++++++++ .../tables/pojos/EnvironmentOfWorkflow.java | 84 +++++ .../tables/pojos/WorkflowExecutions.java | 20 +- .../records/EnvironmentOfWorkflowRecord.java | 165 ++++++++++ .../tables/records/EnvironmentRecord.java | 288 ++++++++++++++++++ .../records/WorkflowExecutionsRecord.java | 62 +++- core/scripts/sql/texera_ddl.sql | 26 ++ core/scripts/sql/update/09.sql | 30 ++ 21 files changed, 1555 insertions(+), 21 deletions(-) create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/Environment.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/EnvironmentOfWorkflow.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentDao.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentOfWorkflowDao.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironment.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironmentOfWorkflow.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/Environment.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/EnvironmentOfWorkflow.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentOfWorkflowRecord.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentRecord.java create mode 100644 core/scripts/sql/update/09.sql diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java index d2ca0386055..9954c611285 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java @@ -7,6 +7,8 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; +import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow; import edu.uci.ics.texera.web.model.jooq.generated.tables.File; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfProject; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfWorkflow; @@ -47,6 +49,10 @@ public class Indexes { public static final Index DATASET_VERSION_DID = Indexes0.DATASET_VERSION_DID; public static final Index DATASET_VERSION_IDX_DATASET_VERSION_NAME = Indexes0.DATASET_VERSION_IDX_DATASET_VERSION_NAME; public static final Index DATASET_VERSION_PRIMARY = Indexes0.DATASET_VERSION_PRIMARY; + public static final Index ENVIRONMENT_OWNER_UID = Indexes0.ENVIRONMENT_OWNER_UID; + public static final Index ENVIRONMENT_PRIMARY = Indexes0.ENVIRONMENT_PRIMARY; + public static final Index ENVIRONMENT_OF_WORKFLOW_PRIMARY = Indexes0.ENVIRONMENT_OF_WORKFLOW_PRIMARY; + public static final Index ENVIRONMENT_OF_WORKFLOW_WID = Indexes0.ENVIRONMENT_OF_WORKFLOW_WID; public static final Index FILE_IDX_FILE_NAME_DESCRIPTION = Indexes0.FILE_IDX_FILE_NAME_DESCRIPTION; public static final Index FILE_OWNER_UID = Indexes0.FILE_OWNER_UID; public static final Index FILE_PRIMARY = Indexes0.FILE_PRIMARY; @@ -69,6 +75,7 @@ public class Indexes { public static final Index USER_FILE_ACCESS_PRIMARY = Indexes0.USER_FILE_ACCESS_PRIMARY; public static final Index WORKFLOW_IDX_WORKFLOW_NAME_DESCRIPTION_CONTENT = Indexes0.WORKFLOW_IDX_WORKFLOW_NAME_DESCRIPTION_CONTENT; public static final Index WORKFLOW_PRIMARY = Indexes0.WORKFLOW_PRIMARY; + public static final Index WORKFLOW_EXECUTIONS_FK_ENVIRONMENT_EID = Indexes0.WORKFLOW_EXECUTIONS_FK_ENVIRONMENT_EID; public static final Index WORKFLOW_EXECUTIONS_PRIMARY = Indexes0.WORKFLOW_EXECUTIONS_PRIMARY; public static final Index WORKFLOW_EXECUTIONS_UID = Indexes0.WORKFLOW_EXECUTIONS_UID; public static final Index WORKFLOW_EXECUTIONS_VID = Indexes0.WORKFLOW_EXECUTIONS_VID; @@ -96,6 +103,10 @@ private static class Indexes0 { public static Index DATASET_VERSION_DID = Internal.createIndex("did", DatasetVersion.DATASET_VERSION, new OrderField[] { DatasetVersion.DATASET_VERSION.DID }, false); public static Index DATASET_VERSION_IDX_DATASET_VERSION_NAME = Internal.createIndex("idx_dataset_version_name", DatasetVersion.DATASET_VERSION, new OrderField[] { DatasetVersion.DATASET_VERSION.NAME }, false); public static Index DATASET_VERSION_PRIMARY = Internal.createIndex("PRIMARY", DatasetVersion.DATASET_VERSION, new OrderField[] { DatasetVersion.DATASET_VERSION.DVID }, true); + public static Index ENVIRONMENT_OWNER_UID = Internal.createIndex("owner_uid", Environment.ENVIRONMENT, new OrderField[] { Environment.ENVIRONMENT.OWNER_UID }, false); + public static Index ENVIRONMENT_PRIMARY = Internal.createIndex("PRIMARY", Environment.ENVIRONMENT, new OrderField[] { Environment.ENVIRONMENT.EID }, true); + public static Index ENVIRONMENT_OF_WORKFLOW_PRIMARY = Internal.createIndex("PRIMARY", EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, new OrderField[] { EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.EID, EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.WID }, true); + public static Index ENVIRONMENT_OF_WORKFLOW_WID = Internal.createIndex("wid", EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, new OrderField[] { EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.WID }, false); public static Index FILE_IDX_FILE_NAME_DESCRIPTION = Internal.createIndex("idx_file_name_description", File.FILE, new OrderField[] { File.FILE.NAME, File.FILE.DESCRIPTION }, false); public static Index FILE_OWNER_UID = Internal.createIndex("owner_uid", File.FILE, new OrderField[] { File.FILE.OWNER_UID, File.FILE.NAME }, true); public static Index FILE_PRIMARY = Internal.createIndex("PRIMARY", File.FILE, new OrderField[] { File.FILE.FID }, true); @@ -118,6 +129,7 @@ private static class Indexes0 { public static Index USER_FILE_ACCESS_PRIMARY = Internal.createIndex("PRIMARY", UserFileAccess.USER_FILE_ACCESS, new OrderField[] { UserFileAccess.USER_FILE_ACCESS.UID, UserFileAccess.USER_FILE_ACCESS.FID }, true); public static Index WORKFLOW_IDX_WORKFLOW_NAME_DESCRIPTION_CONTENT = Internal.createIndex("idx_workflow_name_description_content", Workflow.WORKFLOW, new OrderField[] { Workflow.WORKFLOW.NAME, Workflow.WORKFLOW.DESCRIPTION, Workflow.WORKFLOW.CONTENT }, false); public static Index WORKFLOW_PRIMARY = Internal.createIndex("PRIMARY", Workflow.WORKFLOW, new OrderField[] { Workflow.WORKFLOW.WID }, true); + public static Index WORKFLOW_EXECUTIONS_FK_ENVIRONMENT_EID = Internal.createIndex("fk_environment_eid", WorkflowExecutions.WORKFLOW_EXECUTIONS, new OrderField[] { WorkflowExecutions.WORKFLOW_EXECUTIONS.ENVIRONMENT_EID }, false); public static Index WORKFLOW_EXECUTIONS_PRIMARY = Internal.createIndex("PRIMARY", WorkflowExecutions.WORKFLOW_EXECUTIONS, new OrderField[] { WorkflowExecutions.WORKFLOW_EXECUTIONS.EID }, true); public static Index WORKFLOW_EXECUTIONS_UID = Internal.createIndex("uid", WorkflowExecutions.WORKFLOW_EXECUTIONS, new OrderField[] { WorkflowExecutions.WORKFLOW_EXECUTIONS.UID }, false); public static Index WORKFLOW_EXECUTIONS_VID = Internal.createIndex("vid", WorkflowExecutions.WORKFLOW_EXECUTIONS, new OrderField[] { WorkflowExecutions.WORKFLOW_EXECUTIONS.VID }, false); diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java index 7d265f769f8..ba07db1a0b4 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java @@ -7,6 +7,8 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; +import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow; import edu.uci.ics.texera.web.model.jooq.generated.tables.File; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfProject; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfWorkflow; @@ -26,6 +28,8 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetUserAccessRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetVersionRecord; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.EnvironmentOfWorkflowRecord; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.EnvironmentRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.FileOfProjectRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.FileOfWorkflowRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.FileRecord; @@ -63,6 +67,7 @@ public class Keys { public static final Identity IDENTITY_DATASET = Identities0.IDENTITY_DATASET; public static final Identity IDENTITY_DATASET_VERSION = Identities0.IDENTITY_DATASET_VERSION; + public static final Identity IDENTITY_ENVIRONMENT = Identities0.IDENTITY_ENVIRONMENT; public static final Identity IDENTITY_FILE = Identities0.IDENTITY_FILE; public static final Identity IDENTITY_PROJECT = Identities0.IDENTITY_PROJECT; public static final Identity IDENTITY_USER = Identities0.IDENTITY_USER; @@ -77,6 +82,8 @@ public class Keys { public static final UniqueKey KEY_DATASET_PRIMARY = UniqueKeys0.KEY_DATASET_PRIMARY; public static final UniqueKey KEY_DATASET_USER_ACCESS_PRIMARY = UniqueKeys0.KEY_DATASET_USER_ACCESS_PRIMARY; public static final UniqueKey KEY_DATASET_VERSION_PRIMARY = UniqueKeys0.KEY_DATASET_VERSION_PRIMARY; + public static final UniqueKey KEY_ENVIRONMENT_PRIMARY = UniqueKeys0.KEY_ENVIRONMENT_PRIMARY; + public static final UniqueKey KEY_ENVIRONMENT_OF_WORKFLOW_PRIMARY = UniqueKeys0.KEY_ENVIRONMENT_OF_WORKFLOW_PRIMARY; public static final UniqueKey KEY_FILE_OWNER_UID = UniqueKeys0.KEY_FILE_OWNER_UID; public static final UniqueKey KEY_FILE_PRIMARY = UniqueKeys0.KEY_FILE_PRIMARY; public static final UniqueKey KEY_FILE_OF_PROJECT_PRIMARY = UniqueKeys0.KEY_FILE_OF_PROJECT_PRIMARY; @@ -106,6 +113,9 @@ public class Keys { public static final ForeignKey DATASET_USER_ACCESS_IBFK_1 = ForeignKeys0.DATASET_USER_ACCESS_IBFK_1; public static final ForeignKey DATASET_USER_ACCESS_IBFK_2 = ForeignKeys0.DATASET_USER_ACCESS_IBFK_2; public static final ForeignKey DATASET_VERSION_IBFK_1 = ForeignKeys0.DATASET_VERSION_IBFK_1; + public static final ForeignKey ENVIRONMENT_IBFK_1 = ForeignKeys0.ENVIRONMENT_IBFK_1; + public static final ForeignKey ENVIRONMENT_OF_WORKFLOW_IBFK_2 = ForeignKeys0.ENVIRONMENT_OF_WORKFLOW_IBFK_2; + public static final ForeignKey ENVIRONMENT_OF_WORKFLOW_IBFK_1 = ForeignKeys0.ENVIRONMENT_OF_WORKFLOW_IBFK_1; public static final ForeignKey FILE_IBFK_1 = ForeignKeys0.FILE_IBFK_1; public static final ForeignKey FILE_OF_PROJECT_IBFK_1 = ForeignKeys0.FILE_OF_PROJECT_IBFK_1; public static final ForeignKey FILE_OF_PROJECT_IBFK_2 = ForeignKeys0.FILE_OF_PROJECT_IBFK_2; @@ -120,6 +130,7 @@ public class Keys { public static final ForeignKey USER_FILE_ACCESS_IBFK_2 = ForeignKeys0.USER_FILE_ACCESS_IBFK_2; public static final ForeignKey WORKFLOW_EXECUTIONS_IBFK_1 = ForeignKeys0.WORKFLOW_EXECUTIONS_IBFK_1; public static final ForeignKey WORKFLOW_EXECUTIONS_IBFK_2 = ForeignKeys0.WORKFLOW_EXECUTIONS_IBFK_2; + public static final ForeignKey FK_ENVIRONMENT_EID = ForeignKeys0.FK_ENVIRONMENT_EID; public static final ForeignKey WORKFLOW_OF_PROJECT_IBFK_1 = ForeignKeys0.WORKFLOW_OF_PROJECT_IBFK_1; public static final ForeignKey WORKFLOW_OF_PROJECT_IBFK_2 = ForeignKeys0.WORKFLOW_OF_PROJECT_IBFK_2; public static final ForeignKey WORKFLOW_OF_USER_IBFK_1 = ForeignKeys0.WORKFLOW_OF_USER_IBFK_1; @@ -137,6 +148,7 @@ public class Keys { private static class Identities0 { public static Identity IDENTITY_DATASET = Internal.createIdentity(Dataset.DATASET, Dataset.DATASET.DID); public static Identity IDENTITY_DATASET_VERSION = Internal.createIdentity(DatasetVersion.DATASET_VERSION, DatasetVersion.DATASET_VERSION.DVID); + public static Identity IDENTITY_ENVIRONMENT = Internal.createIdentity(Environment.ENVIRONMENT, Environment.ENVIRONMENT.EID); public static Identity IDENTITY_FILE = Internal.createIdentity(File.FILE, File.FILE.FID); public static Identity IDENTITY_PROJECT = Internal.createIdentity(Project.PROJECT, Project.PROJECT.PID); public static Identity IDENTITY_USER = Internal.createIdentity(User.USER, User.USER.UID); @@ -149,6 +161,8 @@ private static class UniqueKeys0 { public static final UniqueKey KEY_DATASET_PRIMARY = Internal.createUniqueKey(Dataset.DATASET, "KEY_dataset_PRIMARY", Dataset.DATASET.DID); public static final UniqueKey KEY_DATASET_USER_ACCESS_PRIMARY = Internal.createUniqueKey(DatasetUserAccess.DATASET_USER_ACCESS, "KEY_dataset_user_access_PRIMARY", DatasetUserAccess.DATASET_USER_ACCESS.DID, DatasetUserAccess.DATASET_USER_ACCESS.UID); public static final UniqueKey KEY_DATASET_VERSION_PRIMARY = Internal.createUniqueKey(DatasetVersion.DATASET_VERSION, "KEY_dataset_version_PRIMARY", DatasetVersion.DATASET_VERSION.DVID); + public static final UniqueKey KEY_ENVIRONMENT_PRIMARY = Internal.createUniqueKey(Environment.ENVIRONMENT, "KEY_environment_PRIMARY", Environment.ENVIRONMENT.EID); + public static final UniqueKey KEY_ENVIRONMENT_OF_WORKFLOW_PRIMARY = Internal.createUniqueKey(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, "KEY_environment_of_workflow_PRIMARY", EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.EID, EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.WID); public static final UniqueKey KEY_FILE_OWNER_UID = Internal.createUniqueKey(File.FILE, "KEY_file_owner_uid", File.FILE.OWNER_UID, File.FILE.NAME); public static final UniqueKey KEY_FILE_PRIMARY = Internal.createUniqueKey(File.FILE, "KEY_file_PRIMARY", File.FILE.FID); public static final UniqueKey KEY_FILE_OF_PROJECT_PRIMARY = Internal.createUniqueKey(FileOfProject.FILE_OF_PROJECT, "KEY_file_of_project_PRIMARY", FileOfProject.FILE_OF_PROJECT.FID, FileOfProject.FILE_OF_PROJECT.PID); @@ -176,6 +190,9 @@ private static class ForeignKeys0 { public static final ForeignKey DATASET_USER_ACCESS_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_DATASET_PRIMARY, DatasetUserAccess.DATASET_USER_ACCESS, "dataset_user_access_ibfk_1", DatasetUserAccess.DATASET_USER_ACCESS.DID); public static final ForeignKey DATASET_USER_ACCESS_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_USER_PRIMARY, DatasetUserAccess.DATASET_USER_ACCESS, "dataset_user_access_ibfk_2", DatasetUserAccess.DATASET_USER_ACCESS.UID); public static final ForeignKey DATASET_VERSION_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_DATASET_PRIMARY, DatasetVersion.DATASET_VERSION, "dataset_version_ibfk_1", DatasetVersion.DATASET_VERSION.DID); + public static final ForeignKey ENVIRONMENT_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_USER_PRIMARY, Environment.ENVIRONMENT, "environment_ibfk_1", Environment.ENVIRONMENT.OWNER_UID); + public static final ForeignKey ENVIRONMENT_OF_WORKFLOW_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_ENVIRONMENT_PRIMARY, EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, "environment_of_workflow_ibfk_2", EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.EID); + public static final ForeignKey ENVIRONMENT_OF_WORKFLOW_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_WORKFLOW_PRIMARY, EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, "environment_of_workflow_ibfk_1", EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.WID); public static final ForeignKey FILE_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_USER_PRIMARY, File.FILE, "file_ibfk_1", File.FILE.OWNER_UID); public static final ForeignKey FILE_OF_PROJECT_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_FILE_PRIMARY, FileOfProject.FILE_OF_PROJECT, "file_of_project_ibfk_1", FileOfProject.FILE_OF_PROJECT.FID); public static final ForeignKey FILE_OF_PROJECT_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_PROJECT_PRIMARY, FileOfProject.FILE_OF_PROJECT, "file_of_project_ibfk_2", FileOfProject.FILE_OF_PROJECT.PID); @@ -190,6 +207,7 @@ private static class ForeignKeys0 { public static final ForeignKey USER_FILE_ACCESS_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_FILE_PRIMARY, UserFileAccess.USER_FILE_ACCESS, "user_file_access_ibfk_2", UserFileAccess.USER_FILE_ACCESS.FID); public static final ForeignKey WORKFLOW_EXECUTIONS_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_WORKFLOW_VERSION_PRIMARY, WorkflowExecutions.WORKFLOW_EXECUTIONS, "workflow_executions_ibfk_1", WorkflowExecutions.WORKFLOW_EXECUTIONS.VID); public static final ForeignKey WORKFLOW_EXECUTIONS_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_USER_PRIMARY, WorkflowExecutions.WORKFLOW_EXECUTIONS, "workflow_executions_ibfk_2", WorkflowExecutions.WORKFLOW_EXECUTIONS.UID); + public static final ForeignKey FK_ENVIRONMENT_EID = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_ENVIRONMENT_PRIMARY, WorkflowExecutions.WORKFLOW_EXECUTIONS, "fk_environment_eid", WorkflowExecutions.WORKFLOW_EXECUTIONS.ENVIRONMENT_EID); public static final ForeignKey WORKFLOW_OF_PROJECT_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_WORKFLOW_PRIMARY, WorkflowOfProject.WORKFLOW_OF_PROJECT, "workflow_of_project_ibfk_1", WorkflowOfProject.WORKFLOW_OF_PROJECT.WID); public static final ForeignKey WORKFLOW_OF_PROJECT_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_PROJECT_PRIMARY, WorkflowOfProject.WORKFLOW_OF_PROJECT, "workflow_of_project_ibfk_2", WorkflowOfProject.WORKFLOW_OF_PROJECT.PID); public static final ForeignKey WORKFLOW_OF_USER_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_USER_PRIMARY, WorkflowOfUser.WORKFLOW_OF_USER, "workflow_of_user_ibfk_1", WorkflowOfUser.WORKFLOW_OF_USER.UID); diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java index 814fccf3aa9..fde01acaaa1 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java @@ -7,6 +7,8 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; +import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow; import edu.uci.ics.texera.web.model.jooq.generated.tables.File; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfProject; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfWorkflow; @@ -46,6 +48,16 @@ public class Tables { */ public static final DatasetVersion DATASET_VERSION = DatasetVersion.DATASET_VERSION; + /** + * The table texera_db.environment. + */ + public static final Environment ENVIRONMENT = Environment.ENVIRONMENT; + + /** + * The table texera_db.environment_of_workflow. + */ + public static final EnvironmentOfWorkflow ENVIRONMENT_OF_WORKFLOW = EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW; + /** * The table texera_db.file. */ diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java index 294e07a37c8..b2e5bc6f95a 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java @@ -7,6 +7,8 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; +import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow; import edu.uci.ics.texera.web.model.jooq.generated.tables.File; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfProject; import edu.uci.ics.texera.web.model.jooq.generated.tables.FileOfWorkflow; @@ -39,7 +41,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class TexeraDb extends SchemaImpl { - private static final long serialVersionUID = -1679894118; + private static final long serialVersionUID = -376568838; /** * The reference instance of texera_db @@ -61,6 +63,16 @@ public class TexeraDb extends SchemaImpl { */ public final DatasetVersion DATASET_VERSION = edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion.DATASET_VERSION; + /** + * The table texera_db.environment. + */ + public final Environment ENVIRONMENT = edu.uci.ics.texera.web.model.jooq.generated.tables.Environment.ENVIRONMENT; + + /** + * The table texera_db.environment_of_workflow. + */ + public final EnvironmentOfWorkflow ENVIRONMENT_OF_WORKFLOW = edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW; + /** * The table texera_db.file. */ @@ -166,6 +178,8 @@ private final List> getTables0() { Dataset.DATASET, DatasetUserAccess.DATASET_USER_ACCESS, DatasetVersion.DATASET_VERSION, + Environment.ENVIRONMENT, + EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, File.FILE, FileOfProject.FILE_OF_PROJECT, FileOfWorkflow.FILE_OF_WORKFLOW, diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/Environment.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/Environment.java new file mode 100644 index 00000000000..175381e71d0 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/Environment.java @@ -0,0 +1,179 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables; + + +import edu.uci.ics.texera.web.model.jooq.generated.Indexes; +import edu.uci.ics.texera.web.model.jooq.generated.Keys; +import edu.uci.ics.texera.web.model.jooq.generated.TexeraDb; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.EnvironmentRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row5; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Environment extends TableImpl { + + private static final long serialVersionUID = 721486290; + + /** + * The reference instance of texera_db.environment + */ + public static final Environment ENVIRONMENT = new Environment(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return EnvironmentRecord.class; + } + + /** + * The column texera_db.environment.eid. + */ + public final TableField EID = createField(DSL.name("eid"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED.nullable(false).identity(true), this, ""); + + /** + * The column texera_db.environment.owner_uid. + */ + public final TableField OWNER_UID = createField(DSL.name("owner_uid"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED.nullable(false), this, ""); + + /** + * The column texera_db.environment.name. + */ + public final TableField NAME = createField(DSL.name("name"), org.jooq.impl.SQLDataType.VARCHAR(128).nullable(false).defaultValue(org.jooq.impl.DSL.inline("Untitled Environment", org.jooq.impl.SQLDataType.VARCHAR)), this, ""); + + /** + * The column texera_db.environment.description. + */ + public final TableField DESCRIPTION = createField(DSL.name("description"), org.jooq.impl.SQLDataType.VARCHAR(1000), this, ""); + + /** + * The column texera_db.environment.creation_time. + */ + public final TableField CREATION_TIME = createField(DSL.name("creation_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * Create a texera_db.environment table reference + */ + public Environment() { + this(DSL.name("environment"), null); + } + + /** + * Create an aliased texera_db.environment table reference + */ + public Environment(String alias) { + this(DSL.name(alias), ENVIRONMENT); + } + + /** + * Create an aliased texera_db.environment table reference + */ + public Environment(Name alias) { + this(alias, ENVIRONMENT); + } + + private Environment(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private Environment(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("")); + } + + public Environment(Table child, ForeignKey key) { + super(child, key, ENVIRONMENT); + } + + @Override + public Schema getSchema() { + return TexeraDb.TEXERA_DB; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.ENVIRONMENT_OWNER_UID, Indexes.ENVIRONMENT_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_ENVIRONMENT; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_ENVIRONMENT_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_ENVIRONMENT_PRIMARY); + } + + @Override + public List> getReferences() { + return Arrays.>asList(Keys.ENVIRONMENT_IBFK_1); + } + + public User user() { + return new User(this, Keys.ENVIRONMENT_IBFK_1); + } + + @Override + public Environment as(String alias) { + return new Environment(DSL.name(alias), this); + } + + @Override + public Environment as(Name alias) { + return new Environment(alias, this); + } + + /** + * Rename this table + */ + @Override + public Environment rename(String name) { + return new Environment(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Environment rename(Name name) { + return new Environment(name, null); + } + + // ------------------------------------------------------------------------- + // Row5 type methods + // ------------------------------------------------------------------------- + + @Override + public Row5 fieldsRow() { + return (Row5) super.fieldsRow(); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/EnvironmentOfWorkflow.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/EnvironmentOfWorkflow.java new file mode 100644 index 00000000000..98a1537f6a1 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/EnvironmentOfWorkflow.java @@ -0,0 +1,161 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables; + + +import edu.uci.ics.texera.web.model.jooq.generated.Indexes; +import edu.uci.ics.texera.web.model.jooq.generated.Keys; +import edu.uci.ics.texera.web.model.jooq.generated.TexeraDb; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.EnvironmentOfWorkflowRecord; + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row2; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class EnvironmentOfWorkflow extends TableImpl { + + private static final long serialVersionUID = -2057144452; + + /** + * The reference instance of texera_db.environment_of_workflow + */ + public static final EnvironmentOfWorkflow ENVIRONMENT_OF_WORKFLOW = new EnvironmentOfWorkflow(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return EnvironmentOfWorkflowRecord.class; + } + + /** + * The column texera_db.environment_of_workflow.eid. + */ + public final TableField EID = createField(DSL.name("eid"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED.nullable(false), this, ""); + + /** + * The column texera_db.environment_of_workflow.wid. + */ + public final TableField WID = createField(DSL.name("wid"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED.nullable(false), this, ""); + + /** + * Create a texera_db.environment_of_workflow table reference + */ + public EnvironmentOfWorkflow() { + this(DSL.name("environment_of_workflow"), null); + } + + /** + * Create an aliased texera_db.environment_of_workflow table reference + */ + public EnvironmentOfWorkflow(String alias) { + this(DSL.name(alias), ENVIRONMENT_OF_WORKFLOW); + } + + /** + * Create an aliased texera_db.environment_of_workflow table reference + */ + public EnvironmentOfWorkflow(Name alias) { + this(alias, ENVIRONMENT_OF_WORKFLOW); + } + + private EnvironmentOfWorkflow(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private EnvironmentOfWorkflow(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("")); + } + + public EnvironmentOfWorkflow(Table child, ForeignKey key) { + super(child, key, ENVIRONMENT_OF_WORKFLOW); + } + + @Override + public Schema getSchema() { + return TexeraDb.TEXERA_DB; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.ENVIRONMENT_OF_WORKFLOW_PRIMARY, Indexes.ENVIRONMENT_OF_WORKFLOW_WID); + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_ENVIRONMENT_OF_WORKFLOW_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_ENVIRONMENT_OF_WORKFLOW_PRIMARY); + } + + @Override + public List> getReferences() { + return Arrays.>asList(Keys.ENVIRONMENT_OF_WORKFLOW_IBFK_2, Keys.ENVIRONMENT_OF_WORKFLOW_IBFK_1); + } + + public Environment environment() { + return new Environment(this, Keys.ENVIRONMENT_OF_WORKFLOW_IBFK_2); + } + + public Workflow workflow() { + return new Workflow(this, Keys.ENVIRONMENT_OF_WORKFLOW_IBFK_1); + } + + @Override + public EnvironmentOfWorkflow as(String alias) { + return new EnvironmentOfWorkflow(DSL.name(alias), this); + } + + @Override + public EnvironmentOfWorkflow as(Name alias) { + return new EnvironmentOfWorkflow(alias, this); + } + + /** + * Rename this table + */ + @Override + public EnvironmentOfWorkflow rename(String name) { + return new EnvironmentOfWorkflow(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public EnvironmentOfWorkflow rename(Name name) { + return new EnvironmentOfWorkflow(name, null); + } + + // ------------------------------------------------------------------------- + // Row2 type methods + // ------------------------------------------------------------------------- + + @Override + public Row2 fieldsRow() { + return (Row2) super.fieldsRow(); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/WorkflowExecutions.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/WorkflowExecutions.java index 76268251224..8d2fc17206a 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/WorkflowExecutions.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/WorkflowExecutions.java @@ -19,7 +19,7 @@ import org.jooq.Index; import org.jooq.Name; import org.jooq.Record; -import org.jooq.Row11; +import org.jooq.Row12; import org.jooq.Schema; import org.jooq.Table; import org.jooq.TableField; @@ -35,7 +35,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class WorkflowExecutions extends TableImpl { - private static final long serialVersionUID = -2101880159; + private static final long serialVersionUID = 589554867; /** * The reference instance of texera_db.workflow_executions @@ -105,6 +105,11 @@ public Class getRecordType() { */ public final TableField LOG_LOCATION = createField(DSL.name("log_location"), org.jooq.impl.SQLDataType.CLOB, this, ""); + /** + * The column texera_db.workflow_executions.environment_eid. + */ + public final TableField ENVIRONMENT_EID = createField(DSL.name("environment_eid"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED, this, ""); + /** * Create a texera_db.workflow_executions table reference */ @@ -145,7 +150,7 @@ public Schema getSchema() { @Override public List getIndexes() { - return Arrays.asList(Indexes.WORKFLOW_EXECUTIONS_PRIMARY, Indexes.WORKFLOW_EXECUTIONS_UID, Indexes.WORKFLOW_EXECUTIONS_VID); + return Arrays.asList(Indexes.WORKFLOW_EXECUTIONS_FK_ENVIRONMENT_EID, Indexes.WORKFLOW_EXECUTIONS_PRIMARY, Indexes.WORKFLOW_EXECUTIONS_UID, Indexes.WORKFLOW_EXECUTIONS_VID); } @Override @@ -165,7 +170,7 @@ public List> getKeys() { @Override public List> getReferences() { - return Arrays.>asList(Keys.WORKFLOW_EXECUTIONS_IBFK_1, Keys.WORKFLOW_EXECUTIONS_IBFK_2); + return Arrays.>asList(Keys.WORKFLOW_EXECUTIONS_IBFK_1, Keys.WORKFLOW_EXECUTIONS_IBFK_2, Keys.FK_ENVIRONMENT_EID); } public WorkflowVersion workflowVersion() { @@ -176,6 +181,10 @@ public User user() { return new User(this, Keys.WORKFLOW_EXECUTIONS_IBFK_2); } + public Environment environment() { + return new Environment(this, Keys.FK_ENVIRONMENT_EID); + } + @Override public WorkflowExecutions as(String alias) { return new WorkflowExecutions(DSL.name(alias), this); @@ -203,11 +212,11 @@ public WorkflowExecutions rename(Name name) { } // ------------------------------------------------------------------------- - // Row11 type methods + // Row12 type methods // ------------------------------------------------------------------------- @Override - public Row11 fieldsRow() { - return (Row11) super.fieldsRow(); + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); } } diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentDao.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentDao.java new file mode 100644 index 00000000000..e7c3b5e558d --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentDao.java @@ -0,0 +1,119 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.daos; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.EnvironmentRecord; + +import java.sql.Timestamp; +import java.util.List; + +import org.jooq.Configuration; +import org.jooq.impl.DAOImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class EnvironmentDao extends DAOImpl { + + /** + * Create a new EnvironmentDao without any configuration + */ + public EnvironmentDao() { + super(Environment.ENVIRONMENT, edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.Environment.class); + } + + /** + * Create a new EnvironmentDao with an attached configuration + */ + public EnvironmentDao(Configuration configuration) { + super(Environment.ENVIRONMENT, edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.Environment.class, configuration); + } + + @Override + public UInteger getId(edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.Environment object) { + return object.getEid(); + } + + /** + * Fetch records that have eid BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfEid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(Environment.ENVIRONMENT.EID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have eid IN (values) + */ + public List fetchByEid(UInteger... values) { + return fetch(Environment.ENVIRONMENT.EID, values); + } + + /** + * Fetch a unique record that has eid = value + */ + public edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.Environment fetchOneByEid(UInteger value) { + return fetchOne(Environment.ENVIRONMENT.EID, value); + } + + /** + * Fetch records that have owner_uid BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfOwnerUid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(Environment.ENVIRONMENT.OWNER_UID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have owner_uid IN (values) + */ + public List fetchByOwnerUid(UInteger... values) { + return fetch(Environment.ENVIRONMENT.OWNER_UID, values); + } + + /** + * Fetch records that have name BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfName(String lowerInclusive, String upperInclusive) { + return fetchRange(Environment.ENVIRONMENT.NAME, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have name IN (values) + */ + public List fetchByName(String... values) { + return fetch(Environment.ENVIRONMENT.NAME, values); + } + + /** + * Fetch records that have description BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfDescription(String lowerInclusive, String upperInclusive) { + return fetchRange(Environment.ENVIRONMENT.DESCRIPTION, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have description IN (values) + */ + public List fetchByDescription(String... values) { + return fetch(Environment.ENVIRONMENT.DESCRIPTION, values); + } + + /** + * Fetch records that have creation_time BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfCreationTime(Timestamp lowerInclusive, Timestamp upperInclusive) { + return fetchRange(Environment.ENVIRONMENT.CREATION_TIME, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have creation_time IN (values) + */ + public List fetchByCreationTime(Timestamp... values) { + return fetch(Environment.ENVIRONMENT.CREATION_TIME, values); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentOfWorkflowDao.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentOfWorkflowDao.java new file mode 100644 index 00000000000..e83d620eeb7 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/EnvironmentOfWorkflowDao.java @@ -0,0 +1,70 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.daos; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.EnvironmentOfWorkflowRecord; + +import java.util.List; + +import org.jooq.Configuration; +import org.jooq.Record2; +import org.jooq.impl.DAOImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class EnvironmentOfWorkflowDao extends DAOImpl> { + + /** + * Create a new EnvironmentOfWorkflowDao without any configuration + */ + public EnvironmentOfWorkflowDao() { + super(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.EnvironmentOfWorkflow.class); + } + + /** + * Create a new EnvironmentOfWorkflowDao with an attached configuration + */ + public EnvironmentOfWorkflowDao(Configuration configuration) { + super(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW, edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.EnvironmentOfWorkflow.class, configuration); + } + + @Override + public Record2 getId(edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.EnvironmentOfWorkflow object) { + return compositeKeyRecord(object.getEid(), object.getWid()); + } + + /** + * Fetch records that have eid BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfEid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.EID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have eid IN (values) + */ + public List fetchByEid(UInteger... values) { + return fetch(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.EID, values); + } + + /** + * Fetch records that have wid BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfWid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.WID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have wid IN (values) + */ + public List fetchByWid(UInteger... values) { + return fetch(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.WID, values); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/WorkflowExecutionsDao.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/WorkflowExecutionsDao.java index 8b599760aad..254b955d552 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/WorkflowExecutionsDao.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/WorkflowExecutionsDao.java @@ -200,4 +200,18 @@ public List fetchByLogLocation(String... values) { return fetch(WorkflowExecutions.WORKFLOW_EXECUTIONS.LOG_LOCATION, values); } + + /** + * Fetch records that have environment_eid BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfEnvironmentEid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(WorkflowExecutions.WORKFLOW_EXECUTIONS.ENVIRONMENT_EID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have environment_eid IN (values) + */ + public List fetchByEnvironmentEid(UInteger... values) { + return fetch(WorkflowExecutions.WORKFLOW_EXECUTIONS.ENVIRONMENT_EID, values); + } } diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironment.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironment.java new file mode 100644 index 00000000000..3ad0d513ec2 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironment.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public interface IEnvironment extends Serializable { + + /** + * Setter for texera_db.environment.eid. + */ + public void setEid(UInteger value); + + /** + * Getter for texera_db.environment.eid. + */ + public UInteger getEid(); + + /** + * Setter for texera_db.environment.owner_uid. + */ + public void setOwnerUid(UInteger value); + + /** + * Getter for texera_db.environment.owner_uid. + */ + public UInteger getOwnerUid(); + + /** + * Setter for texera_db.environment.name. + */ + public void setName(String value); + + /** + * Getter for texera_db.environment.name. + */ + public String getName(); + + /** + * Setter for texera_db.environment.description. + */ + public void setDescription(String value); + + /** + * Getter for texera_db.environment.description. + */ + public String getDescription(); + + /** + * Setter for texera_db.environment.creation_time. + */ + public void setCreationTime(Timestamp value); + + /** + * Getter for texera_db.environment.creation_time. + */ + public Timestamp getCreationTime(); + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + /** + * Load data from another generated Record/POJO implementing the common interface IEnvironment + */ + public void from(edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IEnvironment from); + + /** + * Copy data into another generated Record/POJO implementing the common interface IEnvironment + */ + public E into(E into); +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironmentOfWorkflow.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironmentOfWorkflow.java new file mode 100644 index 00000000000..cf1b9cfc3eb --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IEnvironmentOfWorkflow.java @@ -0,0 +1,51 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces; + + +import java.io.Serializable; + +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public interface IEnvironmentOfWorkflow extends Serializable { + + /** + * Setter for texera_db.environment_of_workflow.eid. + */ + public void setEid(UInteger value); + + /** + * Getter for texera_db.environment_of_workflow.eid. + */ + public UInteger getEid(); + + /** + * Setter for texera_db.environment_of_workflow.wid. + */ + public void setWid(UInteger value); + + /** + * Getter for texera_db.environment_of_workflow.wid. + */ + public UInteger getWid(); + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + /** + * Load data from another generated Record/POJO implementing the common interface IEnvironmentOfWorkflow + */ + public void from(edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IEnvironmentOfWorkflow from); + + /** + * Copy data into another generated Record/POJO implementing the common interface IEnvironmentOfWorkflow + */ + public E into(E into); +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IWorkflowExecutions.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IWorkflowExecutions.java index 819263bc1fa..da8d99c5443 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IWorkflowExecutions.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IWorkflowExecutions.java @@ -126,6 +126,16 @@ public interface IWorkflowExecutions extends Serializable { */ public String getLogLocation(); + /** + * Setter for texera_db.workflow_executions.environment_eid. + */ + public void setEnvironmentEid(UInteger value); + + /** + * Getter for texera_db.workflow_executions.environment_eid. + */ + public UInteger getEnvironmentEid(); + // ------------------------------------------------------------------------- // FROM and INTO // ------------------------------------------------------------------------- diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/Environment.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/Environment.java new file mode 100644 index 00000000000..ee907d78e0d --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/Environment.java @@ -0,0 +1,134 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.pojos; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IEnvironment; + +import java.sql.Timestamp; + +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Environment implements IEnvironment { + + private static final long serialVersionUID = -372026697; + + private UInteger eid; + private UInteger ownerUid; + private String name; + private String description; + private Timestamp creationTime; + + public Environment() {} + + public Environment(IEnvironment value) { + this.eid = value.getEid(); + this.ownerUid = value.getOwnerUid(); + this.name = value.getName(); + this.description = value.getDescription(); + this.creationTime = value.getCreationTime(); + } + + public Environment( + UInteger eid, + UInteger ownerUid, + String name, + String description, + Timestamp creationTime + ) { + this.eid = eid; + this.ownerUid = ownerUid; + this.name = name; + this.description = description; + this.creationTime = creationTime; + } + + @Override + public UInteger getEid() { + return this.eid; + } + + @Override + public void setEid(UInteger eid) { + this.eid = eid; + } + + @Override + public UInteger getOwnerUid() { + return this.ownerUid; + } + + @Override + public void setOwnerUid(UInteger ownerUid) { + this.ownerUid = ownerUid; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public void setName(String name) { + this.name = name; + } + + @Override + public String getDescription() { + return this.description; + } + + @Override + public void setDescription(String description) { + this.description = description; + } + + @Override + public Timestamp getCreationTime() { + return this.creationTime; + } + + @Override + public void setCreationTime(Timestamp creationTime) { + this.creationTime = creationTime; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Environment ("); + + sb.append(eid); + sb.append(", ").append(ownerUid); + sb.append(", ").append(name); + sb.append(", ").append(description); + sb.append(", ").append(creationTime); + + sb.append(")"); + return sb.toString(); + } + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + @Override + public void from(IEnvironment from) { + setEid(from.getEid()); + setOwnerUid(from.getOwnerUid()); + setName(from.getName()); + setDescription(from.getDescription()); + setCreationTime(from.getCreationTime()); + } + + @Override + public E into(E into) { + into.from(this); + return into; + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/EnvironmentOfWorkflow.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/EnvironmentOfWorkflow.java new file mode 100644 index 00000000000..eb29f469259 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/EnvironmentOfWorkflow.java @@ -0,0 +1,84 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.pojos; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IEnvironmentOfWorkflow; + +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class EnvironmentOfWorkflow implements IEnvironmentOfWorkflow { + + private static final long serialVersionUID = 1199906419; + + private UInteger eid; + private UInteger wid; + + public EnvironmentOfWorkflow() {} + + public EnvironmentOfWorkflow(IEnvironmentOfWorkflow value) { + this.eid = value.getEid(); + this.wid = value.getWid(); + } + + public EnvironmentOfWorkflow( + UInteger eid, + UInteger wid + ) { + this.eid = eid; + this.wid = wid; + } + + @Override + public UInteger getEid() { + return this.eid; + } + + @Override + public void setEid(UInteger eid) { + this.eid = eid; + } + + @Override + public UInteger getWid() { + return this.wid; + } + + @Override + public void setWid(UInteger wid) { + this.wid = wid; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("EnvironmentOfWorkflow ("); + + sb.append(eid); + sb.append(", ").append(wid); + + sb.append(")"); + return sb.toString(); + } + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + @Override + public void from(IEnvironmentOfWorkflow from) { + setEid(from.getEid()); + setWid(from.getWid()); + } + + @Override + public E into(E into) { + into.from(this); + return into; + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/WorkflowExecutions.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/WorkflowExecutions.java index 4d0771bff49..2a4c1d23eff 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/WorkflowExecutions.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/WorkflowExecutions.java @@ -17,7 +17,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class WorkflowExecutions implements IWorkflowExecutions { - private static final long serialVersionUID = -379967912; + private static final long serialVersionUID = 709249401; private UInteger eid; private UInteger vid; @@ -30,6 +30,7 @@ public class WorkflowExecutions implements IWorkflowExecutions { private String name; private String environmentVersion; private String logLocation; + private UInteger environmentEid; public WorkflowExecutions() {} @@ -45,6 +46,7 @@ public WorkflowExecutions(IWorkflowExecutions value) { this.name = value.getName(); this.environmentVersion = value.getEnvironmentVersion(); this.logLocation = value.getLogLocation(); + this.environmentEid = value.getEnvironmentEid(); } public WorkflowExecutions( @@ -58,7 +60,8 @@ public WorkflowExecutions( Byte bookmarked, String name, String environmentVersion, - String logLocation + String logLocation, + UInteger environmentEid ) { this.eid = eid; this.vid = vid; @@ -71,6 +74,7 @@ public WorkflowExecutions( this.name = name; this.environmentVersion = environmentVersion; this.logLocation = logLocation; + this.environmentEid = environmentEid; } @Override @@ -183,6 +187,16 @@ public void setLogLocation(String logLocation) { this.logLocation = logLocation; } + @Override + public UInteger getEnvironmentEid() { + return this.environmentEid; + } + + @Override + public void setEnvironmentEid(UInteger environmentEid) { + this.environmentEid = environmentEid; + } + @Override public String toString() { StringBuilder sb = new StringBuilder("WorkflowExecutions ("); @@ -198,6 +212,7 @@ public String toString() { sb.append(", ").append(name); sb.append(", ").append(environmentVersion); sb.append(", ").append(logLocation); + sb.append(", ").append(environmentEid); sb.append(")"); return sb.toString(); @@ -220,6 +235,7 @@ public void from(IWorkflowExecutions from) { setName(from.getName()); setEnvironmentVersion(from.getEnvironmentVersion()); setLogLocation(from.getLogLocation()); + setEnvironmentEid(from.getEnvironmentEid()); } @Override diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentOfWorkflowRecord.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentOfWorkflowRecord.java new file mode 100644 index 00000000000..bfbf4f91963 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentOfWorkflowRecord.java @@ -0,0 +1,165 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.records; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow; +import edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IEnvironmentOfWorkflow; + +import org.jooq.Field; +import org.jooq.Record2; +import org.jooq.Row2; +import org.jooq.impl.UpdatableRecordImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class EnvironmentOfWorkflowRecord extends UpdatableRecordImpl implements Record2, IEnvironmentOfWorkflow { + + private static final long serialVersionUID = 705729509; + + /** + * Setter for texera_db.environment_of_workflow.eid. + */ + @Override + public void setEid(UInteger value) { + set(0, value); + } + + /** + * Getter for texera_db.environment_of_workflow.eid. + */ + @Override + public UInteger getEid() { + return (UInteger) get(0); + } + + /** + * Setter for texera_db.environment_of_workflow.wid. + */ + @Override + public void setWid(UInteger value) { + set(1, value); + } + + /** + * Getter for texera_db.environment_of_workflow.wid. + */ + @Override + public UInteger getWid() { + return (UInteger) get(1); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record2 key() { + return (Record2) super.key(); + } + + // ------------------------------------------------------------------------- + // Record2 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row2 fieldsRow() { + return (Row2) super.fieldsRow(); + } + + @Override + public Row2 valuesRow() { + return (Row2) super.valuesRow(); + } + + @Override + public Field field1() { + return EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.EID; + } + + @Override + public Field field2() { + return EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW.WID; + } + + @Override + public UInteger component1() { + return getEid(); + } + + @Override + public UInteger component2() { + return getWid(); + } + + @Override + public UInteger value1() { + return getEid(); + } + + @Override + public UInteger value2() { + return getWid(); + } + + @Override + public EnvironmentOfWorkflowRecord value1(UInteger value) { + setEid(value); + return this; + } + + @Override + public EnvironmentOfWorkflowRecord value2(UInteger value) { + setWid(value); + return this; + } + + @Override + public EnvironmentOfWorkflowRecord values(UInteger value1, UInteger value2) { + value1(value1); + value2(value2); + return this; + } + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + @Override + public void from(IEnvironmentOfWorkflow from) { + setEid(from.getEid()); + setWid(from.getWid()); + } + + @Override + public E into(E into) { + into.from(this); + return into; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached EnvironmentOfWorkflowRecord + */ + public EnvironmentOfWorkflowRecord() { + super(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW); + } + + /** + * Create a detached, initialised EnvironmentOfWorkflowRecord + */ + public EnvironmentOfWorkflowRecord(UInteger eid, UInteger wid) { + super(EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW); + + set(0, eid); + set(1, wid); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentRecord.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentRecord.java new file mode 100644 index 00000000000..aeb3b1e17dc --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/EnvironmentRecord.java @@ -0,0 +1,288 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.records; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IEnvironment; + +import java.sql.Timestamp; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record5; +import org.jooq.Row5; +import org.jooq.impl.UpdatableRecordImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class EnvironmentRecord extends UpdatableRecordImpl implements Record5, IEnvironment { + + private static final long serialVersionUID = -1437704774; + + /** + * Setter for texera_db.environment.eid. + */ + @Override + public void setEid(UInteger value) { + set(0, value); + } + + /** + * Getter for texera_db.environment.eid. + */ + @Override + public UInteger getEid() { + return (UInteger) get(0); + } + + /** + * Setter for texera_db.environment.owner_uid. + */ + @Override + public void setOwnerUid(UInteger value) { + set(1, value); + } + + /** + * Getter for texera_db.environment.owner_uid. + */ + @Override + public UInteger getOwnerUid() { + return (UInteger) get(1); + } + + /** + * Setter for texera_db.environment.name. + */ + @Override + public void setName(String value) { + set(2, value); + } + + /** + * Getter for texera_db.environment.name. + */ + @Override + public String getName() { + return (String) get(2); + } + + /** + * Setter for texera_db.environment.description. + */ + @Override + public void setDescription(String value) { + set(3, value); + } + + /** + * Getter for texera_db.environment.description. + */ + @Override + public String getDescription() { + return (String) get(3); + } + + /** + * Setter for texera_db.environment.creation_time. + */ + @Override + public void setCreationTime(Timestamp value) { + set(4, value); + } + + /** + * Getter for texera_db.environment.creation_time. + */ + @Override + public Timestamp getCreationTime() { + return (Timestamp) get(4); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record5 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row5 fieldsRow() { + return (Row5) super.fieldsRow(); + } + + @Override + public Row5 valuesRow() { + return (Row5) super.valuesRow(); + } + + @Override + public Field field1() { + return Environment.ENVIRONMENT.EID; + } + + @Override + public Field field2() { + return Environment.ENVIRONMENT.OWNER_UID; + } + + @Override + public Field field3() { + return Environment.ENVIRONMENT.NAME; + } + + @Override + public Field field4() { + return Environment.ENVIRONMENT.DESCRIPTION; + } + + @Override + public Field field5() { + return Environment.ENVIRONMENT.CREATION_TIME; + } + + @Override + public UInteger component1() { + return getEid(); + } + + @Override + public UInteger component2() { + return getOwnerUid(); + } + + @Override + public String component3() { + return getName(); + } + + @Override + public String component4() { + return getDescription(); + } + + @Override + public Timestamp component5() { + return getCreationTime(); + } + + @Override + public UInteger value1() { + return getEid(); + } + + @Override + public UInteger value2() { + return getOwnerUid(); + } + + @Override + public String value3() { + return getName(); + } + + @Override + public String value4() { + return getDescription(); + } + + @Override + public Timestamp value5() { + return getCreationTime(); + } + + @Override + public EnvironmentRecord value1(UInteger value) { + setEid(value); + return this; + } + + @Override + public EnvironmentRecord value2(UInteger value) { + setOwnerUid(value); + return this; + } + + @Override + public EnvironmentRecord value3(String value) { + setName(value); + return this; + } + + @Override + public EnvironmentRecord value4(String value) { + setDescription(value); + return this; + } + + @Override + public EnvironmentRecord value5(Timestamp value) { + setCreationTime(value); + return this; + } + + @Override + public EnvironmentRecord values(UInteger value1, UInteger value2, String value3, String value4, Timestamp value5) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + return this; + } + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + @Override + public void from(IEnvironment from) { + setEid(from.getEid()); + setOwnerUid(from.getOwnerUid()); + setName(from.getName()); + setDescription(from.getDescription()); + setCreationTime(from.getCreationTime()); + } + + @Override + public E into(E into) { + into.from(this); + return into; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached EnvironmentRecord + */ + public EnvironmentRecord() { + super(Environment.ENVIRONMENT); + } + + /** + * Create a detached, initialised EnvironmentRecord + */ + public EnvironmentRecord(UInteger eid, UInteger ownerUid, String name, String description, Timestamp creationTime) { + super(Environment.ENVIRONMENT); + + set(0, eid); + set(1, ownerUid); + set(2, name); + set(3, description); + set(4, creationTime); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/WorkflowExecutionsRecord.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/WorkflowExecutionsRecord.java index 3385688fe8d..3a456acb5b6 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/WorkflowExecutionsRecord.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/WorkflowExecutionsRecord.java @@ -11,8 +11,8 @@ import org.jooq.Field; import org.jooq.Record1; -import org.jooq.Record11; -import org.jooq.Row11; +import org.jooq.Record12; +import org.jooq.Row12; import org.jooq.impl.UpdatableRecordImpl; import org.jooq.types.UInteger; @@ -21,9 +21,9 @@ * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class WorkflowExecutionsRecord extends UpdatableRecordImpl implements Record11, IWorkflowExecutions { +public class WorkflowExecutionsRecord extends UpdatableRecordImpl implements Record12, IWorkflowExecutions { - private static final long serialVersionUID = 1943572236; + private static final long serialVersionUID = -376962722; /** * Setter for texera_db.workflow_executions.eid. @@ -201,6 +201,22 @@ public String getLogLocation() { return (String) get(10); } + /** + * Setter for texera_db.workflow_executions.environment_eid. + */ + @Override + public void setEnvironmentEid(UInteger value) { + set(11, value); + } + + /** + * Getter for texera_db.workflow_executions.environment_eid. + */ + @Override + public UInteger getEnvironmentEid() { + return (UInteger) get(11); + } + // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -211,17 +227,17 @@ public Record1 key() { } // ------------------------------------------------------------------------- - // Record11 type implementation + // Record12 type implementation // ------------------------------------------------------------------------- @Override - public Row11 fieldsRow() { - return (Row11) super.fieldsRow(); + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); } @Override - public Row11 valuesRow() { - return (Row11) super.valuesRow(); + public Row12 valuesRow() { + return (Row12) super.valuesRow(); } @Override @@ -279,6 +295,11 @@ public Field field11() { return WorkflowExecutions.WORKFLOW_EXECUTIONS.LOG_LOCATION; } + @Override + public Field field12() { + return WorkflowExecutions.WORKFLOW_EXECUTIONS.ENVIRONMENT_EID; + } + @Override public UInteger component1() { return getEid(); @@ -334,6 +355,11 @@ public String component11() { return getLogLocation(); } + @Override + public UInteger component12() { + return getEnvironmentEid(); + } + @Override public UInteger value1() { return getEid(); @@ -389,6 +415,11 @@ public String value11() { return getLogLocation(); } + @Override + public UInteger value12() { + return getEnvironmentEid(); + } + @Override public WorkflowExecutionsRecord value1(UInteger value) { setEid(value); @@ -456,7 +487,13 @@ public WorkflowExecutionsRecord value11(String value) { } @Override - public WorkflowExecutionsRecord values(UInteger value1, UInteger value2, UInteger value3, Byte value4, String value5, Timestamp value6, Timestamp value7, Byte value8, String value9, String value10, String value11) { + public WorkflowExecutionsRecord value12(UInteger value) { + setEnvironmentEid(value); + return this; + } + + @Override + public WorkflowExecutionsRecord values(UInteger value1, UInteger value2, UInteger value3, Byte value4, String value5, Timestamp value6, Timestamp value7, Byte value8, String value9, String value10, String value11, UInteger value12) { value1(value1); value2(value2); value3(value3); @@ -468,6 +505,7 @@ public WorkflowExecutionsRecord values(UInteger value1, UInteger value2, UIntege value9(value9); value10(value10); value11(value11); + value12(value12); return this; } @@ -488,6 +526,7 @@ public void from(IWorkflowExecutions from) { setName(from.getName()); setEnvironmentVersion(from.getEnvironmentVersion()); setLogLocation(from.getLogLocation()); + setEnvironmentEid(from.getEnvironmentEid()); } @Override @@ -510,7 +549,7 @@ public WorkflowExecutionsRecord() { /** * Create a detached, initialised WorkflowExecutionsRecord */ - public WorkflowExecutionsRecord(UInteger eid, UInteger vid, UInteger uid, Byte status, String result, Timestamp startingTime, Timestamp lastUpdateTime, Byte bookmarked, String name, String environmentVersion, String logLocation) { + public WorkflowExecutionsRecord(UInteger eid, UInteger vid, UInteger uid, Byte status, String result, Timestamp startingTime, Timestamp lastUpdateTime, Byte bookmarked, String name, String environmentVersion, String logLocation, UInteger environmentEid) { super(WorkflowExecutions.WORKFLOW_EXECUTIONS); set(0, eid); @@ -524,5 +563,6 @@ public WorkflowExecutionsRecord(UInteger eid, UInteger vid, UInteger uid, Byte s set(8, name); set(9, environmentVersion); set(10, logLocation); + set(11, environmentEid); } } diff --git a/core/scripts/sql/texera_ddl.sql b/core/scripts/sql/texera_ddl.sql index 3eeb24b1e10..a35af3a3e3a 100644 --- a/core/scripts/sql/texera_ddl.sql +++ b/core/scripts/sql/texera_ddl.sql @@ -18,6 +18,9 @@ DROP TABLE IF EXISTS `workflow_executions`; DROP TABLE IF EXISTS `dataset`; DROP TABLE IF EXISTS `dataset_user_access`; DROP TABLE IF EXISTS `dataset_version`; +DROP TABLE IF EXISTS `environment` +DROP TABLE IF EXISTS `environment_of_workflow` + SET PERSIST time_zone = '+00:00'; -- this line is mandatory SET PERSIST sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); @@ -164,11 +167,33 @@ CREATE TABLE IF NOT EXISTS file_of_workflow FOREIGN KEY (`wid`) REFERENCES `workflow` (`wid`) ON DELETE CASCADE ) ENGINE = INNODB; + +CREATE TABLE IF NOT EXISTS environment +( + `eid` INT UNSIGNED AUTO_INCREMENT NOT NULL, + `owner_uid` INT UNSIGNED NOT NULL, + `name` VARCHAR(128) NOT NULL DEFAULT 'Untitled Environment', + `description` VARCHAR(1000), + `creation_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`eid`), + FOREIGN KEY (`owner_uid`) REFERENCES `user` (`uid`) ON DELETE CASCADE +) ENGINE = INNODB; + +CREATE TABLE IF NOT EXISTS environment_of_workflow +( + `eid` INT UNSIGNED NOT NULL, + `wid` INT UNSIGNED NOT NULL, + PRIMARY KEY (`eid`, `wid`), + FOREIGN KEY (`wid`) REFERENCES `workflow` (`wid`) ON DELETE CASCADE, + FOREIGN KEY (`eid`) REFERENCES `environment` (`eid`) ON DELETE CASCADE +) ENGINE = INNODB; + CREATE TABLE IF NOT EXISTS workflow_executions ( `eid` INT UNSIGNED AUTO_INCREMENT NOT NULL, `vid` INT UNSIGNED NOT NULL, `uid` INT UNSIGNED NOT NULL, + `environment_eid` INT UNSIGNED, `status` TINYINT NOT NULL DEFAULT 1, `result` TEXT, /* pointer to volume */ `starting_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -180,6 +205,7 @@ CREATE TABLE IF NOT EXISTS workflow_executions PRIMARY KEY (`eid`), FOREIGN KEY (`vid`) REFERENCES `workflow_version` (`vid`) ON DELETE CASCADE, FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON DELETE CASCADE + FOREIGN KEY (`environment_eid`) REFERENCES environment(`eid`) ON DELETE SET NULL, ) ENGINE = INNODB; CREATE TABLE IF NOT EXISTS public_project diff --git a/core/scripts/sql/update/09.sql b/core/scripts/sql/update/09.sql new file mode 100644 index 00000000000..e780973f895 --- /dev/null +++ b/core/scripts/sql/update/09.sql @@ -0,0 +1,30 @@ +USE `texera_db`; + +CREATE TABLE IF NOT EXISTS environment +( + `eid` INT UNSIGNED AUTO_INCREMENT NOT NULL, + `owner_uid` INT UNSIGNED NOT NULL, + `name` VARCHAR(128) NOT NULL DEFAULT 'Untitled Environment', + `description` VARCHAR(1000), + `creation_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`eid`), + FOREIGN KEY (`owner_uid`) REFERENCES `user` (`uid`) ON DELETE CASCADE +) ENGINE = INNODB; + +CREATE TABLE IF NOT EXISTS environment_of_workflow +( + `eid` INT UNSIGNED NOT NULL, + `wid` INT UNSIGNED NOT NULL, + PRIMARY KEY (`eid`, `wid`), + FOREIGN KEY (`wid`) REFERENCES `workflow` (`wid`) ON DELETE CASCADE, + FOREIGN KEY (`eid`) REFERENCES `environment` (`eid`) ON DELETE CASCADE +) ENGINE = INNODB; + +-- Add the `environment_eid` column to the `workflow_executions` table +ALTER TABLE workflow_executions +ADD COLUMN `environment_eid` INT UNSIGNED; + +-- Add the foreign key constraint for `environment_eid` +ALTER TABLE workflow_executions +ADD CONSTRAINT fk_environment_eid +FOREIGN KEY (`environment_eid`) REFERENCES environment(`eid`) ON DELETE SET NULL; \ No newline at end of file From 800a9d462593a5395b3982bc2ff5567f6a540ed1 Mon Sep 17 00:00:00 2001 From: Jiadong Bai Date: Wed, 28 Feb 2024 15:53:40 -0800 Subject: [PATCH 2/6] migrate the first part of the changes --- .../ics/texera/web/TexeraWebApplication.scala | 32 +- .../web/model/jooq/generated/Indexes.java | 7 + .../texera/web/model/jooq/generated/Keys.java | 8 + .../web/model/jooq/generated/Tables.java | 6 + .../web/model/jooq/generated/TexeraDb.java | 9 +- .../tables/DatasetOfEnvironment.java | 166 +++++++ .../tables/daos/DatasetOfEnvironmentDao.java | 84 ++++ .../interfaces/IDatasetOfEnvironment.java | 61 +++ .../tables/pojos/DatasetOfEnvironment.java | 100 ++++ .../records/DatasetOfEnvironmentRecord.java | 206 ++++++++ .../user/dataset/DatasetResource.scala | 12 + .../dashboard/user/dataset/type/FileNode.java | 28 ++ .../environment/EnvironmentResource.scala | 438 ++++++++++++++++++ .../user/workflow/WorkflowResource.scala | 41 +- core/scripts/sql/texera_ddl.sql | 11 + core/scripts/sql/update/09.sql | 10 + 16 files changed, 1186 insertions(+), 33 deletions(-) create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/DatasetOfEnvironment.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/DatasetOfEnvironmentDao.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IDatasetOfEnvironment.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/DatasetOfEnvironment.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/DatasetOfEnvironmentRecord.java create mode 100644 core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala index d9b3c848b8b..377f0f4b340 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala @@ -15,42 +15,23 @@ import edu.uci.ics.texera.Utils import edu.uci.ics.texera.Utils.{maptoStatusCode, objectMapper} import edu.uci.ics.texera.web.TexeraWebApplication.scheduleRecurringCallThroughActorSystem import edu.uci.ics.texera.web.auth.JwtAuth.jwtConsumer -import edu.uci.ics.texera.web.auth.{ - GuestAuthFilter, - SessionUser, - UserAuthenticator, - UserRoleAuthorizer -} +import edu.uci.ics.texera.web.auth.{GuestAuthFilter, SessionUser, UserAuthenticator, UserRoleAuthorizer} import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.WorkflowExecutions import edu.uci.ics.texera.web.resource.auth.{AuthResource, GoogleAuthResource} import edu.uci.ics.texera.web.resource._ import edu.uci.ics.texera.web.resource.dashboard.DashboardResource import edu.uci.ics.texera.web.resource.dashboard.admin.execution.AdminExecutionResource import edu.uci.ics.texera.web.resource.dashboard.admin.user.AdminUserResource -import edu.uci.ics.texera.web.resource.dashboard.user.dataset.{ - DatasetAccessResource, - DatasetResource -} +import edu.uci.ics.texera.web.resource.dashboard.user.dataset.{DatasetAccessResource, DatasetResource} import edu.uci.ics.texera.web.resource.dashboard.user.dataset.`type`.{FileNode, FileNodeSerializer} import edu.uci.ics.texera.web.resource.dashboard.user.dataset.service.GitVersionControlLocalFileStorage import edu.uci.ics.texera.web.resource.dashboard.user.dataset.utils.PathUtils.getAllDatasetDirectories -import edu.uci.ics.texera.web.resource.dashboard.user.file.{ - UserFileAccessResource, - UserFileResource -} -import edu.uci.ics.texera.web.resource.dashboard.user.project.{ - ProjectAccessResource, - ProjectResource, - PublicProjectResource -} +import edu.uci.ics.texera.web.resource.dashboard.user.file.{UserFileAccessResource, UserFileResource} +import edu.uci.ics.texera.web.resource.dashboard.user.project.{ProjectAccessResource, ProjectResource, PublicProjectResource} import edu.uci.ics.texera.web.resource.dashboard.user.quota.UserQuotaResource import edu.uci.ics.texera.web.resource.dashboard.user.discussion.UserDiscussionResource -import edu.uci.ics.texera.web.resource.dashboard.user.workflow.{ - WorkflowAccessResource, - WorkflowExecutionsResource, - WorkflowResource, - WorkflowVersionResource -} +import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource +import edu.uci.ics.texera.web.resource.dashboard.user.workflow.{WorkflowAccessResource, WorkflowExecutionsResource, WorkflowResource, WorkflowVersionResource} import edu.uci.ics.texera.web.service.ExecutionsMetadataPersistService import edu.uci.ics.texera.web.storage.MongoDatabaseManager import edu.uci.ics.texera.web.workflowruntimestate.WorkflowAggregatedState.{COMPLETED, FAILED} @@ -257,6 +238,7 @@ class TexeraWebApplication environment.jersey.register(classOf[WorkflowVersionResource]) environment.jersey.register(classOf[DatasetResource]) environment.jersey.register(classOf[DatasetAccessResource]) + environment.jersey.register(classOf[EnvironmentResource]) environment.jersey.register(classOf[ProjectResource]) environment.jersey.register(classOf[ProjectAccessResource]) environment.jersey.register(classOf[WorkflowExecutionsResource]) diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java index 9954c611285..955fd18a928 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Indexes.java @@ -5,6 +5,7 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; +import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; @@ -44,6 +45,9 @@ public class Indexes { public static final Index DATASET_IDX_DATASET_NAME_DESCRIPTION = Indexes0.DATASET_IDX_DATASET_NAME_DESCRIPTION; public static final Index DATASET_OWNER_UID = Indexes0.DATASET_OWNER_UID; public static final Index DATASET_PRIMARY = Indexes0.DATASET_PRIMARY; + public static final Index DATASET_OF_ENVIRONMENT_DVID = Indexes0.DATASET_OF_ENVIRONMENT_DVID; + public static final Index DATASET_OF_ENVIRONMENT_EID = Indexes0.DATASET_OF_ENVIRONMENT_EID; + public static final Index DATASET_OF_ENVIRONMENT_PRIMARY = Indexes0.DATASET_OF_ENVIRONMENT_PRIMARY; public static final Index DATASET_USER_ACCESS_PRIMARY = Indexes0.DATASET_USER_ACCESS_PRIMARY; public static final Index DATASET_USER_ACCESS_UID = Indexes0.DATASET_USER_ACCESS_UID; public static final Index DATASET_VERSION_DID = Indexes0.DATASET_VERSION_DID; @@ -98,6 +102,9 @@ private static class Indexes0 { public static Index DATASET_IDX_DATASET_NAME_DESCRIPTION = Internal.createIndex("idx_dataset_name_description", Dataset.DATASET, new OrderField[] { Dataset.DATASET.NAME, Dataset.DATASET.DESCRIPTION }, false); public static Index DATASET_OWNER_UID = Internal.createIndex("owner_uid", Dataset.DATASET, new OrderField[] { Dataset.DATASET.OWNER_UID }, false); public static Index DATASET_PRIMARY = Internal.createIndex("PRIMARY", Dataset.DATASET, new OrderField[] { Dataset.DATASET.DID }, true); + public static Index DATASET_OF_ENVIRONMENT_DVID = Internal.createIndex("dvid", DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, new OrderField[] { DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DVID }, false); + public static Index DATASET_OF_ENVIRONMENT_EID = Internal.createIndex("eid", DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, new OrderField[] { DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.EID }, false); + public static Index DATASET_OF_ENVIRONMENT_PRIMARY = Internal.createIndex("PRIMARY", DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, new OrderField[] { DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DID, DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.EID }, true); public static Index DATASET_USER_ACCESS_PRIMARY = Internal.createIndex("PRIMARY", DatasetUserAccess.DATASET_USER_ACCESS, new OrderField[] { DatasetUserAccess.DATASET_USER_ACCESS.DID, DatasetUserAccess.DATASET_USER_ACCESS.UID }, true); public static Index DATASET_USER_ACCESS_UID = Internal.createIndex("uid", DatasetUserAccess.DATASET_USER_ACCESS, new OrderField[] { DatasetUserAccess.DATASET_USER_ACCESS.UID }, false); public static Index DATASET_VERSION_DID = Internal.createIndex("did", DatasetVersion.DATASET_VERSION, new OrderField[] { DatasetVersion.DATASET_VERSION.DID }, false); diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java index ba07db1a0b4..11a5686d1c8 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Keys.java @@ -5,6 +5,7 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; +import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; @@ -25,6 +26,7 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.WorkflowRuntimeStatistics; import edu.uci.ics.texera.web.model.jooq.generated.tables.WorkflowUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.WorkflowVersion; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetOfEnvironmentRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetUserAccessRecord; import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetVersionRecord; @@ -80,6 +82,7 @@ public class Keys { // ------------------------------------------------------------------------- public static final UniqueKey KEY_DATASET_PRIMARY = UniqueKeys0.KEY_DATASET_PRIMARY; + public static final UniqueKey KEY_DATASET_OF_ENVIRONMENT_PRIMARY = UniqueKeys0.KEY_DATASET_OF_ENVIRONMENT_PRIMARY; public static final UniqueKey KEY_DATASET_USER_ACCESS_PRIMARY = UniqueKeys0.KEY_DATASET_USER_ACCESS_PRIMARY; public static final UniqueKey KEY_DATASET_VERSION_PRIMARY = UniqueKeys0.KEY_DATASET_VERSION_PRIMARY; public static final UniqueKey KEY_ENVIRONMENT_PRIMARY = UniqueKeys0.KEY_ENVIRONMENT_PRIMARY; @@ -110,6 +113,8 @@ public class Keys { // ------------------------------------------------------------------------- public static final ForeignKey DATASET_IBFK_1 = ForeignKeys0.DATASET_IBFK_1; + public static final ForeignKey DATASET_OF_ENVIRONMENT_IBFK_1 = ForeignKeys0.DATASET_OF_ENVIRONMENT_IBFK_1; + public static final ForeignKey DATASET_OF_ENVIRONMENT_IBFK_2 = ForeignKeys0.DATASET_OF_ENVIRONMENT_IBFK_2; public static final ForeignKey DATASET_USER_ACCESS_IBFK_1 = ForeignKeys0.DATASET_USER_ACCESS_IBFK_1; public static final ForeignKey DATASET_USER_ACCESS_IBFK_2 = ForeignKeys0.DATASET_USER_ACCESS_IBFK_2; public static final ForeignKey DATASET_VERSION_IBFK_1 = ForeignKeys0.DATASET_VERSION_IBFK_1; @@ -159,6 +164,7 @@ private static class Identities0 { private static class UniqueKeys0 { public static final UniqueKey KEY_DATASET_PRIMARY = Internal.createUniqueKey(Dataset.DATASET, "KEY_dataset_PRIMARY", Dataset.DATASET.DID); + public static final UniqueKey KEY_DATASET_OF_ENVIRONMENT_PRIMARY = Internal.createUniqueKey(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, "KEY_dataset_of_environment_PRIMARY", DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DID, DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.EID); public static final UniqueKey KEY_DATASET_USER_ACCESS_PRIMARY = Internal.createUniqueKey(DatasetUserAccess.DATASET_USER_ACCESS, "KEY_dataset_user_access_PRIMARY", DatasetUserAccess.DATASET_USER_ACCESS.DID, DatasetUserAccess.DATASET_USER_ACCESS.UID); public static final UniqueKey KEY_DATASET_VERSION_PRIMARY = Internal.createUniqueKey(DatasetVersion.DATASET_VERSION, "KEY_dataset_version_PRIMARY", DatasetVersion.DATASET_VERSION.DVID); public static final UniqueKey KEY_ENVIRONMENT_PRIMARY = Internal.createUniqueKey(Environment.ENVIRONMENT, "KEY_environment_PRIMARY", Environment.ENVIRONMENT.EID); @@ -187,6 +193,8 @@ private static class UniqueKeys0 { private static class ForeignKeys0 { public static final ForeignKey DATASET_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_USER_PRIMARY, Dataset.DATASET, "dataset_ibfk_1", Dataset.DATASET.OWNER_UID); + public static final ForeignKey DATASET_OF_ENVIRONMENT_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_ENVIRONMENT_PRIMARY, DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, "dataset_of_environment_ibfk_1", DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.EID); + public static final ForeignKey DATASET_OF_ENVIRONMENT_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_DATASET_VERSION_PRIMARY, DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, "dataset_of_environment_ibfk_2", DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DVID); public static final ForeignKey DATASET_USER_ACCESS_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_DATASET_PRIMARY, DatasetUserAccess.DATASET_USER_ACCESS, "dataset_user_access_ibfk_1", DatasetUserAccess.DATASET_USER_ACCESS.DID); public static final ForeignKey DATASET_USER_ACCESS_IBFK_2 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_USER_PRIMARY, DatasetUserAccess.DATASET_USER_ACCESS, "dataset_user_access_ibfk_2", DatasetUserAccess.DATASET_USER_ACCESS.UID); public static final ForeignKey DATASET_VERSION_IBFK_1 = Internal.createForeignKey(edu.uci.ics.texera.web.model.jooq.generated.Keys.KEY_DATASET_PRIMARY, DatasetVersion.DATASET_VERSION, "dataset_version_ibfk_1", DatasetVersion.DATASET_VERSION.DID); diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java index fde01acaaa1..ce9e7369bed 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/Tables.java @@ -5,6 +5,7 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; +import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; @@ -38,6 +39,11 @@ public class Tables { */ public static final Dataset DATASET = Dataset.DATASET; + /** + * The table texera_db.dataset_of_environment. + */ + public static final DatasetOfEnvironment DATASET_OF_ENVIRONMENT = DatasetOfEnvironment.DATASET_OF_ENVIRONMENT; + /** * The table texera_db.dataset_user_access. */ diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java index b2e5bc6f95a..3c9d7461ce8 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/TexeraDb.java @@ -5,6 +5,7 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset; +import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetUserAccess; import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetVersion; import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment; @@ -41,7 +42,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class TexeraDb extends SchemaImpl { - private static final long serialVersionUID = -376568838; + private static final long serialVersionUID = -633402813; /** * The reference instance of texera_db @@ -53,6 +54,11 @@ public class TexeraDb extends SchemaImpl { */ public final Dataset DATASET = edu.uci.ics.texera.web.model.jooq.generated.tables.Dataset.DATASET; + /** + * The table texera_db.dataset_of_environment. + */ + public final DatasetOfEnvironment DATASET_OF_ENVIRONMENT = edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment.DATASET_OF_ENVIRONMENT; + /** * The table texera_db.dataset_user_access. */ @@ -176,6 +182,7 @@ public final List> getTables() { private final List> getTables0() { return Arrays.>asList( Dataset.DATASET, + DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, DatasetUserAccess.DATASET_USER_ACCESS, DatasetVersion.DATASET_VERSION, Environment.ENVIRONMENT, diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/DatasetOfEnvironment.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/DatasetOfEnvironment.java new file mode 100644 index 00000000000..1044c8ade0d --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/DatasetOfEnvironment.java @@ -0,0 +1,166 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables; + + +import edu.uci.ics.texera.web.model.jooq.generated.Indexes; +import edu.uci.ics.texera.web.model.jooq.generated.Keys; +import edu.uci.ics.texera.web.model.jooq.generated.TexeraDb; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetOfEnvironmentRecord; + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row3; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DatasetOfEnvironment extends TableImpl { + + private static final long serialVersionUID = -1883655224; + + /** + * The reference instance of texera_db.dataset_of_environment + */ + public static final DatasetOfEnvironment DATASET_OF_ENVIRONMENT = new DatasetOfEnvironment(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return DatasetOfEnvironmentRecord.class; + } + + /** + * The column texera_db.dataset_of_environment.did. + */ + public final TableField DID = createField(DSL.name("did"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED.nullable(false), this, ""); + + /** + * The column texera_db.dataset_of_environment.eid. + */ + public final TableField EID = createField(DSL.name("eid"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED.nullable(false), this, ""); + + /** + * The column texera_db.dataset_of_environment.dvid. + */ + public final TableField DVID = createField(DSL.name("dvid"), org.jooq.impl.SQLDataType.INTEGERUNSIGNED.nullable(false), this, ""); + + /** + * Create a texera_db.dataset_of_environment table reference + */ + public DatasetOfEnvironment() { + this(DSL.name("dataset_of_environment"), null); + } + + /** + * Create an aliased texera_db.dataset_of_environment table reference + */ + public DatasetOfEnvironment(String alias) { + this(DSL.name(alias), DATASET_OF_ENVIRONMENT); + } + + /** + * Create an aliased texera_db.dataset_of_environment table reference + */ + public DatasetOfEnvironment(Name alias) { + this(alias, DATASET_OF_ENVIRONMENT); + } + + private DatasetOfEnvironment(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DatasetOfEnvironment(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("")); + } + + public DatasetOfEnvironment(Table child, ForeignKey key) { + super(child, key, DATASET_OF_ENVIRONMENT); + } + + @Override + public Schema getSchema() { + return TexeraDb.TEXERA_DB; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.DATASET_OF_ENVIRONMENT_DVID, Indexes.DATASET_OF_ENVIRONMENT_EID, Indexes.DATASET_OF_ENVIRONMENT_PRIMARY); + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_DATASET_OF_ENVIRONMENT_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_DATASET_OF_ENVIRONMENT_PRIMARY); + } + + @Override + public List> getReferences() { + return Arrays.>asList(Keys.DATASET_OF_ENVIRONMENT_IBFK_1, Keys.DATASET_OF_ENVIRONMENT_IBFK_2); + } + + public Environment environment() { + return new Environment(this, Keys.DATASET_OF_ENVIRONMENT_IBFK_1); + } + + public DatasetVersion datasetVersion() { + return new DatasetVersion(this, Keys.DATASET_OF_ENVIRONMENT_IBFK_2); + } + + @Override + public DatasetOfEnvironment as(String alias) { + return new DatasetOfEnvironment(DSL.name(alias), this); + } + + @Override + public DatasetOfEnvironment as(Name alias) { + return new DatasetOfEnvironment(alias, this); + } + + /** + * Rename this table + */ + @Override + public DatasetOfEnvironment rename(String name) { + return new DatasetOfEnvironment(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DatasetOfEnvironment rename(Name name) { + return new DatasetOfEnvironment(name, null); + } + + // ------------------------------------------------------------------------- + // Row3 type methods + // ------------------------------------------------------------------------- + + @Override + public Row3 fieldsRow() { + return (Row3) super.fieldsRow(); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/DatasetOfEnvironmentDao.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/DatasetOfEnvironmentDao.java new file mode 100644 index 00000000000..17a761364ee --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/daos/DatasetOfEnvironmentDao.java @@ -0,0 +1,84 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.daos; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.records.DatasetOfEnvironmentRecord; + +import java.util.List; + +import org.jooq.Configuration; +import org.jooq.Record2; +import org.jooq.impl.DAOImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DatasetOfEnvironmentDao extends DAOImpl> { + + /** + * Create a new DatasetOfEnvironmentDao without any configuration + */ + public DatasetOfEnvironmentDao() { + super(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.DatasetOfEnvironment.class); + } + + /** + * Create a new DatasetOfEnvironmentDao with an attached configuration + */ + public DatasetOfEnvironmentDao(Configuration configuration) { + super(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT, edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.DatasetOfEnvironment.class, configuration); + } + + @Override + public Record2 getId(edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.DatasetOfEnvironment object) { + return compositeKeyRecord(object.getDid(), object.getEid()); + } + + /** + * Fetch records that have did BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfDid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have did IN (values) + */ + public List fetchByDid(UInteger... values) { + return fetch(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DID, values); + } + + /** + * Fetch records that have eid BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfEid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.EID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have eid IN (values) + */ + public List fetchByEid(UInteger... values) { + return fetch(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.EID, values); + } + + /** + * Fetch records that have dvid BETWEEN lowerInclusive AND upperInclusive + */ + public List fetchRangeOfDvid(UInteger lowerInclusive, UInteger upperInclusive) { + return fetchRange(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DVID, lowerInclusive, upperInclusive); + } + + /** + * Fetch records that have dvid IN (values) + */ + public List fetchByDvid(UInteger... values) { + return fetch(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DVID, values); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IDatasetOfEnvironment.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IDatasetOfEnvironment.java new file mode 100644 index 00000000000..9532f7b54fe --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/interfaces/IDatasetOfEnvironment.java @@ -0,0 +1,61 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces; + + +import java.io.Serializable; + +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public interface IDatasetOfEnvironment extends Serializable { + + /** + * Setter for texera_db.dataset_of_environment.did. + */ + public void setDid(UInteger value); + + /** + * Getter for texera_db.dataset_of_environment.did. + */ + public UInteger getDid(); + + /** + * Setter for texera_db.dataset_of_environment.eid. + */ + public void setEid(UInteger value); + + /** + * Getter for texera_db.dataset_of_environment.eid. + */ + public UInteger getEid(); + + /** + * Setter for texera_db.dataset_of_environment.dvid. + */ + public void setDvid(UInteger value); + + /** + * Getter for texera_db.dataset_of_environment.dvid. + */ + public UInteger getDvid(); + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + /** + * Load data from another generated Record/POJO implementing the common interface IDatasetOfEnvironment + */ + public void from(edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IDatasetOfEnvironment from); + + /** + * Copy data into another generated Record/POJO implementing the common interface IDatasetOfEnvironment + */ + public E into(E into); +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/DatasetOfEnvironment.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/DatasetOfEnvironment.java new file mode 100644 index 00000000000..9c0043b668b --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/pojos/DatasetOfEnvironment.java @@ -0,0 +1,100 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.pojos; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IDatasetOfEnvironment; + +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DatasetOfEnvironment implements IDatasetOfEnvironment { + + private static final long serialVersionUID = 1743926591; + + private UInteger did; + private UInteger eid; + private UInteger dvid; + + public DatasetOfEnvironment() {} + + public DatasetOfEnvironment(IDatasetOfEnvironment value) { + this.did = value.getDid(); + this.eid = value.getEid(); + this.dvid = value.getDvid(); + } + + public DatasetOfEnvironment( + UInteger did, + UInteger eid, + UInteger dvid + ) { + this.did = did; + this.eid = eid; + this.dvid = dvid; + } + + @Override + public UInteger getDid() { + return this.did; + } + + @Override + public void setDid(UInteger did) { + this.did = did; + } + + @Override + public UInteger getEid() { + return this.eid; + } + + @Override + public void setEid(UInteger eid) { + this.eid = eid; + } + + @Override + public UInteger getDvid() { + return this.dvid; + } + + @Override + public void setDvid(UInteger dvid) { + this.dvid = dvid; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("DatasetOfEnvironment ("); + + sb.append(did); + sb.append(", ").append(eid); + sb.append(", ").append(dvid); + + sb.append(")"); + return sb.toString(); + } + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + @Override + public void from(IDatasetOfEnvironment from) { + setDid(from.getDid()); + setEid(from.getEid()); + setDvid(from.getDvid()); + } + + @Override + public E into(E into) { + into.from(this); + return into; + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/DatasetOfEnvironmentRecord.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/DatasetOfEnvironmentRecord.java new file mode 100644 index 00000000000..3bf93cfe9a0 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/model/jooq/generated/tables/records/DatasetOfEnvironmentRecord.java @@ -0,0 +1,206 @@ +/* + * This file is generated by jOOQ. + */ +package edu.uci.ics.texera.web.model.jooq.generated.tables.records; + + +import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment; +import edu.uci.ics.texera.web.model.jooq.generated.tables.interfaces.IDatasetOfEnvironment; + +import org.jooq.Field; +import org.jooq.Record2; +import org.jooq.Record3; +import org.jooq.Row3; +import org.jooq.impl.UpdatableRecordImpl; +import org.jooq.types.UInteger; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DatasetOfEnvironmentRecord extends UpdatableRecordImpl implements Record3, IDatasetOfEnvironment { + + private static final long serialVersionUID = -1006305947; + + /** + * Setter for texera_db.dataset_of_environment.did. + */ + @Override + public void setDid(UInteger value) { + set(0, value); + } + + /** + * Getter for texera_db.dataset_of_environment.did. + */ + @Override + public UInteger getDid() { + return (UInteger) get(0); + } + + /** + * Setter for texera_db.dataset_of_environment.eid. + */ + @Override + public void setEid(UInteger value) { + set(1, value); + } + + /** + * Getter for texera_db.dataset_of_environment.eid. + */ + @Override + public UInteger getEid() { + return (UInteger) get(1); + } + + /** + * Setter for texera_db.dataset_of_environment.dvid. + */ + @Override + public void setDvid(UInteger value) { + set(2, value); + } + + /** + * Getter for texera_db.dataset_of_environment.dvid. + */ + @Override + public UInteger getDvid() { + return (UInteger) get(2); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record2 key() { + return (Record2) super.key(); + } + + // ------------------------------------------------------------------------- + // Record3 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row3 fieldsRow() { + return (Row3) super.fieldsRow(); + } + + @Override + public Row3 valuesRow() { + return (Row3) super.valuesRow(); + } + + @Override + public Field field1() { + return DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DID; + } + + @Override + public Field field2() { + return DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.EID; + } + + @Override + public Field field3() { + return DatasetOfEnvironment.DATASET_OF_ENVIRONMENT.DVID; + } + + @Override + public UInteger component1() { + return getDid(); + } + + @Override + public UInteger component2() { + return getEid(); + } + + @Override + public UInteger component3() { + return getDvid(); + } + + @Override + public UInteger value1() { + return getDid(); + } + + @Override + public UInteger value2() { + return getEid(); + } + + @Override + public UInteger value3() { + return getDvid(); + } + + @Override + public DatasetOfEnvironmentRecord value1(UInteger value) { + setDid(value); + return this; + } + + @Override + public DatasetOfEnvironmentRecord value2(UInteger value) { + setEid(value); + return this; + } + + @Override + public DatasetOfEnvironmentRecord value3(UInteger value) { + setDvid(value); + return this; + } + + @Override + public DatasetOfEnvironmentRecord values(UInteger value1, UInteger value2, UInteger value3) { + value1(value1); + value2(value2); + value3(value3); + return this; + } + + // ------------------------------------------------------------------------- + // FROM and INTO + // ------------------------------------------------------------------------- + + @Override + public void from(IDatasetOfEnvironment from) { + setDid(from.getDid()); + setEid(from.getEid()); + setDvid(from.getDvid()); + } + + @Override + public E into(E into) { + into.from(this); + return into; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached DatasetOfEnvironmentRecord + */ + public DatasetOfEnvironmentRecord() { + super(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT); + } + + /** + * Create a detached, initialised DatasetOfEnvironmentRecord + */ + public DatasetOfEnvironmentRecord(UInteger did, UInteger eid, UInteger dvid) { + super(DatasetOfEnvironment.DATASET_OF_ENVIRONMENT); + + set(0, did); + set(1, eid); + set(2, dvid); + } +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala index a41d2522208..95b205bc068 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala @@ -256,6 +256,18 @@ object DatasetResource { } } + def retrieveDatasetVersionFilePaths(ctx: DSLContext, uid: UInteger, did: UInteger, dvid: UInteger): util.List[String] = { + val dataset = getDatasetByID(ctx, did, uid) + val versionHash = getDatasetVersionHashByID(ctx, did, dvid, uid) + + val fileNodes = GitVersionControlLocalFileStorage.retrieveRootFileNodesOfVersion( + Paths.get(dataset.getStoragePath), + versionHash + ) + + FileNode.getAllFileRelativePaths(fileNodes) + } + case class DashboardDataset( dataset: Dataset, accessPrivilege: EnumType, diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/type/FileNode.java b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/type/FileNode.java index 441ac2a93ab..0694b3e5541 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/type/FileNode.java +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/type/FileNode.java @@ -2,7 +2,9 @@ import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Objects; import java.util.Set; @@ -58,4 +60,30 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(absoluteFilePath, children); } + + /** + * Collects the relative paths of all file nodes from a given set of FileNode. + * @param nodes The set of FileNode to collect file paths from. + * @return A list of strings representing the relative paths of all file nodes. + */ + public static List getAllFileRelativePaths(Set nodes) { + List filePaths = new ArrayList<>(); + getAllFileRelativePathsHelper(nodes, filePaths); + return filePaths; + } + + /** + * Helper method to recursively collect the relative paths of all file nodes. + * @param nodes The current set of FileNode to collect file paths from. + * @param filePaths The list to add the relative paths of the file nodes to. + */ + private static void getAllFileRelativePathsHelper(Set nodes, List filePaths) { + for (FileNode node : nodes) { + if (node.isFile()) { + filePaths.add(node.getRelativePath().toString()); + } else if (node.isDirectory()) { + getAllFileRelativePathsHelper(node.getChildren(), filePaths); + } + } + } } diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala new file mode 100644 index 00000000000..7594c82f6a0 --- /dev/null +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala @@ -0,0 +1,438 @@ +package edu.uci.ics.texera.web.resource.dashboard.user.environment + +import edu.uci.ics.texera.Utils.withTransaction +import edu.uci.ics.texera.web.SqlServer +import edu.uci.ics.texera.web.auth.SessionUser +import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.{Dataset, DatasetOfEnvironment, DatasetVersion, Environment, EnvironmentOfWorkflow} +import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment.ENVIRONMENT +import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW +import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment.DATASET_OF_ENVIRONMENT +import edu.uci.ics.texera.web.model.jooq.generated.tables.daos.{DatasetDao, DatasetOfEnvironmentDao, DatasetVersionDao, EnvironmentDao, EnvironmentOfWorkflowDao} +import edu.uci.ics.texera.web.resource.dashboard.user.dataset.DatasetResource.retrieveDatasetVersionFilePaths +import edu.uci.ics.texera.web.resource.dashboard.user.dataset.{DatasetAccessResource, DatasetResource} +import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource.{DashboardEnvironment, DatasetID, DatasetOfEnvironmentAlreadyExistsMessage, DatasetOfEnvironmentDetails, DatasetOfEnvironmentDoseNotExistMessage, EnvironmentIDs, EnvironmentNotFoundMessage, UserNoPermissionExceptionMessage, WorkflowLink, context, doesDatasetExistInEnvironment, doesUserOwnEnvironment, getEnvironmentByEid, retrieveDatasetsAndVersions, retrieveDatasetsOfEnvironmentFileList, userHasReadAccessToEnvironment, userHasWriteAccessToEnvironment} +import edu.uci.ics.texera.web.resource.dashboard.user.workflow.WorkflowAccessResource +import io.dropwizard.auth.Auth +import org.jooq.DSLContext +import org.jooq.types.UInteger + +import java.net.URLDecoder +import javax.annotation.security.RolesAllowed +import javax.ws.rs.core.{MediaType, Response} +import javax.ws.rs.{GET, InternalServerErrorException, POST, Path, PathParam, Produces} +import scala.collection.mutable.{ArrayBuffer, ListBuffer} +import scala.jdk.CollectionConverters.CollectionHasAsScala +import scala.reflect.internal.util.NoSourceFile.path +import scala.util.matching.Regex + +object EnvironmentResource { + private val context = SqlServer.createDSLContext() + + def getEnvironmentByWid(ctx: DSLContext, uid: UInteger, wid: UInteger): Environment = { + val environmentOfWorkflowDao = new EnvironmentOfWorkflowDao(ctx.configuration()) + val environmentOfWorkflow = environmentOfWorkflowDao.fetchByWid(wid) + + if (environmentOfWorkflow == null || environmentOfWorkflow.isEmpty) { + throw new Exception("No environment associated with this workflow ID") + } + + getEnvironmentByEid(ctx, environmentOfWorkflow.get(0).getEid) + } + + def doesWorkflowHaveEnvironment(ctx: DSLContext, wid: UInteger): Boolean = { + val environmentOfWorkflowDao = new EnvironmentOfWorkflowDao(ctx.configuration()) + val environmentOfWorkflow = environmentOfWorkflowDao.fetchByWid(wid) + + environmentOfWorkflow != null && !environmentOfWorkflow.isEmpty + } + + def createEnvironment(ctx: DSLContext, uid: UInteger, name: String, description: String): Environment = { + val environment = new Environment() + environment.setOwnerUid(uid) + environment.setName(name) + environment.setDescription(description) + + ctx + .insertInto(ENVIRONMENT) + .set(ctx.newRecord(ENVIRONMENT, environment)) + .returning() + .fetchOne() + .into(classOf[Environment]) + } + + private def getEnvironmentByEid(ctx: DSLContext, eid: UInteger): Environment = { + val environmentDao: EnvironmentDao = new EnvironmentDao(ctx.configuration()) + val env = environmentDao.fetchOneByEid(eid) + + if (env == null) { + throw new Exception("Environment is not found") + } + + env + } + private def doesUserOwnEnvironment(ctx: DSLContext, uid: UInteger, eid: UInteger): Boolean = { + val environment = getEnvironmentByEid(ctx, eid) + environment.getOwnerUid == uid + } + + private def doesDatasetExistInEnvironment(ctx: DSLContext, did: UInteger, eid: UInteger): Boolean = { + val count = ctx.selectCount() + .from(DATASET_OF_ENVIRONMENT) + .where(DATASET_OF_ENVIRONMENT.EID.eq(eid) + .and(DATASET_OF_ENVIRONMENT.DID.eq(did))) + .fetchOne() // Fetch the record + + val countVal = count.getValue(0, classOf[Int]) // Get the count value from the record + countVal > 0 + } + + private def fetchEnvironmentIdOfWorkflow(ctx: DSLContext, wid: UInteger): Option[UInteger] = { + val environmentOfWorkflowDao = new EnvironmentOfWorkflowDao(ctx.configuration()) + val environmentOfWorkflow = environmentOfWorkflowDao.fetchByWid(wid) + if (environmentOfWorkflow.isEmpty) { + None + } else { + Some(environmentOfWorkflow.get(0).getEid) + } + } + + private def fetchWorkflowIdsOfEnvironment(ctx: DSLContext, eid: UInteger): List[UInteger] = { + val environmentOfWorkflowDao = new EnvironmentOfWorkflowDao(ctx.configuration()) + val envOfWorkflows = environmentOfWorkflowDao.fetchByEid(eid) + + // Extract wids from envOfWorkflows and collect them into a list + val workflowIds = envOfWorkflows.asScala.map(_.getWid).toList + workflowIds + } + private def userHasWriteAccessToEnvironment(ctx: DSLContext, eid: UInteger, uid: UInteger): Boolean = { + // if user is the owner of the environment, return true + if (doesUserOwnEnvironment(ctx, uid, eid)) { + return true + } + + // else, check the corresponding workflow if any, see if user has the write access to that workflow + fetchWorkflowIdsOfEnvironment(ctx, eid).foreach(wid => { + if (WorkflowAccessResource.hasWriteAccess(wid, uid)) { + return true + } + }) + false + } + private def userHasReadAccessToEnvironment(ctx: DSLContext, eid: UInteger, uid: UInteger): Boolean = { + // if user is the owner of the environment, return true + if (doesUserOwnEnvironment(ctx, uid, eid)) { + return true + } + + // else, check the corresponding workflow if any, see if user has the read access to that workflow + fetchWorkflowIdsOfEnvironment(ctx, eid).foreach(wid => { + if (WorkflowAccessResource.hasReadAccess(wid, uid)) { + return true + } + }) + false + } + + private def retrieveDatasetsAndVersions(ctx: DSLContext, uid: UInteger, eid: UInteger): List[DatasetOfEnvironmentDetails] = { + val datasetOfEnvironmentDao = new DatasetOfEnvironmentDao(ctx.configuration()) + val datasetsOfEnvironment = datasetOfEnvironmentDao.fetchByEid(eid).asScala + + datasetsOfEnvironment.map { datasetOfEnvironment => + val did = datasetOfEnvironment.getDid + val dvid = datasetOfEnvironment.getDvid + + // Check for read access to the dataset + if (!DatasetAccessResource.userHasReadAccess(ctx, did, uid)) { + throw new Exception(UserNoPermissionExceptionMessage) + } + + val datasetDao = new DatasetDao(ctx.configuration()) + val datasetVersionDao = new DatasetVersionDao(ctx.configuration()) + + // Retrieve the Dataset and DatasetVersion + val dataset = datasetDao.fetchOneByDid(did) + val datasetVersion = datasetVersionDao.fetchOneByDvid(dvid) + + if (dataset == null || datasetVersion == null) { + throw new Exception(EnvironmentNotFoundMessage) // Dataset or its version not found + } + + DatasetOfEnvironmentDetails(dataset, datasetVersion) + }.toList + } + + private def retrieveDatasetsOfEnvironmentFileList(ctx: DSLContext, uid: UInteger, datasetsOfEnv: List[DatasetOfEnvironmentDetails]): List[String] = { + datasetsOfEnv.flatMap(entry => { + val did = entry.dataset.getDid + val dvid = entry.version.getDvid + val datasetName = entry.dataset.getName + val fileList = retrieveDatasetVersionFilePaths(ctx, uid, did, dvid) + val resList: ListBuffer[String] = new ListBuffer[String] + fileList.forEach(file => resList.append(s"/$datasetName-$did/$file")) + resList.toList + }) + } + + + case class DashboardEnvironment( + environment: Environment, + isCurrentUserEditable: Boolean, + ) + + case class DatasetOfEnvironmentDetails( + dataset: Dataset, + version: DatasetVersion + ) + + case class EnvironmentIDs(eids: List[UInteger]) + + case class DatasetID(did: UInteger) + case class WorkflowLink(wid: UInteger) + + // error handling + private val UserNoPermissionExceptionMessage = "user has no permission for the environment" + private val EnvironmentNotFoundMessage = "environment not found" + private val DatasetOfEnvironmentAlreadyExistsMessage = + "the given dataset already exists in the environment" + private val DatasetOfEnvironmentDoseNotExistMessage = + "the given dataset does not exist in the environment" +} + +@RolesAllowed(Array("REGULAR", "ADMIN")) +@Path("/environment") +@Produces(Array(MediaType.APPLICATION_JSON)) +class EnvironmentResource { + + @POST + @Path("/create") + def createEnvironment(@Auth user: SessionUser, environment: Environment): DashboardEnvironment = { + + withTransaction(context) { ctx => + { + val uid = environment.getOwnerUid + + val createdEnvironment = EnvironmentResource.createEnvironment(ctx, uid, environment.getName, environment.getDescription) + + DashboardEnvironment( + new Environment( + createdEnvironment.getEid, + createdEnvironment.getOwnerUid, + createdEnvironment.getName, + createdEnvironment.getDescription, + createdEnvironment.getCreationTime + ), + isCurrentUserEditable = true + ) + } + } + } + + @POST + @Path("/delete") + def deleteEnvironments(environmentIDs: EnvironmentIDs, @Auth user: SessionUser): Response = { + val uid = user.getUid + withTransaction(context) { ctx => + val environmentDao: EnvironmentDao = new EnvironmentDao(ctx.configuration()) + + for (eid <- environmentIDs.eids) { + if (!doesUserOwnEnvironment(ctx, uid, eid)) { + throw new Exception(UserNoPermissionExceptionMessage) + } + environmentDao.deleteById(eid) + } + + Response.ok().build() + } + } + + @GET + @Path("/{eid}") + def retrieveEnvironmentByEid( + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser + ): DashboardEnvironment = { + val uid = user.getUid + + withTransaction(context) { ctx => + if (!userHasReadAccessToEnvironment(ctx, eid, uid)) { + throw new Exception(UserNoPermissionExceptionMessage) + } + val environment = getEnvironmentByEid(ctx, eid); + DashboardEnvironment( + environment = environment, + isCurrentUserEditable = userHasWriteAccessToEnvironment(ctx, eid, uid) + ) + } + } + + @GET + @Path("/{eid}/dataset") + def getDatasetsOfEnvironment( + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser + ): List[DatasetOfEnvironment] = { + val uid = user.getUid + withTransaction(context) { ctx => + if (!userHasReadAccessToEnvironment(ctx, eid, uid)) { + throw new Exception(UserNoPermissionExceptionMessage) + } + val datasetOfEnvironmentDao = new DatasetOfEnvironmentDao(ctx.configuration()) + val datasetsOfEnvironment = datasetOfEnvironmentDao.fetchByEid(eid) + datasetsOfEnvironment. + asScala. + toList + } + } + + @GET + @Path("/{eid}/dataset/details") + def getDatasetsOfEnvironmentDetails( + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser + ): List[DatasetOfEnvironmentDetails] = { + val uid = user.getUid + withTransaction(context) { ctx => + if (!userHasReadAccessToEnvironment(ctx, eid, uid)) { + throw new Exception(UserNoPermissionExceptionMessage) + } + retrieveDatasetsAndVersions(ctx, uid, eid) + } + } + + @POST + @Path("/{eid}/dataset/add") + def addDatasetForEnvironment( + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser, + datasetID: DatasetID + ): Response = { + val uid = user.getUid + withTransaction(context)(ctx => { + val did = datasetID.did + + if (!DatasetAccessResource.userHasReadAccess(ctx, did, uid) + || !userHasWriteAccessToEnvironment(ctx, eid, uid)) { + return Response + .status(Response.Status.FORBIDDEN) + .entity(UserNoPermissionExceptionMessage) + .build() + } + + if (doesDatasetExistInEnvironment(ctx, did, eid)) { + return Response + .status(Response.Status.BAD_REQUEST) + .entity(DatasetOfEnvironmentAlreadyExistsMessage) + .build() + } + + val datasetOfEnvironmentDao = new DatasetOfEnvironmentDao(ctx.configuration()) + val latestDatasetVersion = DatasetResource.getDatasetLatestVersion(ctx, did, uid) + datasetOfEnvironmentDao.insert(new DatasetOfEnvironment( + did, + eid, + latestDatasetVersion.getDvid + )) + Response.status(Response.Status.OK).build() + }) + } + + @POST + @Path("/{eid}/dataset/remove") + def removeDatasetForEnvironment( + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser, + datasetID: DatasetID, + ): Response = { + val uid = user.getUid + withTransaction(context)(ctx => { + val did = datasetID.did + + if (!DatasetAccessResource.userHasReadAccess(ctx, did, uid) + || !userHasWriteAccessToEnvironment(ctx, eid, uid)) { + return Response + .status(Response.Status.FORBIDDEN) + .entity(UserNoPermissionExceptionMessage) + .build() + } + + if (!doesDatasetExistInEnvironment(ctx, did, eid)) { + return Response + .status(Response.Status.BAD_REQUEST) + .entity(DatasetOfEnvironmentDoseNotExistMessage) + .build() + } + + + ctx.deleteFrom(DATASET_OF_ENVIRONMENT) + .where(DATASET_OF_ENVIRONMENT.DID.eq(did)) + .and(DATASET_OF_ENVIRONMENT.EID.eq(eid)) + .execute() + + Response.status(Response.Status.OK).build() + }) + } + @POST + @Path("/{eid}/linkWorkflow") + def linkWorkflowToEnvironment( + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser, + workflowLink: WorkflowLink + ): Response = { + val uid = user.getUid + + withTransaction(context)(ctx => { + val wid = workflowLink.wid + if (!userHasReadAccessToEnvironment(ctx, eid, uid)) { + return Response + .status(Response.Status.FORBIDDEN) + .entity(UserNoPermissionExceptionMessage) + .build() + } + + // Check if an entry with the specified wid already exists + val exists = ctx.selectCount() + .from(ENVIRONMENT_OF_WORKFLOW) + .where(ENVIRONMENT_OF_WORKFLOW.WID.eq(wid)) + .fetchOne(0, classOf[Int]) > 0 + + if (exists) { + // Update the existing entry + ctx.update(ENVIRONMENT_OF_WORKFLOW) + .set(ENVIRONMENT_OF_WORKFLOW.EID, eid) + .where(ENVIRONMENT_OF_WORKFLOW.WID.eq(wid)) + .execute() + } else { + // Insert a new entry + ctx.insertInto(ENVIRONMENT_OF_WORKFLOW) + .set(ENVIRONMENT_OF_WORKFLOW.EID, eid) + .set(ENVIRONMENT_OF_WORKFLOW.WID, wid) + .execute() + } + + Response.ok().build() + }) + } + + @GET + @Path("/{eid}/files/{query:.*}") + def getDatasetsFileList(@Auth user: SessionUser, @PathParam("eid") eid: UInteger, @PathParam("query") q: String): List[String] = { + val query = URLDecoder.decode(q, "UTF-8") + val uid = user.getUid + + withTransaction(context)(ctx => { + if (!userHasReadAccessToEnvironment(ctx, eid, uid)) { + throw new Exception(UserNoPermissionExceptionMessage) + } + val datasetsOfEnv = retrieveDatasetsAndVersions(ctx, uid, eid) + + val result = ArrayBuffer[String]() + val fileList = retrieveDatasetsOfEnvironmentFileList(ctx, uid, datasetsOfEnv) + + // Filter fileList based on query + val filteredList = fileList.filter(filePath => query.isEmpty || filePath.contains(query)) + result ++= filteredList + + result.toList + }) + } +} \ No newline at end of file diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala index 87354aa7f5a..2f468016d49 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala @@ -5,13 +5,10 @@ import edu.uci.ics.texera.web.SqlServer import edu.uci.ics.texera.web.auth.SessionUser import edu.uci.ics.texera.web.model.jooq.generated.Tables._ import edu.uci.ics.texera.web.model.jooq.generated.enums.WorkflowUserAccessPrivilege -import edu.uci.ics.texera.web.model.jooq.generated.tables.daos.{ - WorkflowDao, - WorkflowOfProjectDao, - WorkflowOfUserDao, - WorkflowUserAccessDao -} +import edu.uci.ics.texera.web.model.jooq.generated.tables.daos.{EnvironmentOfWorkflowDao, WorkflowDao, WorkflowOfProjectDao, WorkflowOfUserDao, WorkflowUserAccessDao} import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos._ +import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource +import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource.{createEnvironment, doesWorkflowHaveEnvironment} import edu.uci.ics.texera.web.resource.dashboard.user.workflow.WorkflowAccessResource.hasReadAccess import edu.uci.ics.texera.web.resource.dashboard.user.workflow.WorkflowResource._ import io.dropwizard.auth.Auth @@ -44,6 +41,7 @@ object WorkflowResource { context.configuration() ) final private lazy val workflowOfProjectDao = new WorkflowOfProjectDao(context.configuration) + final private lazy val environmentOfWorkflowDao = new EnvironmentOfWorkflowDao(context.configuration) private def insertWorkflow(workflow: Workflow, user: User): Unit = { workflowDao.insert(workflow) @@ -284,6 +282,7 @@ class WorkflowResource extends LazyLogging { @Path("/persist") def persistWorkflow(workflow: Workflow, @Auth sessionUser: SessionUser): Workflow = { val user = sessionUser.getUser + val uid = user.getUid if (workflowOfUserExists(workflow.getWid, user.getUid)) { WorkflowVersionResource.insertVersion(workflow, insertNewFlag = false) @@ -303,8 +302,22 @@ class WorkflowResource extends LazyLogging { throw new ForbiddenException("No sufficient access privilege.") } } - workflowDao.fetchOneByWid(workflow.getWid) + val wid = workflow.getWid + // check if the runtime environment of this workflow exists, if not, create one + if (!doesWorkflowHaveEnvironment(context, wid)) { + // create an environment, and associate this environment to this workflow + val createdEnvironment = createEnvironment( + context, + uid, + "Environment of Workflow #%d %s".format(wid.intValue(), workflow.getName), + "Runtime Environment of Workflow #%d %s".format(wid.intValue(), workflow.getName) + ) + + environmentOfWorkflowDao.insert( + new EnvironmentOfWorkflow(createdEnvironment.getEid, wid)) + } + workflowDao.fetchOneByWid(wid) } /** @@ -455,4 +468,18 @@ class WorkflowResource extends LazyLogging { } } + @GET + @Path("/{wid}/environment") + def retrieveWorkflowEnvironment( + @PathParam("wid") wid: UInteger, + @Auth user: SessionUser + ): Environment = { + + val uid = user.getUid + if (!hasReadAccess(wid, uid)) { + throw new ForbiddenException("current user has no read access to this workflow and its environment") + } + + EnvironmentResource.getEnvironmentByWid(context, uid, wid) + } } diff --git a/core/scripts/sql/texera_ddl.sql b/core/scripts/sql/texera_ddl.sql index a35af3a3e3a..62ced698b12 100644 --- a/core/scripts/sql/texera_ddl.sql +++ b/core/scripts/sql/texera_ddl.sql @@ -269,6 +269,17 @@ CREATE TABLE IF NOT EXISTS dataset_version FOREIGN KEY (`did`) REFERENCES `dataset` (`did`) ON DELETE CASCADE ) ENGINE = INNODB; + +CREATE TABLE IF NOT EXISTS dataset_of_environment +( + `did` INT UNSIGNED NOT NULL, + `eid` INT UNSIGNED NOT NULL, + `dvid` INT UNSIGNED NOT NULL, + PRIMARY KEY (`did`, `eid`), + FOREIGN KEY (`eid`) REFERENCES `environment` (`eid`) ON DELETE CASCADE, + FOREIGN KEY (`dvid`) REFERENCES `dataset_version` (`dvid`) ON DELETE CASCADE +) ENGINE = INNODB; + -- create fulltext search indexes CREATE FULLTEXT INDEX `idx_workflow_name_description_content` ON `texera_db`.`workflow` (name, description, content); diff --git a/core/scripts/sql/update/09.sql b/core/scripts/sql/update/09.sql index e780973f895..276e684408c 100644 --- a/core/scripts/sql/update/09.sql +++ b/core/scripts/sql/update/09.sql @@ -20,6 +20,16 @@ CREATE TABLE IF NOT EXISTS environment_of_workflow FOREIGN KEY (`eid`) REFERENCES `environment` (`eid`) ON DELETE CASCADE ) ENGINE = INNODB; +CREATE TABLE IF NOT EXISTS dataset_of_environment +( + `did` INT UNSIGNED NOT NULL, + `eid` INT UNSIGNED NOT NULL, + `dvid` INT UNSIGNED NOT NULL, + PRIMARY KEY (`did`, `eid`), + FOREIGN KEY (`eid`) REFERENCES `environment` (`eid`) ON DELETE CASCADE, + FOREIGN KEY (`dvid`) REFERENCES `dataset_version` (`dvid`) ON DELETE CASCADE +) ENGINE = INNODB; + -- Add the `environment_eid` column to the `workflow_executions` table ALTER TABLE workflow_executions ADD COLUMN `environment_eid` INT UNSIGNED; From def34dbf1f103486cfc3d7ea1c307d4511292fae Mon Sep 17 00:00:00 2001 From: Jiadong Bai Date: Wed, 28 Feb 2024 15:58:45 -0800 Subject: [PATCH 3/6] format --- .../ics/texera/web/TexeraWebApplication.scala | 30 ++- .../user/dataset/DatasetResource.scala | 7 +- .../environment/EnvironmentResource.scala | 231 ++++++++++++------ .../user/workflow/WorkflowResource.scala | 30 ++- 4 files changed, 206 insertions(+), 92 deletions(-) diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala index 377f0f4b340..aafad95212f 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala @@ -15,23 +15,43 @@ import edu.uci.ics.texera.Utils import edu.uci.ics.texera.Utils.{maptoStatusCode, objectMapper} import edu.uci.ics.texera.web.TexeraWebApplication.scheduleRecurringCallThroughActorSystem import edu.uci.ics.texera.web.auth.JwtAuth.jwtConsumer -import edu.uci.ics.texera.web.auth.{GuestAuthFilter, SessionUser, UserAuthenticator, UserRoleAuthorizer} +import edu.uci.ics.texera.web.auth.{ + GuestAuthFilter, + SessionUser, + UserAuthenticator, + UserRoleAuthorizer +} import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.WorkflowExecutions import edu.uci.ics.texera.web.resource.auth.{AuthResource, GoogleAuthResource} import edu.uci.ics.texera.web.resource._ import edu.uci.ics.texera.web.resource.dashboard.DashboardResource import edu.uci.ics.texera.web.resource.dashboard.admin.execution.AdminExecutionResource import edu.uci.ics.texera.web.resource.dashboard.admin.user.AdminUserResource -import edu.uci.ics.texera.web.resource.dashboard.user.dataset.{DatasetAccessResource, DatasetResource} +import edu.uci.ics.texera.web.resource.dashboard.user.dataset.{ + DatasetAccessResource, + DatasetResource +} import edu.uci.ics.texera.web.resource.dashboard.user.dataset.`type`.{FileNode, FileNodeSerializer} import edu.uci.ics.texera.web.resource.dashboard.user.dataset.service.GitVersionControlLocalFileStorage import edu.uci.ics.texera.web.resource.dashboard.user.dataset.utils.PathUtils.getAllDatasetDirectories -import edu.uci.ics.texera.web.resource.dashboard.user.file.{UserFileAccessResource, UserFileResource} -import edu.uci.ics.texera.web.resource.dashboard.user.project.{ProjectAccessResource, ProjectResource, PublicProjectResource} +import edu.uci.ics.texera.web.resource.dashboard.user.file.{ + UserFileAccessResource, + UserFileResource +} +import edu.uci.ics.texera.web.resource.dashboard.user.project.{ + ProjectAccessResource, + ProjectResource, + PublicProjectResource +} import edu.uci.ics.texera.web.resource.dashboard.user.quota.UserQuotaResource import edu.uci.ics.texera.web.resource.dashboard.user.discussion.UserDiscussionResource import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource -import edu.uci.ics.texera.web.resource.dashboard.user.workflow.{WorkflowAccessResource, WorkflowExecutionsResource, WorkflowResource, WorkflowVersionResource} +import edu.uci.ics.texera.web.resource.dashboard.user.workflow.{ + WorkflowAccessResource, + WorkflowExecutionsResource, + WorkflowResource, + WorkflowVersionResource +} import edu.uci.ics.texera.web.service.ExecutionsMetadataPersistService import edu.uci.ics.texera.web.storage.MongoDatabaseManager import edu.uci.ics.texera.web.workflowruntimestate.WorkflowAggregatedState.{COMPLETED, FAILED} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala index 95b205bc068..d84d6977cd8 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/dataset/DatasetResource.scala @@ -256,7 +256,12 @@ object DatasetResource { } } - def retrieveDatasetVersionFilePaths(ctx: DSLContext, uid: UInteger, did: UInteger, dvid: UInteger): util.List[String] = { + def retrieveDatasetVersionFilePaths( + ctx: DSLContext, + uid: UInteger, + did: UInteger, + dvid: UInteger + ): util.List[String] = { val dataset = getDatasetByID(ctx, did, uid) val versionHash = getDatasetVersionHashByID(ctx, did, dvid, uid) diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala index 7594c82f6a0..0307980983c 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala @@ -3,14 +3,47 @@ package edu.uci.ics.texera.web.resource.dashboard.user.environment import edu.uci.ics.texera.Utils.withTransaction import edu.uci.ics.texera.web.SqlServer import edu.uci.ics.texera.web.auth.SessionUser -import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.{Dataset, DatasetOfEnvironment, DatasetVersion, Environment, EnvironmentOfWorkflow} +import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.{ + Dataset, + DatasetOfEnvironment, + DatasetVersion, + Environment, + EnvironmentOfWorkflow +} import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment.ENVIRONMENT import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW import edu.uci.ics.texera.web.model.jooq.generated.tables.DatasetOfEnvironment.DATASET_OF_ENVIRONMENT -import edu.uci.ics.texera.web.model.jooq.generated.tables.daos.{DatasetDao, DatasetOfEnvironmentDao, DatasetVersionDao, EnvironmentDao, EnvironmentOfWorkflowDao} +import edu.uci.ics.texera.web.model.jooq.generated.tables.daos.{ + DatasetDao, + DatasetOfEnvironmentDao, + DatasetVersionDao, + EnvironmentDao, + EnvironmentOfWorkflowDao +} import edu.uci.ics.texera.web.resource.dashboard.user.dataset.DatasetResource.retrieveDatasetVersionFilePaths -import edu.uci.ics.texera.web.resource.dashboard.user.dataset.{DatasetAccessResource, DatasetResource} -import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource.{DashboardEnvironment, DatasetID, DatasetOfEnvironmentAlreadyExistsMessage, DatasetOfEnvironmentDetails, DatasetOfEnvironmentDoseNotExistMessage, EnvironmentIDs, EnvironmentNotFoundMessage, UserNoPermissionExceptionMessage, WorkflowLink, context, doesDatasetExistInEnvironment, doesUserOwnEnvironment, getEnvironmentByEid, retrieveDatasetsAndVersions, retrieveDatasetsOfEnvironmentFileList, userHasReadAccessToEnvironment, userHasWriteAccessToEnvironment} +import edu.uci.ics.texera.web.resource.dashboard.user.dataset.{ + DatasetAccessResource, + DatasetResource +} +import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource.{ + DashboardEnvironment, + DatasetID, + DatasetOfEnvironmentAlreadyExistsMessage, + DatasetOfEnvironmentDetails, + DatasetOfEnvironmentDoseNotExistMessage, + EnvironmentIDs, + EnvironmentNotFoundMessage, + UserNoPermissionExceptionMessage, + WorkflowLink, + context, + doesDatasetExistInEnvironment, + doesUserOwnEnvironment, + getEnvironmentByEid, + retrieveDatasetsAndVersions, + retrieveDatasetsOfEnvironmentFileList, + userHasReadAccessToEnvironment, + userHasWriteAccessToEnvironment +} import edu.uci.ics.texera.web.resource.dashboard.user.workflow.WorkflowAccessResource import io.dropwizard.auth.Auth import org.jooq.DSLContext @@ -46,7 +79,12 @@ object EnvironmentResource { environmentOfWorkflow != null && !environmentOfWorkflow.isEmpty } - def createEnvironment(ctx: DSLContext, uid: UInteger, name: String, description: String): Environment = { + def createEnvironment( + ctx: DSLContext, + uid: UInteger, + name: String, + description: String + ): Environment = { val environment = new Environment() environment.setOwnerUid(uid) environment.setName(name) @@ -75,11 +113,19 @@ object EnvironmentResource { environment.getOwnerUid == uid } - private def doesDatasetExistInEnvironment(ctx: DSLContext, did: UInteger, eid: UInteger): Boolean = { - val count = ctx.selectCount() + private def doesDatasetExistInEnvironment( + ctx: DSLContext, + did: UInteger, + eid: UInteger + ): Boolean = { + val count = ctx + .selectCount() .from(DATASET_OF_ENVIRONMENT) - .where(DATASET_OF_ENVIRONMENT.EID.eq(eid) - .and(DATASET_OF_ENVIRONMENT.DID.eq(did))) + .where( + DATASET_OF_ENVIRONMENT.EID + .eq(eid) + .and(DATASET_OF_ENVIRONMENT.DID.eq(did)) + ) .fetchOne() // Fetch the record val countVal = count.getValue(0, classOf[Int]) // Get the count value from the record @@ -104,7 +150,11 @@ object EnvironmentResource { val workflowIds = envOfWorkflows.asScala.map(_.getWid).toList workflowIds } - private def userHasWriteAccessToEnvironment(ctx: DSLContext, eid: UInteger, uid: UInteger): Boolean = { + private def userHasWriteAccessToEnvironment( + ctx: DSLContext, + eid: UInteger, + uid: UInteger + ): Boolean = { // if user is the owner of the environment, return true if (doesUserOwnEnvironment(ctx, uid, eid)) { return true @@ -118,7 +168,11 @@ object EnvironmentResource { }) false } - private def userHasReadAccessToEnvironment(ctx: DSLContext, eid: UInteger, uid: UInteger): Boolean = { + private def userHasReadAccessToEnvironment( + ctx: DSLContext, + eid: UInteger, + uid: UInteger + ): Boolean = { // if user is the owner of the environment, return true if (doesUserOwnEnvironment(ctx, uid, eid)) { return true @@ -133,7 +187,11 @@ object EnvironmentResource { false } - private def retrieveDatasetsAndVersions(ctx: DSLContext, uid: UInteger, eid: UInteger): List[DatasetOfEnvironmentDetails] = { + private def retrieveDatasetsAndVersions( + ctx: DSLContext, + uid: UInteger, + eid: UInteger + ): List[DatasetOfEnvironmentDetails] = { val datasetOfEnvironmentDao = new DatasetOfEnvironmentDao(ctx.configuration()) val datasetsOfEnvironment = datasetOfEnvironmentDao.fetchByEid(eid).asScala @@ -161,7 +219,11 @@ object EnvironmentResource { }.toList } - private def retrieveDatasetsOfEnvironmentFileList(ctx: DSLContext, uid: UInteger, datasetsOfEnv: List[DatasetOfEnvironmentDetails]): List[String] = { + private def retrieveDatasetsOfEnvironmentFileList( + ctx: DSLContext, + uid: UInteger, + datasetsOfEnv: List[DatasetOfEnvironmentDetails] + ): List[String] = { datasetsOfEnv.flatMap(entry => { val did = entry.dataset.getDid val dvid = entry.version.getDvid @@ -173,16 +235,15 @@ object EnvironmentResource { }) } - case class DashboardEnvironment( - environment: Environment, - isCurrentUserEditable: Boolean, - ) + environment: Environment, + isCurrentUserEditable: Boolean + ) case class DatasetOfEnvironmentDetails( - dataset: Dataset, - version: DatasetVersion - ) + dataset: Dataset, + version: DatasetVersion + ) case class EnvironmentIDs(eids: List[UInteger]) @@ -208,22 +269,27 @@ class EnvironmentResource { def createEnvironment(@Auth user: SessionUser, environment: Environment): DashboardEnvironment = { withTransaction(context) { ctx => - { - val uid = environment.getOwnerUid - - val createdEnvironment = EnvironmentResource.createEnvironment(ctx, uid, environment.getName, environment.getDescription) - - DashboardEnvironment( - new Environment( - createdEnvironment.getEid, - createdEnvironment.getOwnerUid, - createdEnvironment.getName, - createdEnvironment.getDescription, - createdEnvironment.getCreationTime - ), - isCurrentUserEditable = true - ) - } + { + val uid = environment.getOwnerUid + + val createdEnvironment = EnvironmentResource.createEnvironment( + ctx, + uid, + environment.getName, + environment.getDescription + ) + + DashboardEnvironment( + new Environment( + createdEnvironment.getEid, + createdEnvironment.getOwnerUid, + createdEnvironment.getName, + createdEnvironment.getDescription, + createdEnvironment.getCreationTime + ), + isCurrentUserEditable = true + ) + } } } @@ -248,9 +314,9 @@ class EnvironmentResource { @GET @Path("/{eid}") def retrieveEnvironmentByEid( - @PathParam("eid") eid: UInteger, - @Auth user: SessionUser - ): DashboardEnvironment = { + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser + ): DashboardEnvironment = { val uid = user.getUid withTransaction(context) { ctx => @@ -268,9 +334,9 @@ class EnvironmentResource { @GET @Path("/{eid}/dataset") def getDatasetsOfEnvironment( - @PathParam("eid") eid: UInteger, - @Auth user: SessionUser - ): List[DatasetOfEnvironment] = { + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser + ): List[DatasetOfEnvironment] = { val uid = user.getUid withTransaction(context) { ctx => if (!userHasReadAccessToEnvironment(ctx, eid, uid)) { @@ -278,18 +344,16 @@ class EnvironmentResource { } val datasetOfEnvironmentDao = new DatasetOfEnvironmentDao(ctx.configuration()) val datasetsOfEnvironment = datasetOfEnvironmentDao.fetchByEid(eid) - datasetsOfEnvironment. - asScala. - toList + datasetsOfEnvironment.asScala.toList } } @GET @Path("/{eid}/dataset/details") def getDatasetsOfEnvironmentDetails( - @PathParam("eid") eid: UInteger, - @Auth user: SessionUser - ): List[DatasetOfEnvironmentDetails] = { + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser + ): List[DatasetOfEnvironmentDetails] = { val uid = user.getUid withTransaction(context) { ctx => if (!userHasReadAccessToEnvironment(ctx, eid, uid)) { @@ -302,16 +366,18 @@ class EnvironmentResource { @POST @Path("/{eid}/dataset/add") def addDatasetForEnvironment( - @PathParam("eid") eid: UInteger, - @Auth user: SessionUser, - datasetID: DatasetID - ): Response = { + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser, + datasetID: DatasetID + ): Response = { val uid = user.getUid - withTransaction(context)(ctx => { + withTransaction(context)(ctx => { val did = datasetID.did - if (!DatasetAccessResource.userHasReadAccess(ctx, did, uid) - || !userHasWriteAccessToEnvironment(ctx, eid, uid)) { + if ( + !DatasetAccessResource.userHasReadAccess(ctx, did, uid) + || !userHasWriteAccessToEnvironment(ctx, eid, uid) + ) { return Response .status(Response.Status.FORBIDDEN) .entity(UserNoPermissionExceptionMessage) @@ -327,11 +393,13 @@ class EnvironmentResource { val datasetOfEnvironmentDao = new DatasetOfEnvironmentDao(ctx.configuration()) val latestDatasetVersion = DatasetResource.getDatasetLatestVersion(ctx, did, uid) - datasetOfEnvironmentDao.insert(new DatasetOfEnvironment( - did, - eid, - latestDatasetVersion.getDvid - )) + datasetOfEnvironmentDao.insert( + new DatasetOfEnvironment( + did, + eid, + latestDatasetVersion.getDvid + ) + ) Response.status(Response.Status.OK).build() }) } @@ -339,16 +407,18 @@ class EnvironmentResource { @POST @Path("/{eid}/dataset/remove") def removeDatasetForEnvironment( - @PathParam("eid") eid: UInteger, - @Auth user: SessionUser, - datasetID: DatasetID, - ): Response = { + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser, + datasetID: DatasetID + ): Response = { val uid = user.getUid withTransaction(context)(ctx => { val did = datasetID.did - if (!DatasetAccessResource.userHasReadAccess(ctx, did, uid) - || !userHasWriteAccessToEnvironment(ctx, eid, uid)) { + if ( + !DatasetAccessResource.userHasReadAccess(ctx, did, uid) + || !userHasWriteAccessToEnvironment(ctx, eid, uid) + ) { return Response .status(Response.Status.FORBIDDEN) .entity(UserNoPermissionExceptionMessage) @@ -362,8 +432,8 @@ class EnvironmentResource { .build() } - - ctx.deleteFrom(DATASET_OF_ENVIRONMENT) + ctx + .deleteFrom(DATASET_OF_ENVIRONMENT) .where(DATASET_OF_ENVIRONMENT.DID.eq(did)) .and(DATASET_OF_ENVIRONMENT.EID.eq(eid)) .execute() @@ -374,10 +444,10 @@ class EnvironmentResource { @POST @Path("/{eid}/linkWorkflow") def linkWorkflowToEnvironment( - @PathParam("eid") eid: UInteger, - @Auth user: SessionUser, - workflowLink: WorkflowLink - ): Response = { + @PathParam("eid") eid: UInteger, + @Auth user: SessionUser, + workflowLink: WorkflowLink + ): Response = { val uid = user.getUid withTransaction(context)(ctx => { @@ -390,20 +460,23 @@ class EnvironmentResource { } // Check if an entry with the specified wid already exists - val exists = ctx.selectCount() + val exists = ctx + .selectCount() .from(ENVIRONMENT_OF_WORKFLOW) .where(ENVIRONMENT_OF_WORKFLOW.WID.eq(wid)) .fetchOne(0, classOf[Int]) > 0 if (exists) { // Update the existing entry - ctx.update(ENVIRONMENT_OF_WORKFLOW) + ctx + .update(ENVIRONMENT_OF_WORKFLOW) .set(ENVIRONMENT_OF_WORKFLOW.EID, eid) .where(ENVIRONMENT_OF_WORKFLOW.WID.eq(wid)) .execute() } else { // Insert a new entry - ctx.insertInto(ENVIRONMENT_OF_WORKFLOW) + ctx + .insertInto(ENVIRONMENT_OF_WORKFLOW) .set(ENVIRONMENT_OF_WORKFLOW.EID, eid) .set(ENVIRONMENT_OF_WORKFLOW.WID, wid) .execute() @@ -415,7 +488,11 @@ class EnvironmentResource { @GET @Path("/{eid}/files/{query:.*}") - def getDatasetsFileList(@Auth user: SessionUser, @PathParam("eid") eid: UInteger, @PathParam("query") q: String): List[String] = { + def getDatasetsFileList( + @Auth user: SessionUser, + @PathParam("eid") eid: UInteger, + @PathParam("query") q: String + ): List[String] = { val query = URLDecoder.decode(q, "UTF-8") val uid = user.getUid @@ -435,4 +512,4 @@ class EnvironmentResource { result.toList }) } -} \ No newline at end of file +} diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala index 2f468016d49..18b0bbd141d 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala @@ -5,10 +5,19 @@ import edu.uci.ics.texera.web.SqlServer import edu.uci.ics.texera.web.auth.SessionUser import edu.uci.ics.texera.web.model.jooq.generated.Tables._ import edu.uci.ics.texera.web.model.jooq.generated.enums.WorkflowUserAccessPrivilege -import edu.uci.ics.texera.web.model.jooq.generated.tables.daos.{EnvironmentOfWorkflowDao, WorkflowDao, WorkflowOfProjectDao, WorkflowOfUserDao, WorkflowUserAccessDao} +import edu.uci.ics.texera.web.model.jooq.generated.tables.daos.{ + EnvironmentOfWorkflowDao, + WorkflowDao, + WorkflowOfProjectDao, + WorkflowOfUserDao, + WorkflowUserAccessDao +} import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos._ import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource -import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource.{createEnvironment, doesWorkflowHaveEnvironment} +import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentResource.{ + createEnvironment, + doesWorkflowHaveEnvironment +} import edu.uci.ics.texera.web.resource.dashboard.user.workflow.WorkflowAccessResource.hasReadAccess import edu.uci.ics.texera.web.resource.dashboard.user.workflow.WorkflowResource._ import io.dropwizard.auth.Auth @@ -41,7 +50,9 @@ object WorkflowResource { context.configuration() ) final private lazy val workflowOfProjectDao = new WorkflowOfProjectDao(context.configuration) - final private lazy val environmentOfWorkflowDao = new EnvironmentOfWorkflowDao(context.configuration) + final private lazy val environmentOfWorkflowDao = new EnvironmentOfWorkflowDao( + context.configuration + ) private def insertWorkflow(workflow: Workflow, user: User): Unit = { workflowDao.insert(workflow) @@ -314,8 +325,7 @@ class WorkflowResource extends LazyLogging { "Runtime Environment of Workflow #%d %s".format(wid.intValue(), workflow.getName) ) - environmentOfWorkflowDao.insert( - new EnvironmentOfWorkflow(createdEnvironment.getEid, wid)) + environmentOfWorkflowDao.insert(new EnvironmentOfWorkflow(createdEnvironment.getEid, wid)) } workflowDao.fetchOneByWid(wid) } @@ -471,13 +481,15 @@ class WorkflowResource extends LazyLogging { @GET @Path("/{wid}/environment") def retrieveWorkflowEnvironment( - @PathParam("wid") wid: UInteger, - @Auth user: SessionUser - ): Environment = { + @PathParam("wid") wid: UInteger, + @Auth user: SessionUser + ): Environment = { val uid = user.getUid if (!hasReadAccess(wid, uid)) { - throw new ForbiddenException("current user has no read access to this workflow and its environment") + throw new ForbiddenException( + "current user has no read access to this workflow and its environment" + ) } EnvironmentResource.getEnvironmentByWid(context, uid, wid) From 0047eb47912c0c9f0e42591b9642b06df5f0fb7a Mon Sep 17 00:00:00 2001 From: Jiadong Bai Date: Thu, 29 Feb 2024 10:34:28 -0800 Subject: [PATCH 4/6] format --- .../dashboard/user/environment/EnvironmentResource.scala | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala index 0307980983c..74c5fd0d6c0 100644 --- a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala +++ b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/user/environment/EnvironmentResource.scala @@ -7,8 +7,7 @@ import edu.uci.ics.texera.web.model.jooq.generated.tables.pojos.{ Dataset, DatasetOfEnvironment, DatasetVersion, - Environment, - EnvironmentOfWorkflow + Environment } import edu.uci.ics.texera.web.model.jooq.generated.tables.Environment.ENVIRONMENT import edu.uci.ics.texera.web.model.jooq.generated.tables.EnvironmentOfWorkflow.ENVIRONMENT_OF_WORKFLOW @@ -32,7 +31,6 @@ import edu.uci.ics.texera.web.resource.dashboard.user.environment.EnvironmentRes DatasetOfEnvironmentDetails, DatasetOfEnvironmentDoseNotExistMessage, EnvironmentIDs, - EnvironmentNotFoundMessage, UserNoPermissionExceptionMessage, WorkflowLink, context, @@ -52,11 +50,9 @@ import org.jooq.types.UInteger import java.net.URLDecoder import javax.annotation.security.RolesAllowed import javax.ws.rs.core.{MediaType, Response} -import javax.ws.rs.{GET, InternalServerErrorException, POST, Path, PathParam, Produces} +import javax.ws.rs.{GET, POST, Path, PathParam, Produces} import scala.collection.mutable.{ArrayBuffer, ListBuffer} import scala.jdk.CollectionConverters.CollectionHasAsScala -import scala.reflect.internal.util.NoSourceFile.path -import scala.util.matching.Regex object EnvironmentResource { private val context = SqlServer.createDSLContext() From a910e24e66302ae33eb0df4d6f9df614b77d071a Mon Sep 17 00:00:00 2001 From: Jiadong Bai Date: Thu, 29 Feb 2024 15:47:22 -0800 Subject: [PATCH 5/6] fix ddl --- core/scripts/sql/texera_ddl.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/scripts/sql/texera_ddl.sql b/core/scripts/sql/texera_ddl.sql index 62ced698b12..77367420d5d 100644 --- a/core/scripts/sql/texera_ddl.sql +++ b/core/scripts/sql/texera_ddl.sql @@ -18,8 +18,8 @@ DROP TABLE IF EXISTS `workflow_executions`; DROP TABLE IF EXISTS `dataset`; DROP TABLE IF EXISTS `dataset_user_access`; DROP TABLE IF EXISTS `dataset_version`; -DROP TABLE IF EXISTS `environment` -DROP TABLE IF EXISTS `environment_of_workflow` +DROP TABLE IF EXISTS `environment`; +DROP TABLE IF EXISTS `environment_of_workflow`; SET PERSIST time_zone = '+00:00'; -- this line is mandatory From f7c91ed37a701d77f3bf1c2d3f2ad3015b0e4eee Mon Sep 17 00:00:00 2001 From: Jiadong Bai Date: Thu, 29 Feb 2024 16:08:10 -0800 Subject: [PATCH 6/6] fix ddl --- core/scripts/sql/texera_ddl.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/scripts/sql/texera_ddl.sql b/core/scripts/sql/texera_ddl.sql index 77367420d5d..87ef1f0981f 100644 --- a/core/scripts/sql/texera_ddl.sql +++ b/core/scripts/sql/texera_ddl.sql @@ -204,8 +204,8 @@ CREATE TABLE IF NOT EXISTS workflow_executions `log_location` TEXT, /* uri to log storage */ PRIMARY KEY (`eid`), FOREIGN KEY (`vid`) REFERENCES `workflow_version` (`vid`) ON DELETE CASCADE, - FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON DELETE CASCADE - FOREIGN KEY (`environment_eid`) REFERENCES environment(`eid`) ON DELETE SET NULL, + FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON DELETE CASCADE, + FOREIGN KEY (`environment_eid`) REFERENCES environment(`eid`) ON DELETE SET NULL ) ENGINE = INNODB; CREATE TABLE IF NOT EXISTS public_project