diff --git a/CDP4Orm/AutoGenDao/ActionItemDao.cs b/CDP4Orm/AutoGenDao/ActionItemDao.cs index f228bf88..feb4caa4 100644 --- a/CDP4Orm/AutoGenDao/ActionItemDao.cs +++ b/CDP4Orm/AutoGenDao/ActionItemDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -289,6 +285,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, actionItem, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The actionItem DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActionItem actionItem, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, actionItem, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CloseOutDate", !this.IsDerived(actionItem, "CloseOutDate") && actionItem.CloseOutDate.HasValue ? actionItem.CloseOutDate.Value.ToString(Utils.DateTimeUtcSerializationFormat) : null }, + { "CloseOutStatement", !this.IsDerived(actionItem, "CloseOutStatement") ? actionItem.CloseOutStatement.Escape() : null }, + { "DueDate", !this.IsDerived(actionItem, "DueDate") ? actionItem.DueDate.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ActionItem\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Actionee\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :actionee)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = actionItem.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("actionee", NpgsqlDbType.Uuid).Value = !this.IsDerived(actionItem, "Actionee") ? actionItem.Actionee : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Actionee\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :actionee);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -372,5 +425,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ActualFiniteStateDao.cs b/CDP4Orm/AutoGenDao/ActualFiniteStateDao.cs index abd46008..3d287db9 100644 --- a/CDP4Orm/AutoGenDao/ActualFiniteStateDao.cs +++ b/CDP4Orm/AutoGenDao/ActualFiniteStateDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -226,6 +222,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, actualFiniteState, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The actualFiniteState DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActualFiniteState actualFiniteState, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, actualFiniteState, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Kind", !this.IsDerived(actualFiniteState, "Kind") ? actualFiniteState.Kind.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ActualFiniteState\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = actualFiniteState.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + actualFiniteState.PossibleState.ForEach(x => this.UpsertPossibleState(transaction, partition, actualFiniteState.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -306,6 +358,49 @@ public bool AddPossibleState(NpgsqlTransaction transaction, string partition, Gu } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertPossibleState(NpgsqlTransaction transaction, string partition, Guid iid, Guid possibleState) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ActualFiniteState_PossibleState\"", partition); + sqlBuilder.AppendFormat(" (\"ActualFiniteState\", \"PossibleState\")"); + sqlBuilder.Append(" VALUES (:actualFiniteState, :possibleState)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ActualFiniteState_PossibleState_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ActualFiniteState\", \"PossibleState\")"); + sqlBuilder.Append(" = (:actualFiniteState, :possibleState);"); + + command.Parameters.Add("actualFiniteState", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("possibleState", NpgsqlDbType.Uuid).Value = possibleState; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -388,6 +483,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ActualFiniteStateListDao.cs b/CDP4Orm/AutoGenDao/ActualFiniteStateListDao.cs index a905ff1b..845bc50b 100644 --- a/CDP4Orm/AutoGenDao/ActualFiniteStateListDao.cs +++ b/CDP4Orm/AutoGenDao/ActualFiniteStateListDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -219,6 +215,58 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, actualFiniteStateList, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The actualFiniteStateList DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActualFiniteStateList actualFiniteStateList, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, actualFiniteStateList, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ActualFiniteStateList\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = actualFiniteStateList.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(actualFiniteStateList, "Owner") ? actualFiniteStateList.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + actualFiniteStateList.ExcludeOption.ForEach(x => this.UpsertExcludeOption(transaction, partition, actualFiniteStateList.Iid, x)); + actualFiniteStateList.PossibleFiniteStateList.ForEach(x => this.UpsertPossibleFiniteStateList(transaction, partition, actualFiniteStateList.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -304,6 +352,49 @@ public bool AddExcludeOption(NpgsqlTransaction transaction, string partition, Gu return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertExcludeOption(NpgsqlTransaction transaction, string partition, Guid iid, Guid excludeOption) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ActualFiniteStateList_ExcludeOption\"", partition); + sqlBuilder.AppendFormat(" (\"ActualFiniteStateList\", \"ExcludeOption\")"); + sqlBuilder.Append(" VALUES (:actualFiniteStateList, :excludeOption)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ActualFiniteStateList_ExcludeOption_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ActualFiniteStateList\", \"ExcludeOption\")"); + sqlBuilder.Append(" = (:actualFiniteStateList, :excludeOption);"); + + command.Parameters.Add("actualFiniteStateList", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("excludeOption", NpgsqlDbType.Uuid).Value = excludeOption; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -343,6 +434,50 @@ public bool AddPossibleFiniteStateList(NpgsqlTransaction transaction, string par } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertPossibleFiniteStateList(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem possibleFiniteStateList) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ActualFiniteStateList_PossibleFiniteStateList\"", partition); + sqlBuilder.AppendFormat(" (\"ActualFiniteStateList\", \"PossibleFiniteStateList\", \"Sequence\")"); + sqlBuilder.Append(" VALUES (:actualFiniteStateList, :possibleFiniteStateList, :sequence)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ActualFiniteStateList_PossibleFiniteStateList_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.AppendFormat(" SET (\"ActualFiniteStateList\", \"PossibleFiniteStateList\", \"Sequence\")"); + sqlBuilder.Append(" = (:actualFiniteStateList, :possibleFiniteStateList, :sequence);"); + + command.Parameters.Add("actualFiniteStateList", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("possibleFiniteStateList", NpgsqlDbType.Uuid).Value = Guid.Parse(possibleFiniteStateList.V.ToString()); + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = possibleFiniteStateList.K; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -505,6 +640,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/AliasDao.cs b/CDP4Orm/AutoGenDao/AliasDao.cs index 85e118b7..5a218ea3 100644 --- a/CDP4Orm/AutoGenDao/AliasDao.cs +++ b/CDP4Orm/AutoGenDao/AliasDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, alias, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The alias DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Alias alias, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, alias, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Content", !this.IsDerived(alias, "Content") ? alias.Content.Escape() : string.Empty }, + { "IsSynonym", !this.IsDerived(alias, "IsSynonym") ? alias.IsSynonym.ToString() : string.Empty }, + { "LanguageCode", !this.IsDerived(alias, "LanguageCode") ? alias.LanguageCode.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Alias\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = alias.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -321,5 +374,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/AndExpressionDao.cs b/CDP4Orm/AutoGenDao/AndExpressionDao.cs index 79279482..5ee177b3 100644 --- a/CDP4Orm/AutoGenDao/AndExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/AndExpressionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -213,6 +209,53 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, andExpression, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The andExpression DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.AndExpression andExpression, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, andExpression, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"AndExpression\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = andExpression.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + andExpression.Term.ForEach(x => this.UpsertTerm(transaction, partition, andExpression.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -293,6 +336,49 @@ public bool AddTerm(NpgsqlTransaction transaction, string partition, Guid iid, G } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertTerm(NpgsqlTransaction transaction, string partition, Guid iid, Guid term) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"AndExpression_Term\"", partition); + sqlBuilder.AppendFormat(" (\"AndExpression\", \"Term\")"); + sqlBuilder.Append(" VALUES (:andExpression, :term)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"AndExpression_Term_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"AndExpression\", \"Term\")"); + sqlBuilder.Append(" = (:andExpression, :term);"); + + command.Parameters.Add("andExpression", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("term", NpgsqlDbType.Uuid).Value = term; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,6 +437,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ApprovalDao.cs b/CDP4Orm/AutoGenDao/ApprovalDao.cs index fdbde4e3..14a9138e 100644 --- a/CDP4Orm/AutoGenDao/ApprovalDao.cs +++ b/CDP4Orm/AutoGenDao/ApprovalDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -246,6 +242,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, approval, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The approval DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Approval approval, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, approval, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Classification", !this.IsDerived(approval, "Classification") ? approval.Classification.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Approval\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Author\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :author, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = approval.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(approval, "Author") ? approval.Author : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(approval, "Owner") ? approval.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Author\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :author, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -329,5 +382,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ArrayParameterTypeDao.cs b/CDP4Orm/AutoGenDao/ArrayParameterTypeDao.cs index 4db98be3..889eede4 100644 --- a/CDP4Orm/AutoGenDao/ArrayParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/ArrayParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -261,6 +257,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, arrayParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The arrayParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ArrayParameterType arrayParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, arrayParameterType, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsTensor", !this.IsDerived(arrayParameterType, "IsTensor") ? arrayParameterType.IsTensor.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ArrayParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = arrayParameterType.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + arrayParameterType.Dimension.ForEach(x => this.UpsertDimension(transaction, partition, arrayParameterType.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -342,6 +394,50 @@ public bool AddDimension(NpgsqlTransaction transaction, string partition, Guid i } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertDimension(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem dimension) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ArrayParameterType_Dimension\"", partition); + sqlBuilder.AppendFormat(" (\"ArrayParameterType\", \"Dimension\", \"Sequence\")"); + sqlBuilder.Append(" VALUES (:arrayParameterType, :dimension, :sequence)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ArrayParameterType_Dimension_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ArrayParameterType\", \"Dimension\", \"Sequence\")"); + sqlBuilder.Append(" = (:arrayParameterType, :dimension, :sequence);"); + + command.Parameters.Add("arrayParameterType", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("dimension", NpgsqlDbType.Integer).Value = Convert.ToInt32(dimension.V.ToString()); + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = dimension.K; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -508,6 +604,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/BinaryNoteDao.cs b/CDP4Orm/AutoGenDao/BinaryNoteDao.cs index 27f3ef17..e88c7f3e 100644 --- a/CDP4Orm/AutoGenDao/BinaryNoteDao.cs +++ b/CDP4Orm/AutoGenDao/BinaryNoteDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -245,6 +241,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, binaryNote, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The binaryNote DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryNote binaryNote, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, binaryNote, sequence, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Caption", !this.IsDerived(binaryNote, "Caption") ? binaryNote.Caption.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"BinaryNote\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"FileType\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :fileType)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = binaryNote.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("fileType", NpgsqlDbType.Uuid).Value = !this.IsDerived(binaryNote, "FileType") ? binaryNote.FileType : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"FileType\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :fileType);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -326,5 +377,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/BinaryRelationshipDao.cs b/CDP4Orm/AutoGenDao/BinaryRelationshipDao.cs index 50b114bc..8f832250 100644 --- a/CDP4Orm/AutoGenDao/BinaryRelationshipDao.cs +++ b/CDP4Orm/AutoGenDao/BinaryRelationshipDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -224,6 +220,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, binaryRelationship, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The binaryRelationship DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryRelationship binaryRelationship, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, binaryRelationship, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"BinaryRelationship\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Source\", \"Target\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :source, :target)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = binaryRelationship.Iid; + command.Parameters.Add("source", NpgsqlDbType.Uuid).Value = !this.IsDerived(binaryRelationship, "Source") ? binaryRelationship.Source : Utils.NullableValue(null); + command.Parameters.Add("target", NpgsqlDbType.Uuid).Value = !this.IsDerived(binaryRelationship, "Target") ? binaryRelationship.Target : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Source\", \"Target\")"); + sqlBuilder.Append(" = (:source, :target);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -300,5 +346,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/BinaryRelationshipRuleDao.cs b/CDP4Orm/AutoGenDao/BinaryRelationshipRuleDao.cs index b047cc72..aed7b5d9 100644 --- a/CDP4Orm/AutoGenDao/BinaryRelationshipRuleDao.cs +++ b/CDP4Orm/AutoGenDao/BinaryRelationshipRuleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -257,6 +253,64 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, binaryRelationshipRule, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The binaryRelationshipRule DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryRelationshipRule binaryRelationshipRule, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, binaryRelationshipRule, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ForwardRelationshipName", !this.IsDerived(binaryRelationshipRule, "ForwardRelationshipName") ? binaryRelationshipRule.ForwardRelationshipName.Escape() : string.Empty }, + { "InverseRelationshipName", !this.IsDerived(binaryRelationshipRule, "InverseRelationshipName") ? binaryRelationshipRule.InverseRelationshipName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"BinaryRelationshipRule\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"RelationshipCategory\", \"SourceCategory\", \"TargetCategory\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :relationshipCategory, :sourceCategory, :targetCategory)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = binaryRelationshipRule.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("relationshipCategory", NpgsqlDbType.Uuid).Value = !this.IsDerived(binaryRelationshipRule, "RelationshipCategory") ? binaryRelationshipRule.RelationshipCategory : Utils.NullableValue(null); + command.Parameters.Add("sourceCategory", NpgsqlDbType.Uuid).Value = !this.IsDerived(binaryRelationshipRule, "SourceCategory") ? binaryRelationshipRule.SourceCategory : Utils.NullableValue(null); + command.Parameters.Add("targetCategory", NpgsqlDbType.Uuid).Value = !this.IsDerived(binaryRelationshipRule, "TargetCategory") ? binaryRelationshipRule.TargetCategory : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"RelationshipCategory\", \"SourceCategory\", \"TargetCategory\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :relationshipCategory, :sourceCategory, :targetCategory);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -341,5 +395,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/BookDao.cs b/CDP4Orm/AutoGenDao/BookDao.cs index 980e7bfd..33dddd3f 100644 --- a/CDP4Orm/AutoGenDao/BookDao.cs +++ b/CDP4Orm/AutoGenDao/BookDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -247,6 +243,69 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, book, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The book DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Book book, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, book, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(book, "CreatedOn") ? book.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(book, "Name") ? book.Name.Escape() : string.Empty }, + { "ShortName", !this.IsDerived(book, "ShortName") ? book.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Book\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = book.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(book, "Owner") ? book.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + book.Category.ForEach(x => this.UpsertCategory(transaction, partition, book.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -327,6 +386,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Book_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Book\", \"Category\")"); + sqlBuilder.Append(" VALUES (:book, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Book_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Book\", \"Category\")"); + sqlBuilder.Append(" = (:book, :category);"); + + command.Parameters.Add("book", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -451,6 +553,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/BooleanExpressionDao.cs b/CDP4Orm/AutoGenDao/BooleanExpressionDao.cs index 566ffd55..fa02e021 100644 --- a/CDP4Orm/AutoGenDao/BooleanExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/BooleanExpressionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -93,6 +89,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, booleanExpression, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The booleanExpression DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BooleanExpression booleanExpression, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, booleanExpression, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"BooleanExpression\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = booleanExpression.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -168,5 +213,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/BooleanParameterTypeDao.cs b/CDP4Orm/AutoGenDao/BooleanParameterTypeDao.cs index f3a736b6..63e28549 100644 --- a/CDP4Orm/AutoGenDao/BooleanParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/BooleanParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, booleanParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The booleanParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BooleanParameterType booleanParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, booleanParameterType, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"BooleanParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = booleanParameterType.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -296,5 +338,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/BoundsDao.cs b/CDP4Orm/AutoGenDao/BoundsDao.cs index ef4920c8..16e9fba6 100644 --- a/CDP4Orm/AutoGenDao/BoundsDao.cs +++ b/CDP4Orm/AutoGenDao/BoundsDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -251,6 +247,64 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, bounds, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The bounds DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Bounds bounds, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, bounds, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Height", !this.IsDerived(bounds, "Height") ? bounds.Height.ToString() : string.Empty }, + { "Width", !this.IsDerived(bounds, "Width") ? bounds.Width.ToString() : string.Empty }, + { "X", !this.IsDerived(bounds, "X") ? bounds.X.ToString() : string.Empty }, + { "Y", !this.IsDerived(bounds, "Y") ? bounds.Y.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Bounds\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = bounds.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -335,5 +389,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/BuiltInRuleVerificationDao.cs b/CDP4Orm/AutoGenDao/BuiltInRuleVerificationDao.cs index 5061411a..01416726 100644 --- a/CDP4Orm/AutoGenDao/BuiltInRuleVerificationDao.cs +++ b/CDP4Orm/AutoGenDao/BuiltInRuleVerificationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -236,6 +232,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, builtInRuleVerification, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The builtInRuleVerification DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BuiltInRuleVerification builtInRuleVerification, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, builtInRuleVerification, sequence, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"BuiltInRuleVerification\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = builtInRuleVerification.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -293,5 +335,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/CategoryDao.cs b/CDP4Orm/AutoGenDao/CategoryDao.cs index 27457ba5..ac038b10 100644 --- a/CDP4Orm/AutoGenDao/CategoryDao.cs +++ b/CDP4Orm/AutoGenDao/CategoryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -251,6 +247,65 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, category, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The category DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Category category, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, category, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsAbstract", !this.IsDerived(category, "IsAbstract") ? category.IsAbstract.ToString() : string.Empty }, + { "IsDeprecated", !this.IsDerived(category, "IsDeprecated") ? category.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Category\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = category.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + category.PermissibleClass.ForEach(x => this.UpsertPermissibleClass(transaction, partition, category.Iid, x)); + category.SuperCategory.ForEach(x => this.UpsertSuperCategory(transaction, partition, category.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -337,6 +392,45 @@ public bool AddPermissibleClass(NpgsqlTransaction transaction, string partition, } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertPermissibleClass(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.CommonData.ClassKind permissibleClass) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Category_PermissibleClass\"", partition); + sqlBuilder.AppendFormat(" (\"Category\", \"PermissibleClass\")"); + sqlBuilder.Append(" VALUES (:category, :permissibleClass)"); + + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("permissibleClass", NpgsqlDbType.Text).Value = permissibleClass.ToString(); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Insert a new association record in the link table. /// @@ -375,6 +469,49 @@ public bool AddSuperCategory(NpgsqlTransaction transaction, string partition, Gu } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertSuperCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid superCategory) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Category_SuperCategory\"", partition); + sqlBuilder.AppendFormat(" (\"Category\", \"SuperCategory\")"); + sqlBuilder.Append(" VALUES (:category, :superCategory)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Category_SuperCategory_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Category\", \"SuperCategory\")"); + sqlBuilder.Append(" = (:category, :superCategory);"); + + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("superCategory", NpgsqlDbType.Uuid).Value = superCategory; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -476,6 +613,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Category\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ChangeProposalDao.cs b/CDP4Orm/AutoGenDao/ChangeProposalDao.cs index 15b04776..8fb7d51b 100644 --- a/CDP4Orm/AutoGenDao/ChangeProposalDao.cs +++ b/CDP4Orm/AutoGenDao/ChangeProposalDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -263,6 +259,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, changeProposal, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The changeProposal DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ChangeProposal changeProposal, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, changeProposal, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ChangeProposal\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ChangeRequest\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :changeRequest)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = changeProposal.Iid; + command.Parameters.Add("changeRequest", NpgsqlDbType.Uuid).Value = !this.IsDerived(changeProposal, "ChangeRequest") ? changeProposal.ChangeRequest : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ChangeRequest\""); + sqlBuilder.Append(" = :changeRequest;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -338,5 +383,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ChangeRequestDao.cs b/CDP4Orm/AutoGenDao/ChangeRequestDao.cs index eee2b5ce..c8836a2e 100644 --- a/CDP4Orm/AutoGenDao/ChangeRequestDao.cs +++ b/CDP4Orm/AutoGenDao/ChangeRequestDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -261,6 +257,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, changeRequest, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The changeRequest DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ChangeRequest changeRequest, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, changeRequest, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ChangeRequest\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = changeRequest.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -318,5 +360,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/CitationDao.cs b/CDP4Orm/AutoGenDao/CitationDao.cs index 751f814a..269572c2 100644 --- a/CDP4Orm/AutoGenDao/CitationDao.cs +++ b/CDP4Orm/AutoGenDao/CitationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -247,6 +243,65 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, citation, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The citation DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Citation citation, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, citation, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsAdaptation", !this.IsDerived(citation, "IsAdaptation") ? citation.IsAdaptation.ToString() : string.Empty }, + { "Location", !this.IsDerived(citation, "Location") ? citation.Location.Escape() : null }, + { "Remark", !this.IsDerived(citation, "Remark") ? citation.Remark.Escape() : null }, + { "ShortName", !this.IsDerived(citation, "ShortName") ? citation.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Citation\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Source\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :source)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = citation.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("source", NpgsqlDbType.Uuid).Value = !this.IsDerived(citation, "Source") ? citation.Source : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Source\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :source);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -332,5 +387,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ColorDao.cs b/CDP4Orm/AutoGenDao/ColorDao.cs index acfb2fa7..56665e86 100644 --- a/CDP4Orm/AutoGenDao/ColorDao.cs +++ b/CDP4Orm/AutoGenDao/ColorDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -244,6 +240,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, color, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The color DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Color color, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, color, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Blue", !this.IsDerived(color, "Blue") ? color.Blue.ToString() : string.Empty }, + { "Green", !this.IsDerived(color, "Green") ? color.Green.ToString() : string.Empty }, + { "Red", !this.IsDerived(color, "Red") ? color.Red.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Color\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = color.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -327,5 +380,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/CommonFileStoreDao.cs b/CDP4Orm/AutoGenDao/CommonFileStoreDao.cs index 93c5b7ee..60d92a77 100644 --- a/CDP4Orm/AutoGenDao/CommonFileStoreDao.cs +++ b/CDP4Orm/AutoGenDao/CommonFileStoreDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -227,6 +223,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, commonFileStore, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The commonFileStore DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CommonFileStore commonFileStore, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, commonFileStore, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"CommonFileStore\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = commonFileStore.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -302,5 +347,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/CompoundParameterTypeDao.cs b/CDP4Orm/AutoGenDao/CompoundParameterTypeDao.cs index bdb6d894..d282aea0 100644 --- a/CDP4Orm/AutoGenDao/CompoundParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/CompoundParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -253,6 +249,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, compoundParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The compoundParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CompoundParameterType compoundParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, compoundParameterType, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsFinalized", !this.IsDerived(compoundParameterType, "IsFinalized") ? compoundParameterType.IsFinalized.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"CompoundParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = compoundParameterType.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -333,5 +383,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ConstantDao.cs b/CDP4Orm/AutoGenDao/ConstantDao.cs index f6b0d35e..3b1702c9 100644 --- a/CDP4Orm/AutoGenDao/ConstantDao.cs +++ b/CDP4Orm/AutoGenDao/ConstantDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -252,6 +248,65 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, constant, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The constant DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Constant constant, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, constant, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(constant, "IsDeprecated") ? constant.IsDeprecated.ToString() : string.Empty }, + { "Value", !this.IsDerived(constant, "Value") ? constant.Value.ToHstoreString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Constant\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ParameterType\", \"Scale\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :parameterType, :scale)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = constant.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(constant, "ParameterType") ? constant.ParameterType : Utils.NullableValue(null); + command.Parameters.Add("scale", NpgsqlDbType.Uuid).Value = !this.IsDerived(constant, "Scale") ? Utils.NullableValue(constant.Scale) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ParameterType\", \"Scale\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :parameterType, :scale);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + constant.Category.ForEach(x => this.UpsertCategory(transaction, partition, constant.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -332,6 +387,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Constant_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Constant\", \"Category\")"); + sqlBuilder.Append(" VALUES (:constant, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Constant_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Constant\", \"Category\")"); + sqlBuilder.Append(" = (:constant, :category);"); + + command.Parameters.Add("constant", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -435,6 +533,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Constant\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ContractChangeNoticeDao.cs b/CDP4Orm/AutoGenDao/ContractChangeNoticeDao.cs index 7fe51c24..1db7ed30 100644 --- a/CDP4Orm/AutoGenDao/ContractChangeNoticeDao.cs +++ b/CDP4Orm/AutoGenDao/ContractChangeNoticeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -263,6 +259,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, contractChangeNotice, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The contractChangeNotice DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ContractChangeNotice contractChangeNotice, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, contractChangeNotice, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ContractChangeNotice\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ChangeProposal\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :changeProposal)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = contractChangeNotice.Iid; + command.Parameters.Add("changeProposal", NpgsqlDbType.Uuid).Value = !this.IsDerived(contractChangeNotice, "ChangeProposal") ? contractChangeNotice.ChangeProposal : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ChangeProposal\""); + sqlBuilder.Append(" = :changeProposal;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -338,5 +383,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ContractDeviationDao.cs b/CDP4Orm/AutoGenDao/ContractDeviationDao.cs index bf3f632e..0955f089 100644 --- a/CDP4Orm/AutoGenDao/ContractDeviationDao.cs +++ b/CDP4Orm/AutoGenDao/ContractDeviationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -92,6 +88,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, contractDeviation, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The contractDeviation DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ContractDeviation contractDeviation, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, contractDeviation, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ContractDeviation\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = contractDeviation.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -149,5 +191,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ConversionBasedUnitDao.cs b/CDP4Orm/AutoGenDao/ConversionBasedUnitDao.cs index b864caee..f25d6951 100644 --- a/CDP4Orm/AutoGenDao/ConversionBasedUnitDao.cs +++ b/CDP4Orm/AutoGenDao/ConversionBasedUnitDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -99,6 +95,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, conversionBasedUnit, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The conversionBasedUnit DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ConversionBasedUnit conversionBasedUnit, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, conversionBasedUnit, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ConversionFactor", !this.IsDerived(conversionBasedUnit, "ConversionFactor") ? conversionBasedUnit.ConversionFactor.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ConversionBasedUnit\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ReferenceUnit\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :referenceUnit)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = conversionBasedUnit.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("referenceUnit", NpgsqlDbType.Uuid).Value = !this.IsDerived(conversionBasedUnit, "ReferenceUnit") ? conversionBasedUnit.ReferenceUnit : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ReferenceUnit\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :referenceUnit);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -180,5 +231,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/CyclicRatioScaleDao.cs b/CDP4Orm/AutoGenDao/CyclicRatioScaleDao.cs index afeb8f0f..eb90ba69 100644 --- a/CDP4Orm/AutoGenDao/CyclicRatioScaleDao.cs +++ b/CDP4Orm/AutoGenDao/CyclicRatioScaleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -289,6 +285,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, cyclicRatioScale, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The cyclicRatioScale DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CyclicRatioScale cyclicRatioScale, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, cyclicRatioScale, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Modulus", !this.IsDerived(cyclicRatioScale, "Modulus") ? cyclicRatioScale.Modulus.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"CyclicRatioScale\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = cyclicRatioScale.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -369,5 +419,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DateParameterTypeDao.cs b/CDP4Orm/AutoGenDao/DateParameterTypeDao.cs index 7eb8f6c5..729d8682 100644 --- a/CDP4Orm/AutoGenDao/DateParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/DateParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, dateParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The dateParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DateParameterType dateParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, dateParameterType, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DateParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = dateParameterType.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -296,5 +338,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DateTimeParameterTypeDao.cs b/CDP4Orm/AutoGenDao/DateTimeParameterTypeDao.cs index 270793ab..02d84870 100644 --- a/CDP4Orm/AutoGenDao/DateTimeParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/DateTimeParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, dateTimeParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The dateTimeParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DateTimeParameterType dateTimeParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, dateTimeParameterType, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DateTimeParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = dateTimeParameterType.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -296,5 +338,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DecompositionRuleDao.cs b/CDP4Orm/AutoGenDao/DecompositionRuleDao.cs index 3d4dc08d..399944c3 100644 --- a/CDP4Orm/AutoGenDao/DecompositionRuleDao.cs +++ b/CDP4Orm/AutoGenDao/DecompositionRuleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -255,6 +251,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, decompositionRule, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The decompositionRule DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DecompositionRule decompositionRule, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, decompositionRule, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "MaxContained", !this.IsDerived(decompositionRule, "MaxContained") && decompositionRule.MaxContained.HasValue ? decompositionRule.MaxContained.Value.ToString() : null }, + { "MinContained", !this.IsDerived(decompositionRule, "MinContained") ? decompositionRule.MinContained.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DecompositionRule\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ContainingCategory\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :containingCategory)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = decompositionRule.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("containingCategory", NpgsqlDbType.Uuid).Value = !this.IsDerived(decompositionRule, "ContainingCategory") ? decompositionRule.ContainingCategory : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ContainingCategory\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :containingCategory);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + decompositionRule.ContainedCategory.ForEach(x => this.UpsertContainedCategory(transaction, partition, decompositionRule.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -335,6 +388,49 @@ public bool AddContainedCategory(NpgsqlTransaction transaction, string partition } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertContainedCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid containedCategory) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DecompositionRule_ContainedCategory\"", partition); + sqlBuilder.AppendFormat(" (\"DecompositionRule\", \"ContainedCategory\")"); + sqlBuilder.Append(" VALUES (:decompositionRule, :containedCategory)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"DecompositionRule_ContainedCategory_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"DecompositionRule\", \"ContainedCategory\")"); + sqlBuilder.Append(" = (:decompositionRule, :containedCategory);"); + + command.Parameters.Add("decompositionRule", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("containedCategory", NpgsqlDbType.Uuid).Value = containedCategory; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -418,6 +514,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/DefinedThingDao.cs b/CDP4Orm/AutoGenDao/DefinedThingDao.cs index effd335a..cac241e4 100644 --- a/CDP4Orm/AutoGenDao/DefinedThingDao.cs +++ b/CDP4Orm/AutoGenDao/DefinedThingDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -99,6 +95,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, definedThing, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The definedThing DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DefinedThing definedThing, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, definedThing, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Name", !this.IsDerived(definedThing, "Name") ? definedThing.Name.Escape() : string.Empty }, + { "ShortName", !this.IsDerived(definedThing, "ShortName") ? definedThing.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DefinedThing\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = definedThing.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -180,5 +231,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DefinitionDao.cs b/CDP4Orm/AutoGenDao/DefinitionDao.cs index 58eb8573..5510c973 100644 --- a/CDP4Orm/AutoGenDao/DefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/DefinitionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, definition, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The definition DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Definition definition, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, definition, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Content", !this.IsDerived(definition, "Content") ? definition.Content.Escape() : string.Empty }, + { "LanguageCode", !this.IsDerived(definition, "LanguageCode") ? definition.LanguageCode.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Definition\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = definition.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + definition.Example.ForEach(x => this.UpsertExample(transaction, partition, definition.Iid, x)); + + definition.Note.ForEach(x => this.UpsertNote(transaction, partition, definition.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -324,6 +380,50 @@ public bool AddExample(NpgsqlTransaction transaction, string partition, Guid iid return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertExample(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem example) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Definition_Example\"", partition); + sqlBuilder.AppendFormat(" (\"Definition\", \"Example\", \"Sequence\")"); + sqlBuilder.Append(" VALUES (:definition, :example, :sequence)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Definition_Example_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Definition\", \"Example\", \"Sequence\")"); + sqlBuilder.Append(" = (:definition, :example, :sequence);"); + + command.Parameters.Add("definition", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("example", NpgsqlDbType.Text).Value = (string)example.V; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = example.K; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -363,6 +463,50 @@ public bool AddNote(NpgsqlTransaction transaction, string partition, Guid iid, C } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertNote(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem note) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Definition_Note\"", partition); + sqlBuilder.AppendFormat(" (\"Definition\", \"Note\", \"Sequence\")"); + sqlBuilder.Append(" VALUES (:definition, :note, :sequence)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Definition_Note_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Definition\", \"Note\", \"Sequence\")"); + sqlBuilder.Append(" = (:definition, :note, :sequence);"); + + command.Parameters.Add("definition", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("note", NpgsqlDbType.Text).Value = (string)note.V; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = note.K; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -580,6 +724,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/DependentParameterTypeAssignmentDao.cs b/CDP4Orm/AutoGenDao/DependentParameterTypeAssignmentDao.cs index 841af206..105e73fb 100644 --- a/CDP4Orm/AutoGenDao/DependentParameterTypeAssignmentDao.cs +++ b/CDP4Orm/AutoGenDao/DependentParameterTypeAssignmentDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -220,6 +216,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, dependentParameterTypeAssignment, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The dependentParameterTypeAssignment DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DependentParameterTypeAssignment dependentParameterTypeAssignment, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, dependentParameterTypeAssignment, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DependentParameterTypeAssignment\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Sequence\", \"Container\", \"MeasurementScale\", \"ParameterType\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :sequence, :container, :measurementScale, :parameterType)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = dependentParameterTypeAssignment.Iid; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("measurementScale", NpgsqlDbType.Uuid).Value = !this.IsDerived(dependentParameterTypeAssignment, "MeasurementScale") ? Utils.NullableValue(dependentParameterTypeAssignment.MeasurementScale) : Utils.NullableValue(null); + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(dependentParameterTypeAssignment, "ParameterType") ? dependentParameterTypeAssignment.ParameterType : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"MeasurementScale\", \"ParameterType\")"); + sqlBuilder.Append(" = (:container, :measurementScale, :parameterType);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -336,5 +387,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DerivedQuantityKindDao.cs b/CDP4Orm/AutoGenDao/DerivedQuantityKindDao.cs index d67d7680..464746e0 100644 --- a/CDP4Orm/AutoGenDao/DerivedQuantityKindDao.cs +++ b/CDP4Orm/AutoGenDao/DerivedQuantityKindDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -248,6 +244,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, derivedQuantityKind, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The derivedQuantityKind DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DerivedQuantityKind derivedQuantityKind, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, derivedQuantityKind, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DerivedQuantityKind\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = derivedQuantityKind.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -305,5 +347,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DerivedUnitDao.cs b/CDP4Orm/AutoGenDao/DerivedUnitDao.cs index ceff34e6..f76decbf 100644 --- a/CDP4Orm/AutoGenDao/DerivedUnitDao.cs +++ b/CDP4Orm/AutoGenDao/DerivedUnitDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -233,6 +229,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, derivedUnit, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The derivedUnit DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DerivedUnit derivedUnit, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, derivedUnit, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DerivedUnit\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = derivedUnit.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -290,5 +332,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagramCanvasDao.cs b/CDP4Orm/AutoGenDao/DiagramCanvasDao.cs index 8d8074b8..000073a4 100644 --- a/CDP4Orm/AutoGenDao/DiagramCanvasDao.cs +++ b/CDP4Orm/AutoGenDao/DiagramCanvasDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -232,6 +228,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagramCanvas, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagramCanvas DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramCanvas diagramCanvas, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagramCanvas, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(diagramCanvas, "CreatedOn") ? diagramCanvas.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagramCanvas\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagramCanvas.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -313,5 +364,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagramEdgeDao.cs b/CDP4Orm/AutoGenDao/DiagramEdgeDao.cs index f26897a2..99f36fd3 100644 --- a/CDP4Orm/AutoGenDao/DiagramEdgeDao.cs +++ b/CDP4Orm/AutoGenDao/DiagramEdgeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -227,6 +223,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagramEdge, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagramEdge DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramEdge diagramEdge, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagramEdge, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagramEdge\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Source\", \"Target\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :source, :target)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagramEdge.Iid; + command.Parameters.Add("source", NpgsqlDbType.Uuid).Value = !this.IsDerived(diagramEdge, "Source") ? diagramEdge.Source : Utils.NullableValue(null); + command.Parameters.Add("target", NpgsqlDbType.Uuid).Value = !this.IsDerived(diagramEdge, "Target") ? diagramEdge.Target : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Source\", \"Target\")"); + sqlBuilder.Append(" = (:source, :target);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -303,5 +349,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagramElementContainerDao.cs b/CDP4Orm/AutoGenDao/DiagramElementContainerDao.cs index 1444e34d..67278f2f 100644 --- a/CDP4Orm/AutoGenDao/DiagramElementContainerDao.cs +++ b/CDP4Orm/AutoGenDao/DiagramElementContainerDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -92,6 +88,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagramElementContainer, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagramElementContainer DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramElementContainer diagramElementContainer, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagramElementContainer, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagramElementContainer\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagramElementContainer.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -149,5 +191,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagramElementThingDao.cs b/CDP4Orm/AutoGenDao/DiagramElementThingDao.cs index a4b5ba06..1ec6f314 100644 --- a/CDP4Orm/AutoGenDao/DiagramElementThingDao.cs +++ b/CDP4Orm/AutoGenDao/DiagramElementThingDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -95,6 +91,57 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagramElementThing, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagramElementThing DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramElementThing diagramElementThing, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagramElementThing, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagramElementThing\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"DepictedThing\", \"SharedStyle\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :depictedThing, :sharedStyle)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagramElementThing.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("depictedThing", NpgsqlDbType.Uuid).Value = !this.IsDerived(diagramElementThing, "DepictedThing") ? Utils.NullableValue(diagramElementThing.DepictedThing) : Utils.NullableValue(null); + command.Parameters.Add("sharedStyle", NpgsqlDbType.Uuid).Value = !this.IsDerived(diagramElementThing, "SharedStyle") ? Utils.NullableValue(diagramElementThing.SharedStyle) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"DepictedThing\", \"SharedStyle\")"); + sqlBuilder.Append(" = (:container, :depictedThing, :sharedStyle);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -172,5 +219,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagramObjectDao.cs b/CDP4Orm/AutoGenDao/DiagramObjectDao.cs index 923c6193..55904459 100644 --- a/CDP4Orm/AutoGenDao/DiagramObjectDao.cs +++ b/CDP4Orm/AutoGenDao/DiagramObjectDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -241,6 +237,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagramObject, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagramObject DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramObject diagramObject, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagramObject, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Documentation", !this.IsDerived(diagramObject, "Documentation") ? diagramObject.Documentation.Escape() : string.Empty }, + { "Resolution", !this.IsDerived(diagramObject, "Resolution") ? diagramObject.Resolution.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagramObject\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagramObject.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -322,5 +373,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagramShapeDao.cs b/CDP4Orm/AutoGenDao/DiagramShapeDao.cs index ef69c73c..eb16eadb 100644 --- a/CDP4Orm/AutoGenDao/DiagramShapeDao.cs +++ b/CDP4Orm/AutoGenDao/DiagramShapeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -92,6 +88,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagramShape, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagramShape DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramShape diagramShape, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagramShape, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagramShape\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagramShape.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -149,5 +191,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagramThingBaseDao.cs b/CDP4Orm/AutoGenDao/DiagramThingBaseDao.cs index 393d2e5a..a6777d8f 100644 --- a/CDP4Orm/AutoGenDao/DiagramThingBaseDao.cs +++ b/CDP4Orm/AutoGenDao/DiagramThingBaseDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -98,6 +94,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagramThingBase, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagramThingBase DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramThingBase diagramThingBase, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagramThingBase, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Name", !this.IsDerived(diagramThingBase, "Name") ? diagramThingBase.Name.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagramThingBase\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagramThingBase.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -178,5 +228,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiagrammingStyleDao.cs b/CDP4Orm/AutoGenDao/DiagrammingStyleDao.cs index e0e312c0..7b7e6f3b 100644 --- a/CDP4Orm/AutoGenDao/DiagrammingStyleDao.cs +++ b/CDP4Orm/AutoGenDao/DiagrammingStyleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -109,6 +105,71 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, diagrammingStyle, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The diagrammingStyle DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagrammingStyle diagrammingStyle, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, diagrammingStyle, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "FillOpacity", !this.IsDerived(diagrammingStyle, "FillOpacity") && diagrammingStyle.FillOpacity.HasValue ? diagrammingStyle.FillOpacity.Value.ToString() : null }, + { "FontBold", !this.IsDerived(diagrammingStyle, "FontBold") && diagrammingStyle.FontBold.HasValue ? diagrammingStyle.FontBold.Value.ToString() : null }, + { "FontItalic", !this.IsDerived(diagrammingStyle, "FontItalic") && diagrammingStyle.FontItalic.HasValue ? diagrammingStyle.FontItalic.Value.ToString() : null }, + { "FontName", !this.IsDerived(diagrammingStyle, "FontName") ? diagrammingStyle.FontName.Escape() : null }, + { "FontSize", !this.IsDerived(diagrammingStyle, "FontSize") && diagrammingStyle.FontSize.HasValue ? diagrammingStyle.FontSize.Value.ToString() : null }, + { "FontStrokeThrough", !this.IsDerived(diagrammingStyle, "FontStrokeThrough") && diagrammingStyle.FontStrokeThrough.HasValue ? diagrammingStyle.FontStrokeThrough.Value.ToString() : null }, + { "FontUnderline", !this.IsDerived(diagrammingStyle, "FontUnderline") && diagrammingStyle.FontUnderline.HasValue ? diagrammingStyle.FontUnderline.Value.ToString() : null }, + { "StrokeOpacity", !this.IsDerived(diagrammingStyle, "StrokeOpacity") && diagrammingStyle.StrokeOpacity.HasValue ? diagrammingStyle.StrokeOpacity.Value.ToString() : null }, + { "StrokeWidth", !this.IsDerived(diagrammingStyle, "StrokeWidth") && diagrammingStyle.StrokeWidth.HasValue ? diagrammingStyle.StrokeWidth.Value.ToString() : null }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiagrammingStyle\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"FillColor\", \"FontColor\", \"StrokeColor\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :fillColor, :fontColor, :strokeColor)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = diagrammingStyle.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("fillColor", NpgsqlDbType.Uuid).Value = !this.IsDerived(diagrammingStyle, "FillColor") ? Utils.NullableValue(diagrammingStyle.FillColor) : Utils.NullableValue(null); + command.Parameters.Add("fontColor", NpgsqlDbType.Uuid).Value = !this.IsDerived(diagrammingStyle, "FontColor") ? Utils.NullableValue(diagrammingStyle.FontColor) : Utils.NullableValue(null); + command.Parameters.Add("strokeColor", NpgsqlDbType.Uuid).Value = !this.IsDerived(diagrammingStyle, "StrokeColor") ? Utils.NullableValue(diagrammingStyle.StrokeColor) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"FillColor\", \"FontColor\", \"StrokeColor\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :fillColor, :fontColor, :strokeColor);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -200,5 +261,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DiscussionItemDao.cs b/CDP4Orm/AutoGenDao/DiscussionItemDao.cs index 9fc698e2..ce7922c4 100644 --- a/CDP4Orm/AutoGenDao/DiscussionItemDao.cs +++ b/CDP4Orm/AutoGenDao/DiscussionItemDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -93,6 +89,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, discussionItem, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The discussionItem DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiscussionItem discussionItem, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, discussionItem, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DiscussionItem\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ReplyTo\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :replyTo)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = discussionItem.Iid; + command.Parameters.Add("replyTo", NpgsqlDbType.Uuid).Value = !this.IsDerived(discussionItem, "ReplyTo") ? Utils.NullableValue(discussionItem.ReplyTo) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ReplyTo\""); + sqlBuilder.Append(" = :replyTo;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -168,5 +213,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DomainFileStoreDao.cs b/CDP4Orm/AutoGenDao/DomainFileStoreDao.cs index 09fd6851..feb900e3 100644 --- a/CDP4Orm/AutoGenDao/DomainFileStoreDao.cs +++ b/CDP4Orm/AutoGenDao/DomainFileStoreDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, domainFileStore, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The domainFileStore DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainFileStore domainFileStore, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, domainFileStore, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsHidden", !this.IsDerived(domainFileStore, "IsHidden") ? domainFileStore.IsHidden.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DomainFileStore\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = domainFileStore.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -320,5 +371,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/DomainOfExpertiseDao.cs b/CDP4Orm/AutoGenDao/DomainOfExpertiseDao.cs index aaf7be33..32b3c7a0 100644 --- a/CDP4Orm/AutoGenDao/DomainOfExpertiseDao.cs +++ b/CDP4Orm/AutoGenDao/DomainOfExpertiseDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -241,6 +237,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, domainOfExpertise, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The domainOfExpertise DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainOfExpertise domainOfExpertise, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, domainOfExpertise, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(domainOfExpertise, "IsDeprecated") ? domainOfExpertise.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DomainOfExpertise\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = domainOfExpertise.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + domainOfExpertise.Category.ForEach(x => this.UpsertCategory(transaction, partition, domainOfExpertise.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -321,6 +373,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DomainOfExpertise_Category\"", partition); + sqlBuilder.AppendFormat(" (\"DomainOfExpertise\", \"Category\")"); + sqlBuilder.Append(" VALUES (:domainOfExpertise, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"DomainOfExpertise_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"DomainOfExpertise\", \"Category\")"); + sqlBuilder.Append(" = (:domainOfExpertise, :category);"); + + command.Parameters.Add("domainOfExpertise", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -421,6 +516,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"DomainOfExpertise\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/DomainOfExpertiseGroupDao.cs b/CDP4Orm/AutoGenDao/DomainOfExpertiseGroupDao.cs index 94337de4..2717be9a 100644 --- a/CDP4Orm/AutoGenDao/DomainOfExpertiseGroupDao.cs +++ b/CDP4Orm/AutoGenDao/DomainOfExpertiseGroupDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -241,6 +237,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, domainOfExpertiseGroup, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The domainOfExpertiseGroup DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainOfExpertiseGroup domainOfExpertiseGroup, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, domainOfExpertiseGroup, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(domainOfExpertiseGroup, "IsDeprecated") ? domainOfExpertiseGroup.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DomainOfExpertiseGroup\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = domainOfExpertiseGroup.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + domainOfExpertiseGroup.Domain.ForEach(x => this.UpsertDomain(transaction, partition, domainOfExpertiseGroup.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -321,6 +373,49 @@ public bool AddDomain(NpgsqlTransaction transaction, string partition, Guid iid, } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertDomain(NpgsqlTransaction transaction, string partition, Guid iid, Guid domain) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"DomainOfExpertiseGroup_Domain\"", partition); + sqlBuilder.AppendFormat(" (\"DomainOfExpertiseGroup\", \"Domain\")"); + sqlBuilder.Append(" VALUES (:domainOfExpertiseGroup, :domain)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"DomainOfExpertiseGroup_Domain_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"DomainOfExpertiseGroup\", \"Domain\")"); + sqlBuilder.Append(" = (:domainOfExpertiseGroup, :domain);"); + + command.Parameters.Add("domainOfExpertiseGroup", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("domain", NpgsqlDbType.Uuid).Value = domain; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -421,6 +516,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"DomainOfExpertiseGroup\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ElementBaseDao.cs b/CDP4Orm/AutoGenDao/ElementBaseDao.cs index 4bfc5845..882cc53b 100644 --- a/CDP4Orm/AutoGenDao/ElementBaseDao.cs +++ b/CDP4Orm/AutoGenDao/ElementBaseDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -94,6 +90,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, elementBase, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The elementBase DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ElementBase elementBase, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, elementBase, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ElementBase\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = elementBase.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(elementBase, "Owner") ? elementBase.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Owner\""); + sqlBuilder.Append(" = :owner;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + elementBase.Category.ForEach(x => this.UpsertCategory(transaction, partition, elementBase.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -174,6 +220,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ElementBase_Category\"", partition); + sqlBuilder.AppendFormat(" (\"ElementBase\", \"Category\")"); + sqlBuilder.Append(" VALUES (:elementBase, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ElementBase_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ElementBase\", \"Category\")"); + sqlBuilder.Append(" = (:elementBase, :category);"); + + command.Parameters.Add("elementBase", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -250,6 +339,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ElementDefinitionDao.cs b/CDP4Orm/AutoGenDao/ElementDefinitionDao.cs index 4133826f..be439fb4 100644 --- a/CDP4Orm/AutoGenDao/ElementDefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/ElementDefinitionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -236,6 +232,57 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, elementDefinition, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The elementDefinition DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ElementDefinition elementDefinition, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, elementDefinition, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ElementDefinition\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = elementDefinition.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + elementDefinition.OrganizationalParticipant.ForEach(x => this.UpsertOrganizationalParticipant(transaction, partition, elementDefinition.Iid, x)); + elementDefinition.ReferencedElement.ForEach(x => this.UpsertReferencedElement(transaction, partition, elementDefinition.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -321,6 +368,49 @@ public bool AddOrganizationalParticipant(NpgsqlTransaction transaction, string p return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertOrganizationalParticipant(NpgsqlTransaction transaction, string partition, Guid iid, Guid organizationalParticipant) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ElementDefinition_OrganizationalParticipant\"", partition); + sqlBuilder.AppendFormat(" (\"ElementDefinition\", \"OrganizationalParticipant\")"); + sqlBuilder.Append(" VALUES (:elementDefinition, :organizationalParticipant)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ElementDefinition_OrganizationalParticipant_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ElementDefinition\", \"OrganizationalParticipant\")"); + sqlBuilder.Append(" = (:elementDefinition, :organizationalParticipant);"); + + command.Parameters.Add("elementDefinition", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("organizationalParticipant", NpgsqlDbType.Uuid).Value = organizationalParticipant; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -359,6 +449,49 @@ public bool AddReferencedElement(NpgsqlTransaction transaction, string partition } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertReferencedElement(NpgsqlTransaction transaction, string partition, Guid iid, Guid referencedElement) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ElementDefinition_ReferencedElement\"", partition); + sqlBuilder.AppendFormat(" (\"ElementDefinition\", \"ReferencedElement\")"); + sqlBuilder.Append(" VALUES (:elementDefinition, :referencedElement)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ElementDefinition_ReferencedElement_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ElementDefinition\", \"ReferencedElement\")"); + sqlBuilder.Append(" = (:elementDefinition, :referencedElement);"); + + command.Parameters.Add("elementDefinition", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("referencedElement", NpgsqlDbType.Uuid).Value = referencedElement; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -435,6 +568,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ElementUsageDao.cs b/CDP4Orm/AutoGenDao/ElementUsageDao.cs index 38ea86f4..6e14fcba 100644 --- a/CDP4Orm/AutoGenDao/ElementUsageDao.cs +++ b/CDP4Orm/AutoGenDao/ElementUsageDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -246,6 +242,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, elementUsage, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The elementUsage DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ElementUsage elementUsage, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, elementUsage, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "InterfaceEnd", !this.IsDerived(elementUsage, "InterfaceEnd") ? elementUsage.InterfaceEnd.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ElementUsage\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ElementDefinition\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :elementDefinition)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = elementUsage.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("elementDefinition", NpgsqlDbType.Uuid).Value = !this.IsDerived(elementUsage, "ElementDefinition") ? elementUsage.ElementDefinition : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ElementDefinition\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :elementDefinition);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + elementUsage.ExcludeOption.ForEach(x => this.UpsertExcludeOption(transaction, partition, elementUsage.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -326,6 +379,49 @@ public bool AddExcludeOption(NpgsqlTransaction transaction, string partition, Gu } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertExcludeOption(NpgsqlTransaction transaction, string partition, Guid iid, Guid excludeOption) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ElementUsage_ExcludeOption\"", partition); + sqlBuilder.AppendFormat(" (\"ElementUsage\", \"ExcludeOption\")"); + sqlBuilder.Append(" VALUES (:elementUsage, :excludeOption)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ElementUsage_ExcludeOption_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ElementUsage\", \"ExcludeOption\")"); + sqlBuilder.Append(" = (:elementUsage, :excludeOption);"); + + command.Parameters.Add("elementUsage", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("excludeOption", NpgsqlDbType.Uuid).Value = excludeOption; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -409,6 +505,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/EmailAddressDao.cs b/CDP4Orm/AutoGenDao/EmailAddressDao.cs index 1322c3c9..0adb5ae5 100644 --- a/CDP4Orm/AutoGenDao/EmailAddressDao.cs +++ b/CDP4Orm/AutoGenDao/EmailAddressDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -231,6 +227,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, emailAddress, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The emailAddress DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EmailAddress emailAddress, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, emailAddress, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Value", !this.IsDerived(emailAddress, "Value") ? emailAddress.Value.Escape() : string.Empty }, + { "VcardType", !this.IsDerived(emailAddress, "VcardType") ? emailAddress.VcardType.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EmailAddress\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = emailAddress.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -313,5 +365,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/EngineeringModelDao.cs b/CDP4Orm/AutoGenDao/EngineeringModelDao.cs index 0d0439e8..0e24629d 100644 --- a/CDP4Orm/AutoGenDao/EngineeringModelDao.cs +++ b/CDP4Orm/AutoGenDao/EngineeringModelDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -225,6 +221,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, engineeringModel, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The engineeringModel DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModel engineeringModel, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, engineeringModel, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EngineeringModel\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"EngineeringModelSetup\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :engineeringModelSetup)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = engineeringModel.Iid; + command.Parameters.Add("engineeringModelSetup", NpgsqlDbType.Uuid).Value = !this.IsDerived(engineeringModel, "EngineeringModelSetup") ? engineeringModel.EngineeringModelSetup : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"EngineeringModelSetup\""); + sqlBuilder.Append(" = :engineeringModelSetup;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -301,6 +346,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Copy the tables from a source to a target Engineering-Model partition /// diff --git a/CDP4Orm/AutoGenDao/EngineeringModelDataAnnotationDao.cs b/CDP4Orm/AutoGenDao/EngineeringModelDataAnnotationDao.cs index f466bbbd..6026d4f9 100644 --- a/CDP4Orm/AutoGenDao/EngineeringModelDataAnnotationDao.cs +++ b/CDP4Orm/AutoGenDao/EngineeringModelDataAnnotationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -94,6 +90,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, engineeringModelDataAnnotation, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The engineeringModelDataAnnotation DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelDataAnnotation engineeringModelDataAnnotation, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, engineeringModelDataAnnotation, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EngineeringModelDataAnnotation\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Author\", \"PrimaryAnnotatedThing\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :author, :primaryAnnotatedThing)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = engineeringModelDataAnnotation.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(engineeringModelDataAnnotation, "Author") ? engineeringModelDataAnnotation.Author : Utils.NullableValue(null); + command.Parameters.Add("primaryAnnotatedThing", NpgsqlDbType.Uuid).Value = !this.IsDerived(engineeringModelDataAnnotation, "PrimaryAnnotatedThing") ? Utils.NullableValue(engineeringModelDataAnnotation.PrimaryAnnotatedThing) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Author\", \"PrimaryAnnotatedThing\")"); + sqlBuilder.Append(" = (:author, :primaryAnnotatedThing);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -170,5 +216,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/EngineeringModelDataDiscussionItemDao.cs b/CDP4Orm/AutoGenDao/EngineeringModelDataDiscussionItemDao.cs index d7049c20..1833ad88 100644 --- a/CDP4Orm/AutoGenDao/EngineeringModelDataDiscussionItemDao.cs +++ b/CDP4Orm/AutoGenDao/EngineeringModelDataDiscussionItemDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -233,6 +229,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, engineeringModelDataDiscussionItem, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The engineeringModelDataDiscussionItem DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelDataDiscussionItem engineeringModelDataDiscussionItem, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, engineeringModelDataDiscussionItem, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EngineeringModelDataDiscussionItem\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Author\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :author)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = engineeringModelDataDiscussionItem.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(engineeringModelDataDiscussionItem, "Author") ? engineeringModelDataDiscussionItem.Author : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Author\")"); + sqlBuilder.Append(" = (:container, :author);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -309,5 +355,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/EngineeringModelDataNoteDao.cs b/CDP4Orm/AutoGenDao/EngineeringModelDataNoteDao.cs index a6c01eb9..613dbe9a 100644 --- a/CDP4Orm/AutoGenDao/EngineeringModelDataNoteDao.cs +++ b/CDP4Orm/AutoGenDao/EngineeringModelDataNoteDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -234,6 +230,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, engineeringModelDataNote, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The engineeringModelDataNote DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelDataNote engineeringModelDataNote, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, engineeringModelDataNote, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EngineeringModelDataNote\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = engineeringModelDataNote.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -309,5 +354,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/EngineeringModelSetupDao.cs b/CDP4Orm/AutoGenDao/EngineeringModelSetupDao.cs index 1b9a3f2b..12b1d4d7 100644 --- a/CDP4Orm/AutoGenDao/EngineeringModelSetupDao.cs +++ b/CDP4Orm/AutoGenDao/EngineeringModelSetupDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -268,6 +264,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, engineeringModelSetup, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The engineeringModelSetup DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelSetup engineeringModelSetup, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, engineeringModelSetup, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "EngineeringModelIid", !this.IsDerived(engineeringModelSetup, "EngineeringModelIid") ? engineeringModelSetup.EngineeringModelIid.ToString() : string.Empty }, + { "Kind", !this.IsDerived(engineeringModelSetup, "Kind") ? engineeringModelSetup.Kind.ToString() : string.Empty }, + { "SourceEngineeringModelSetupIid", !this.IsDerived(engineeringModelSetup, "SourceEngineeringModelSetupIid") && engineeringModelSetup.SourceEngineeringModelSetupIid.HasValue ? engineeringModelSetup.SourceEngineeringModelSetupIid.Value.ToString() : null }, + { "StudyPhase", !this.IsDerived(engineeringModelSetup, "StudyPhase") ? engineeringModelSetup.StudyPhase.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EngineeringModelSetup\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"DefaultOrganizationalParticipant\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :defaultOrganizationalParticipant)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = engineeringModelSetup.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("defaultOrganizationalParticipant", NpgsqlDbType.Uuid).Value = !this.IsDerived(engineeringModelSetup, "DefaultOrganizationalParticipant") ? Utils.NullableValue(engineeringModelSetup.DefaultOrganizationalParticipant) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"DefaultOrganizationalParticipant\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :defaultOrganizationalParticipant);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + engineeringModelSetup.ActiveDomain.ForEach(x => this.UpsertActiveDomain(transaction, partition, engineeringModelSetup.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -348,6 +404,49 @@ public bool AddActiveDomain(NpgsqlTransaction transaction, string partition, Gui } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertActiveDomain(NpgsqlTransaction transaction, string partition, Guid iid, Guid activeDomain) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EngineeringModelSetup_ActiveDomain\"", partition); + sqlBuilder.AppendFormat(" (\"EngineeringModelSetup\", \"ActiveDomain\")"); + sqlBuilder.Append(" VALUES (:engineeringModelSetup, :activeDomain)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"EngineeringModelSetup_ActiveDomain_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"EngineeringModelSetup\", \"ActiveDomain\")"); + sqlBuilder.Append(" = (:engineeringModelSetup, :activeDomain);"); + + command.Parameters.Add("engineeringModelSetup", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("activeDomain", NpgsqlDbType.Uuid).Value = activeDomain; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -434,6 +533,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/EnumerationParameterTypeDao.cs b/CDP4Orm/AutoGenDao/EnumerationParameterTypeDao.cs index c6185af4..faa48e29 100644 --- a/CDP4Orm/AutoGenDao/EnumerationParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/EnumerationParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -252,6 +248,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, enumerationParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The enumerationParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EnumerationParameterType enumerationParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, enumerationParameterType, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "AllowMultiSelect", !this.IsDerived(enumerationParameterType, "AllowMultiSelect") ? enumerationParameterType.AllowMultiSelect.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EnumerationParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = enumerationParameterType.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -332,5 +382,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/EnumerationValueDefinitionDao.cs b/CDP4Orm/AutoGenDao/EnumerationValueDefinitionDao.cs index 16fedb52..e06a3f56 100644 --- a/CDP4Orm/AutoGenDao/EnumerationValueDefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/EnumerationValueDefinitionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -231,6 +227,59 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, enumerationValueDefinition, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The enumerationValueDefinition DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EnumerationValueDefinition enumerationValueDefinition, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, enumerationValueDefinition, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"EnumerationValueDefinition\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Sequence\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :sequence, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = enumerationValueDefinition.Iid; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -345,5 +394,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ExclusiveOrExpressionDao.cs b/CDP4Orm/AutoGenDao/ExclusiveOrExpressionDao.cs index d15096b9..055d61f7 100644 --- a/CDP4Orm/AutoGenDao/ExclusiveOrExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/ExclusiveOrExpressionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -213,6 +209,53 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, exclusiveOrExpression, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The exclusiveOrExpression DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ExclusiveOrExpression exclusiveOrExpression, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, exclusiveOrExpression, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ExclusiveOrExpression\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = exclusiveOrExpression.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + exclusiveOrExpression.Term.ForEach(x => this.UpsertTerm(transaction, partition, exclusiveOrExpression.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -293,6 +336,49 @@ public bool AddTerm(NpgsqlTransaction transaction, string partition, Guid iid, G } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertTerm(NpgsqlTransaction transaction, string partition, Guid iid, Guid term) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ExclusiveOrExpression_Term\"", partition); + sqlBuilder.AppendFormat(" (\"ExclusiveOrExpression\", \"Term\")"); + sqlBuilder.Append(" VALUES (:exclusiveOrExpression, :term)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ExclusiveOrExpression_Term_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ExclusiveOrExpression\", \"Term\")"); + sqlBuilder.Append(" = (:exclusiveOrExpression, :term);"); + + command.Parameters.Add("exclusiveOrExpression", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("term", NpgsqlDbType.Uuid).Value = term; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,6 +437,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ExternalIdentifierMapDao.cs b/CDP4Orm/AutoGenDao/ExternalIdentifierMapDao.cs index 5b0e5e71..55612083 100644 --- a/CDP4Orm/AutoGenDao/ExternalIdentifierMapDao.cs +++ b/CDP4Orm/AutoGenDao/ExternalIdentifierMapDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -250,6 +246,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, externalIdentifierMap, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The externalIdentifierMap DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ExternalIdentifierMap externalIdentifierMap, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, externalIdentifierMap, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ExternalModelName", !this.IsDerived(externalIdentifierMap, "ExternalModelName") ? externalIdentifierMap.ExternalModelName.Escape() : string.Empty }, + { "ExternalToolName", !this.IsDerived(externalIdentifierMap, "ExternalToolName") ? externalIdentifierMap.ExternalToolName.Escape() : string.Empty }, + { "ExternalToolVersion", !this.IsDerived(externalIdentifierMap, "ExternalToolVersion") ? externalIdentifierMap.ExternalToolVersion.Escape() : null }, + { "Name", !this.IsDerived(externalIdentifierMap, "Name") ? externalIdentifierMap.Name.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ExternalIdentifierMap\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ExternalFormat\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :externalFormat, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = externalIdentifierMap.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("externalFormat", NpgsqlDbType.Uuid).Value = !this.IsDerived(externalIdentifierMap, "ExternalFormat") ? Utils.NullableValue(externalIdentifierMap.ExternalFormat) : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(externalIdentifierMap, "Owner") ? externalIdentifierMap.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ExternalFormat\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :externalFormat, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -336,5 +392,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/FileDao.cs b/CDP4Orm/AutoGenDao/FileDao.cs index fb95d67f..130b9d79 100644 --- a/CDP4Orm/AutoGenDao/FileDao.cs +++ b/CDP4Orm/AutoGenDao/FileDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -219,6 +215,58 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, file, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The file DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.File file, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, file, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"File\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"LockedBy\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :lockedBy, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = file.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("lockedBy", NpgsqlDbType.Uuid).Value = !this.IsDerived(file, "LockedBy") ? Utils.NullableValue(file.LockedBy) : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(file, "Owner") ? file.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"LockedBy\", \"Owner\")"); + sqlBuilder.Append(" = (:container, :lockedBy, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + file.Category.ForEach(x => this.UpsertCategory(transaction, partition, file.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -299,6 +347,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"File_Category\"", partition); + sqlBuilder.AppendFormat(" (\"File\", \"Category\")"); + sqlBuilder.Append(" VALUES (:file, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"File_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"File\", \"Category\")"); + sqlBuilder.Append(" = (:file, :category);"); + + command.Parameters.Add("file", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -377,6 +468,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/FileRevisionDao.cs b/CDP4Orm/AutoGenDao/FileRevisionDao.cs index eec9a413..ebf189f5 100644 --- a/CDP4Orm/AutoGenDao/FileRevisionDao.cs +++ b/CDP4Orm/AutoGenDao/FileRevisionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -244,6 +240,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, fileRevision, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The fileRevision DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.FileRevision fileRevision, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, fileRevision, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ContentHash", fileRevision.ContentHash.Escape() }, + { "CreatedOn", !this.IsDerived(fileRevision, "CreatedOn") ? fileRevision.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(fileRevision, "Name") ? fileRevision.Name.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"FileRevision\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ContainingFolder\", \"Creator\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :containingFolder, :creator)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = fileRevision.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("containingFolder", NpgsqlDbType.Uuid).Value = !this.IsDerived(fileRevision, "ContainingFolder") ? Utils.NullableValue(fileRevision.ContainingFolder) : Utils.NullableValue(null); + command.Parameters.Add("creator", NpgsqlDbType.Uuid).Value = !this.IsDerived(fileRevision, "Creator") ? fileRevision.Creator : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ContainingFolder\", \"Creator\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :containingFolder, :creator);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + fileRevision.FileType.ForEach(x => this.UpsertFileType(transaction, partition, fileRevision.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -325,6 +381,50 @@ public bool AddFileType(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertFileType(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem fileType) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"FileRevision_FileType\"", partition); + sqlBuilder.AppendFormat(" (\"FileRevision\", \"FileType\", \"Sequence\")"); + sqlBuilder.Append(" VALUES (:fileRevision, :fileType, :sequence)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"FileRevision_FileType_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.AppendFormat(" SET (\"FileRevision\", \"FileType\", \"Sequence\")"); + sqlBuilder.Append(" = (:fileRevision, :fileType, :sequence);"); + + command.Parameters.Add("fileRevision", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("fileType", NpgsqlDbType.Uuid).Value = Guid.Parse(fileType.V.ToString()); + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = fileType.K; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -496,6 +596,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/FileStoreDao.cs b/CDP4Orm/AutoGenDao/FileStoreDao.cs index 4634378d..663ee4ff 100644 --- a/CDP4Orm/AutoGenDao/FileStoreDao.cs +++ b/CDP4Orm/AutoGenDao/FileStoreDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -100,6 +96,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, fileStore, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The fileStore DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.FileStore fileStore, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, fileStore, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(fileStore, "CreatedOn") ? fileStore.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(fileStore, "Name") ? fileStore.Name.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"FileStore\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = fileStore.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(fileStore, "Owner") ? fileStore.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -182,5 +234,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/FileTypeDao.cs b/CDP4Orm/AutoGenDao/FileTypeDao.cs index 734ecfab..9df2514e 100644 --- a/CDP4Orm/AutoGenDao/FileTypeDao.cs +++ b/CDP4Orm/AutoGenDao/FileTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -248,6 +244,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, fileType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The fileType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.FileType fileType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, fileType, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Extension", !this.IsDerived(fileType, "Extension") ? fileType.Extension.Escape() : string.Empty }, + { "IsDeprecated", !this.IsDerived(fileType, "IsDeprecated") ? fileType.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"FileType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = fileType.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + fileType.Category.ForEach(x => this.UpsertCategory(transaction, partition, fileType.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -328,6 +381,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"FileType_Category\"", partition); + sqlBuilder.AppendFormat(" (\"FileType\", \"Category\")"); + sqlBuilder.Append(" VALUES (:fileType, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"FileType_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"FileType\", \"Category\")"); + sqlBuilder.Append(" = (:fileType, :category);"); + + command.Parameters.Add("fileType", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -429,6 +525,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"FileType\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/FolderDao.cs b/CDP4Orm/AutoGenDao/FolderDao.cs index a4a56909..3b3c1285 100644 --- a/CDP4Orm/AutoGenDao/FolderDao.cs +++ b/CDP4Orm/AutoGenDao/FolderDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -237,6 +233,65 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, folder, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The folder DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Folder folder, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, folder, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(folder, "CreatedOn") ? folder.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(folder, "Name") ? folder.Name.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Folder\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ContainingFolder\", \"Creator\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :containingFolder, :creator, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = folder.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("containingFolder", NpgsqlDbType.Uuid).Value = !this.IsDerived(folder, "ContainingFolder") ? Utils.NullableValue(folder.ContainingFolder) : Utils.NullableValue(null); + command.Parameters.Add("creator", NpgsqlDbType.Uuid).Value = !this.IsDerived(folder, "Creator") ? folder.Creator : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(folder, "Owner") ? folder.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ContainingFolder\", \"Creator\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :containingFolder, :creator, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -322,5 +377,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/GenericAnnotationDao.cs b/CDP4Orm/AutoGenDao/GenericAnnotationDao.cs index 69b87000..87b712fd 100644 --- a/CDP4Orm/AutoGenDao/GenericAnnotationDao.cs +++ b/CDP4Orm/AutoGenDao/GenericAnnotationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -100,6 +96,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, genericAnnotation, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The genericAnnotation DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.GenericAnnotation genericAnnotation, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, genericAnnotation, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Content", !this.IsDerived(genericAnnotation, "Content") ? genericAnnotation.Content.Escape() : string.Empty }, + { "CreatedOn", !this.IsDerived(genericAnnotation, "CreatedOn") ? genericAnnotation.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "LanguageCode", !this.IsDerived(genericAnnotation, "LanguageCode") ? genericAnnotation.LanguageCode.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"GenericAnnotation\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = genericAnnotation.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -182,5 +234,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/GlossaryDao.cs b/CDP4Orm/AutoGenDao/GlossaryDao.cs index 92ecc5c7..0a3a67c6 100644 --- a/CDP4Orm/AutoGenDao/GlossaryDao.cs +++ b/CDP4Orm/AutoGenDao/GlossaryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -242,6 +238,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, glossary, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The glossary DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Glossary glossary, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, glossary, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(glossary, "IsDeprecated") ? glossary.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Glossary\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = glossary.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + glossary.Category.ForEach(x => this.UpsertCategory(transaction, partition, glossary.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -322,6 +374,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Glossary_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Glossary\", \"Category\")"); + sqlBuilder.Append(" VALUES (:glossary, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Glossary_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Glossary\", \"Category\")"); + sqlBuilder.Append(" = (:glossary, :category);"); + + command.Parameters.Add("glossary", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -422,6 +517,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Glossary\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/GoalDao.cs b/CDP4Orm/AutoGenDao/GoalDao.cs index a500ff65..9fc1366a 100644 --- a/CDP4Orm/AutoGenDao/GoalDao.cs +++ b/CDP4Orm/AutoGenDao/GoalDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -229,6 +225,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, goal, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The goal DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Goal goal, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, goal, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Goal\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = goal.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + goal.Category.ForEach(x => this.UpsertCategory(transaction, partition, goal.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -309,6 +355,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Goal_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Goal\", \"Category\")"); + sqlBuilder.Append(" VALUES (:goal, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Goal_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Goal\", \"Category\")"); + sqlBuilder.Append(" = (:goal, :category);"); + + command.Parameters.Add("goal", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -385,6 +474,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/HyperLinkDao.cs b/CDP4Orm/AutoGenDao/HyperLinkDao.cs index 0f09b3e4..0d17a3b4 100644 --- a/CDP4Orm/AutoGenDao/HyperLinkDao.cs +++ b/CDP4Orm/AutoGenDao/HyperLinkDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, hyperLink, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The hyperLink DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.HyperLink hyperLink, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, hyperLink, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Content", !this.IsDerived(hyperLink, "Content") ? hyperLink.Content.Escape() : string.Empty }, + { "LanguageCode", !this.IsDerived(hyperLink, "LanguageCode") ? hyperLink.LanguageCode.Escape() : string.Empty }, + { "Uri", !this.IsDerived(hyperLink, "Uri") ? hyperLink.Uri.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"HyperLink\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = hyperLink.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -321,5 +374,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/IActionItemDao.cs b/CDP4Orm/AutoGenDao/IActionItemDao.cs index 4b54989b..ac5dbde4 100644 --- a/CDP4Orm/AutoGenDao/IActionItemDao.cs +++ b/CDP4Orm/AutoGenDao/IActionItemDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IActionItemDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IActionItemDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActionItem actionItem, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActionItem actionItem, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IActionItemDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IActualFiniteStateDao.cs b/CDP4Orm/AutoGenDao/IActualFiniteStateDao.cs index e43a6701..a1461d9c 100644 --- a/CDP4Orm/AutoGenDao/IActualFiniteStateDao.cs +++ b/CDP4Orm/AutoGenDao/IActualFiniteStateDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IActualFiniteStateDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IActualFiniteStateDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActualFiniteState actualFiniteState, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActualFiniteState actualFiniteState, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IActualFiniteStateDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IActualFiniteStateListDao.cs b/CDP4Orm/AutoGenDao/IActualFiniteStateListDao.cs index 9cacd662..760b9dae 100644 --- a/CDP4Orm/AutoGenDao/IActualFiniteStateListDao.cs +++ b/CDP4Orm/AutoGenDao/IActualFiniteStateListDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IActualFiniteStateListDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IActualFiniteStateListDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActualFiniteStateList actualFiniteStateList, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ActualFiniteStateList actualFiniteStateList, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IActualFiniteStateListDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IAliasDao.cs b/CDP4Orm/AutoGenDao/IAliasDao.cs index a896377b..2248eceb 100644 --- a/CDP4Orm/AutoGenDao/IAliasDao.cs +++ b/CDP4Orm/AutoGenDao/IAliasDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IAliasDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IAliasDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Alias alias, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Alias alias, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IAliasDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IAndExpressionDao.cs b/CDP4Orm/AutoGenDao/IAndExpressionDao.cs index 5262159b..24570a3e 100644 --- a/CDP4Orm/AutoGenDao/IAndExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/IAndExpressionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IAndExpressionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IAndExpressionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.AndExpression andExpression, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.AndExpression andExpression, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IAndExpressionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IApprovalDao.cs b/CDP4Orm/AutoGenDao/IApprovalDao.cs index f2fb2d9f..cee7c259 100644 --- a/CDP4Orm/AutoGenDao/IApprovalDao.cs +++ b/CDP4Orm/AutoGenDao/IApprovalDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IApprovalDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IApprovalDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Approval approval, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Approval approval, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IApprovalDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IArrayParameterTypeDao.cs b/CDP4Orm/AutoGenDao/IArrayParameterTypeDao.cs index 0652f536..32f09b04 100644 --- a/CDP4Orm/AutoGenDao/IArrayParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/IArrayParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IArrayParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IArrayParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ArrayParameterType arrayParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ArrayParameterType arrayParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IArrayParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IBinaryNoteDao.cs b/CDP4Orm/AutoGenDao/IBinaryNoteDao.cs index 76bb1d86..c2ff120f 100644 --- a/CDP4Orm/AutoGenDao/IBinaryNoteDao.cs +++ b/CDP4Orm/AutoGenDao/IBinaryNoteDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IBinaryNoteDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IBinaryNoteDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryNote binaryNote, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryNote binaryNote, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IBinaryNoteDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IBinaryRelationshipDao.cs b/CDP4Orm/AutoGenDao/IBinaryRelationshipDao.cs index ce86a535..0cd83bac 100644 --- a/CDP4Orm/AutoGenDao/IBinaryRelationshipDao.cs +++ b/CDP4Orm/AutoGenDao/IBinaryRelationshipDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IBinaryRelationshipDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IBinaryRelationshipDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryRelationship binaryRelationship, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryRelationship binaryRelationship, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IBinaryRelationshipDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IBinaryRelationshipRuleDao.cs b/CDP4Orm/AutoGenDao/IBinaryRelationshipRuleDao.cs index 81b39f66..31b57295 100644 --- a/CDP4Orm/AutoGenDao/IBinaryRelationshipRuleDao.cs +++ b/CDP4Orm/AutoGenDao/IBinaryRelationshipRuleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IBinaryRelationshipRuleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IBinaryRelationshipRuleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryRelationshipRule binaryRelationshipRule, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BinaryRelationshipRule binaryRelationshipRule, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IBinaryRelationshipRuleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IBookDao.cs b/CDP4Orm/AutoGenDao/IBookDao.cs index eb92909e..e51c3b86 100644 --- a/CDP4Orm/AutoGenDao/IBookDao.cs +++ b/CDP4Orm/AutoGenDao/IBookDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IBookDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IBookDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Book book, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Book book, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IBookDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IBooleanParameterTypeDao.cs b/CDP4Orm/AutoGenDao/IBooleanParameterTypeDao.cs index 28f3ddcc..3e8bc9fc 100644 --- a/CDP4Orm/AutoGenDao/IBooleanParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/IBooleanParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IBooleanParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IBooleanParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BooleanParameterType booleanParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BooleanParameterType booleanParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IBooleanParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IBoundsDao.cs b/CDP4Orm/AutoGenDao/IBoundsDao.cs index 39aeddaa..078a696b 100644 --- a/CDP4Orm/AutoGenDao/IBoundsDao.cs +++ b/CDP4Orm/AutoGenDao/IBoundsDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IBoundsDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IBoundsDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Bounds bounds, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Bounds bounds, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IBoundsDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IBuiltInRuleVerificationDao.cs b/CDP4Orm/AutoGenDao/IBuiltInRuleVerificationDao.cs index 65689398..81189c50 100644 --- a/CDP4Orm/AutoGenDao/IBuiltInRuleVerificationDao.cs +++ b/CDP4Orm/AutoGenDao/IBuiltInRuleVerificationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IBuiltInRuleVerificationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IBuiltInRuleVerificationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BuiltInRuleVerification builtInRuleVerification, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.BuiltInRuleVerification builtInRuleVerification, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IBuiltInRuleVerificationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ICategoryDao.cs b/CDP4Orm/AutoGenDao/ICategoryDao.cs index a5e82fc7..4a710452 100644 --- a/CDP4Orm/AutoGenDao/ICategoryDao.cs +++ b/CDP4Orm/AutoGenDao/ICategoryDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ICategoryDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ICategoryDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Category category, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Category category, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ICategoryDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IChangeProposalDao.cs b/CDP4Orm/AutoGenDao/IChangeProposalDao.cs index c9e653e4..385ab8c8 100644 --- a/CDP4Orm/AutoGenDao/IChangeProposalDao.cs +++ b/CDP4Orm/AutoGenDao/IChangeProposalDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IChangeProposalDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IChangeProposalDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ChangeProposal changeProposal, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ChangeProposal changeProposal, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IChangeProposalDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IChangeRequestDao.cs b/CDP4Orm/AutoGenDao/IChangeRequestDao.cs index 1efbbe54..5a602ad1 100644 --- a/CDP4Orm/AutoGenDao/IChangeRequestDao.cs +++ b/CDP4Orm/AutoGenDao/IChangeRequestDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IChangeRequestDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IChangeRequestDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ChangeRequest changeRequest, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ChangeRequest changeRequest, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IChangeRequestDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ICitationDao.cs b/CDP4Orm/AutoGenDao/ICitationDao.cs index 8ca8ad03..99589b9a 100644 --- a/CDP4Orm/AutoGenDao/ICitationDao.cs +++ b/CDP4Orm/AutoGenDao/ICitationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ICitationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ICitationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Citation citation, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Citation citation, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ICitationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IColorDao.cs b/CDP4Orm/AutoGenDao/IColorDao.cs index 3889f0ed..7ab13da9 100644 --- a/CDP4Orm/AutoGenDao/IColorDao.cs +++ b/CDP4Orm/AutoGenDao/IColorDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IColorDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IColorDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Color color, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Color color, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IColorDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ICommonFileStoreDao.cs b/CDP4Orm/AutoGenDao/ICommonFileStoreDao.cs index 55b650ee..d1ae63e7 100644 --- a/CDP4Orm/AutoGenDao/ICommonFileStoreDao.cs +++ b/CDP4Orm/AutoGenDao/ICommonFileStoreDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ICommonFileStoreDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ICommonFileStoreDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CommonFileStore commonFileStore, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CommonFileStore commonFileStore, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ICommonFileStoreDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ICompoundParameterTypeDao.cs b/CDP4Orm/AutoGenDao/ICompoundParameterTypeDao.cs index 7f99d782..30db92db 100644 --- a/CDP4Orm/AutoGenDao/ICompoundParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/ICompoundParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ICompoundParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ICompoundParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CompoundParameterType compoundParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CompoundParameterType compoundParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ICompoundParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IConstantDao.cs b/CDP4Orm/AutoGenDao/IConstantDao.cs index 93675a05..c35af64e 100644 --- a/CDP4Orm/AutoGenDao/IConstantDao.cs +++ b/CDP4Orm/AutoGenDao/IConstantDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IConstantDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IConstantDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Constant constant, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Constant constant, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IConstantDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IContractChangeNoticeDao.cs b/CDP4Orm/AutoGenDao/IContractChangeNoticeDao.cs index 857f311f..2c4966ec 100644 --- a/CDP4Orm/AutoGenDao/IContractChangeNoticeDao.cs +++ b/CDP4Orm/AutoGenDao/IContractChangeNoticeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IContractChangeNoticeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IContractChangeNoticeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ContractChangeNotice contractChangeNotice, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ContractChangeNotice contractChangeNotice, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IContractChangeNoticeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ICyclicRatioScaleDao.cs b/CDP4Orm/AutoGenDao/ICyclicRatioScaleDao.cs index dd3f7491..0ffdabd4 100644 --- a/CDP4Orm/AutoGenDao/ICyclicRatioScaleDao.cs +++ b/CDP4Orm/AutoGenDao/ICyclicRatioScaleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ICyclicRatioScaleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ICyclicRatioScaleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CyclicRatioScale cyclicRatioScale, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.CyclicRatioScale cyclicRatioScale, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ICyclicRatioScaleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDateParameterTypeDao.cs b/CDP4Orm/AutoGenDao/IDateParameterTypeDao.cs index 7adfe14d..1e70605e 100644 --- a/CDP4Orm/AutoGenDao/IDateParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/IDateParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDateParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDateParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DateParameterType dateParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DateParameterType dateParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDateParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDateTimeParameterTypeDao.cs b/CDP4Orm/AutoGenDao/IDateTimeParameterTypeDao.cs index e7f0edcc..c4724516 100644 --- a/CDP4Orm/AutoGenDao/IDateTimeParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/IDateTimeParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDateTimeParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDateTimeParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DateTimeParameterType dateTimeParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DateTimeParameterType dateTimeParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDateTimeParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDecompositionRuleDao.cs b/CDP4Orm/AutoGenDao/IDecompositionRuleDao.cs index 512ce1ca..e8294662 100644 --- a/CDP4Orm/AutoGenDao/IDecompositionRuleDao.cs +++ b/CDP4Orm/AutoGenDao/IDecompositionRuleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDecompositionRuleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDecompositionRuleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DecompositionRule decompositionRule, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DecompositionRule decompositionRule, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDecompositionRuleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDefinitionDao.cs b/CDP4Orm/AutoGenDao/IDefinitionDao.cs index 89c57968..42b603b7 100644 --- a/CDP4Orm/AutoGenDao/IDefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/IDefinitionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDefinitionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDefinitionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Definition definition, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Definition definition, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDefinitionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDependentParameterTypeAssignmentDao.cs b/CDP4Orm/AutoGenDao/IDependentParameterTypeAssignmentDao.cs index d196d986..cb37b307 100644 --- a/CDP4Orm/AutoGenDao/IDependentParameterTypeAssignmentDao.cs +++ b/CDP4Orm/AutoGenDao/IDependentParameterTypeAssignmentDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IDependentParameterTypeAssignmentDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IDependentParameterTypeAssignmentDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DependentParameterTypeAssignment dependentParameterTypeAssignment, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DependentParameterTypeAssignment dependentParameterTypeAssignment, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IDependentParameterTypeAssignmentDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDerivedQuantityKindDao.cs b/CDP4Orm/AutoGenDao/IDerivedQuantityKindDao.cs index 524e9d80..0887c02b 100644 --- a/CDP4Orm/AutoGenDao/IDerivedQuantityKindDao.cs +++ b/CDP4Orm/AutoGenDao/IDerivedQuantityKindDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDerivedQuantityKindDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDerivedQuantityKindDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DerivedQuantityKind derivedQuantityKind, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DerivedQuantityKind derivedQuantityKind, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDerivedQuantityKindDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDerivedUnitDao.cs b/CDP4Orm/AutoGenDao/IDerivedUnitDao.cs index 815a5a47..cecfc572 100644 --- a/CDP4Orm/AutoGenDao/IDerivedUnitDao.cs +++ b/CDP4Orm/AutoGenDao/IDerivedUnitDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDerivedUnitDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDerivedUnitDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DerivedUnit derivedUnit, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DerivedUnit derivedUnit, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDerivedUnitDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDiagramCanvasDao.cs b/CDP4Orm/AutoGenDao/IDiagramCanvasDao.cs index bf65d995..a45b9966 100644 --- a/CDP4Orm/AutoGenDao/IDiagramCanvasDao.cs +++ b/CDP4Orm/AutoGenDao/IDiagramCanvasDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDiagramCanvasDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDiagramCanvasDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramCanvas diagramCanvas, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramCanvas diagramCanvas, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDiagramCanvasDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDiagramEdgeDao.cs b/CDP4Orm/AutoGenDao/IDiagramEdgeDao.cs index 8256ddc5..246b99d2 100644 --- a/CDP4Orm/AutoGenDao/IDiagramEdgeDao.cs +++ b/CDP4Orm/AutoGenDao/IDiagramEdgeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDiagramEdgeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDiagramEdgeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramEdge diagramEdge, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramEdge diagramEdge, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDiagramEdgeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDiagramObjectDao.cs b/CDP4Orm/AutoGenDao/IDiagramObjectDao.cs index e62692ef..d95cc345 100644 --- a/CDP4Orm/AutoGenDao/IDiagramObjectDao.cs +++ b/CDP4Orm/AutoGenDao/IDiagramObjectDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDiagramObjectDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDiagramObjectDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramObject diagramObject, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DiagramObject diagramObject, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDiagramObjectDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDomainFileStoreDao.cs b/CDP4Orm/AutoGenDao/IDomainFileStoreDao.cs index c0878353..bb8f2e0e 100644 --- a/CDP4Orm/AutoGenDao/IDomainFileStoreDao.cs +++ b/CDP4Orm/AutoGenDao/IDomainFileStoreDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDomainFileStoreDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDomainFileStoreDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainFileStore domainFileStore, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainFileStore domainFileStore, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDomainFileStoreDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDomainOfExpertiseDao.cs b/CDP4Orm/AutoGenDao/IDomainOfExpertiseDao.cs index aee57961..79a54fb6 100644 --- a/CDP4Orm/AutoGenDao/IDomainOfExpertiseDao.cs +++ b/CDP4Orm/AutoGenDao/IDomainOfExpertiseDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDomainOfExpertiseDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDomainOfExpertiseDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainOfExpertise domainOfExpertise, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainOfExpertise domainOfExpertise, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDomainOfExpertiseDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IDomainOfExpertiseGroupDao.cs b/CDP4Orm/AutoGenDao/IDomainOfExpertiseGroupDao.cs index 8991c0e5..5d7fabfb 100644 --- a/CDP4Orm/AutoGenDao/IDomainOfExpertiseGroupDao.cs +++ b/CDP4Orm/AutoGenDao/IDomainOfExpertiseGroupDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IDomainOfExpertiseGroupDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IDomainOfExpertiseGroupDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainOfExpertiseGroup domainOfExpertiseGroup, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.DomainOfExpertiseGroup domainOfExpertiseGroup, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IDomainOfExpertiseGroupDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IElementDefinitionDao.cs b/CDP4Orm/AutoGenDao/IElementDefinitionDao.cs index 0a5a8d80..1f509b89 100644 --- a/CDP4Orm/AutoGenDao/IElementDefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/IElementDefinitionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IElementDefinitionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IElementDefinitionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ElementDefinition elementDefinition, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ElementDefinition elementDefinition, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IElementDefinitionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IElementUsageDao.cs b/CDP4Orm/AutoGenDao/IElementUsageDao.cs index 2fabfa3b..f8fb48e9 100644 --- a/CDP4Orm/AutoGenDao/IElementUsageDao.cs +++ b/CDP4Orm/AutoGenDao/IElementUsageDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IElementUsageDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IElementUsageDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ElementUsage elementUsage, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ElementUsage elementUsage, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IElementUsageDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IEmailAddressDao.cs b/CDP4Orm/AutoGenDao/IEmailAddressDao.cs index e46de83e..a38a95b1 100644 --- a/CDP4Orm/AutoGenDao/IEmailAddressDao.cs +++ b/CDP4Orm/AutoGenDao/IEmailAddressDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IEmailAddressDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IEmailAddressDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EmailAddress emailAddress, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EmailAddress emailAddress, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IEmailAddressDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IEngineeringModelDao.cs b/CDP4Orm/AutoGenDao/IEngineeringModelDao.cs index 1583126a..50c85556 100644 --- a/CDP4Orm/AutoGenDao/IEngineeringModelDao.cs +++ b/CDP4Orm/AutoGenDao/IEngineeringModelDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IEngineeringModelDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IEngineeringModelDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModel engineeringModel, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModel engineeringModel, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IEngineeringModelDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IEngineeringModelDataDiscussionItemDao.cs b/CDP4Orm/AutoGenDao/IEngineeringModelDataDiscussionItemDao.cs index 85e92b9d..8a061505 100644 --- a/CDP4Orm/AutoGenDao/IEngineeringModelDataDiscussionItemDao.cs +++ b/CDP4Orm/AutoGenDao/IEngineeringModelDataDiscussionItemDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IEngineeringModelDataDiscussionItemDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IEngineeringModelDataDiscussionItemDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelDataDiscussionItem engineeringModelDataDiscussionItem, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelDataDiscussionItem engineeringModelDataDiscussionItem, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IEngineeringModelDataDiscussionItemDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IEngineeringModelDataNoteDao.cs b/CDP4Orm/AutoGenDao/IEngineeringModelDataNoteDao.cs index 54239720..399f2dc0 100644 --- a/CDP4Orm/AutoGenDao/IEngineeringModelDataNoteDao.cs +++ b/CDP4Orm/AutoGenDao/IEngineeringModelDataNoteDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IEngineeringModelDataNoteDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IEngineeringModelDataNoteDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelDataNote engineeringModelDataNote, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelDataNote engineeringModelDataNote, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IEngineeringModelDataNoteDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IEngineeringModelSetupDao.cs b/CDP4Orm/AutoGenDao/IEngineeringModelSetupDao.cs index 913da032..6254edcf 100644 --- a/CDP4Orm/AutoGenDao/IEngineeringModelSetupDao.cs +++ b/CDP4Orm/AutoGenDao/IEngineeringModelSetupDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IEngineeringModelSetupDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IEngineeringModelSetupDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelSetup engineeringModelSetup, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EngineeringModelSetup engineeringModelSetup, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IEngineeringModelSetupDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IEnumerationParameterTypeDao.cs b/CDP4Orm/AutoGenDao/IEnumerationParameterTypeDao.cs index 49904c2d..0c34c8b3 100644 --- a/CDP4Orm/AutoGenDao/IEnumerationParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/IEnumerationParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IEnumerationParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IEnumerationParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EnumerationParameterType enumerationParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EnumerationParameterType enumerationParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IEnumerationParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IEnumerationValueDefinitionDao.cs b/CDP4Orm/AutoGenDao/IEnumerationValueDefinitionDao.cs index 88dd7a59..95fbe03a 100644 --- a/CDP4Orm/AutoGenDao/IEnumerationValueDefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/IEnumerationValueDefinitionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IEnumerationValueDefinitionDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IEnumerationValueDefinitionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EnumerationValueDefinition enumerationValueDefinition, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.EnumerationValueDefinition enumerationValueDefinition, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IEnumerationValueDefinitionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IExclusiveOrExpressionDao.cs b/CDP4Orm/AutoGenDao/IExclusiveOrExpressionDao.cs index ce2828be..89ad57fc 100644 --- a/CDP4Orm/AutoGenDao/IExclusiveOrExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/IExclusiveOrExpressionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IExclusiveOrExpressionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IExclusiveOrExpressionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ExclusiveOrExpression exclusiveOrExpression, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ExclusiveOrExpression exclusiveOrExpression, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IExclusiveOrExpressionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IExternalIdentifierMapDao.cs b/CDP4Orm/AutoGenDao/IExternalIdentifierMapDao.cs index 20e1211d..7283d2e7 100644 --- a/CDP4Orm/AutoGenDao/IExternalIdentifierMapDao.cs +++ b/CDP4Orm/AutoGenDao/IExternalIdentifierMapDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IExternalIdentifierMapDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IExternalIdentifierMapDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ExternalIdentifierMap externalIdentifierMap, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ExternalIdentifierMap externalIdentifierMap, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IExternalIdentifierMapDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IFileDao.cs b/CDP4Orm/AutoGenDao/IFileDao.cs index 90061563..c68319ac 100644 --- a/CDP4Orm/AutoGenDao/IFileDao.cs +++ b/CDP4Orm/AutoGenDao/IFileDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IFileDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IFileDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.File file, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.File file, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IFileDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IFileRevisionDao.cs b/CDP4Orm/AutoGenDao/IFileRevisionDao.cs index ad796b29..46e69201 100644 --- a/CDP4Orm/AutoGenDao/IFileRevisionDao.cs +++ b/CDP4Orm/AutoGenDao/IFileRevisionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IFileRevisionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IFileRevisionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.FileRevision fileRevision, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.FileRevision fileRevision, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IFileRevisionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IFileTypeDao.cs b/CDP4Orm/AutoGenDao/IFileTypeDao.cs index 020d3213..39512f5c 100644 --- a/CDP4Orm/AutoGenDao/IFileTypeDao.cs +++ b/CDP4Orm/AutoGenDao/IFileTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IFileTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IFileTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.FileType fileType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.FileType fileType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IFileTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IFolderDao.cs b/CDP4Orm/AutoGenDao/IFolderDao.cs index 15bf5899..cb833a84 100644 --- a/CDP4Orm/AutoGenDao/IFolderDao.cs +++ b/CDP4Orm/AutoGenDao/IFolderDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IFolderDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IFolderDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Folder folder, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Folder folder, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IFolderDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IGlossaryDao.cs b/CDP4Orm/AutoGenDao/IGlossaryDao.cs index e4a1426b..06836db9 100644 --- a/CDP4Orm/AutoGenDao/IGlossaryDao.cs +++ b/CDP4Orm/AutoGenDao/IGlossaryDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IGlossaryDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IGlossaryDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Glossary glossary, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Glossary glossary, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IGlossaryDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IGoalDao.cs b/CDP4Orm/AutoGenDao/IGoalDao.cs index e07a18ec..06f9bf23 100644 --- a/CDP4Orm/AutoGenDao/IGoalDao.cs +++ b/CDP4Orm/AutoGenDao/IGoalDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IGoalDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IGoalDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Goal goal, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Goal goal, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IGoalDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IHyperLinkDao.cs b/CDP4Orm/AutoGenDao/IHyperLinkDao.cs index 15764770..62e5fbcc 100644 --- a/CDP4Orm/AutoGenDao/IHyperLinkDao.cs +++ b/CDP4Orm/AutoGenDao/IHyperLinkDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IHyperLinkDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IHyperLinkDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.HyperLink hyperLink, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.HyperLink hyperLink, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IHyperLinkDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IIdCorrespondenceDao.cs b/CDP4Orm/AutoGenDao/IIdCorrespondenceDao.cs index b64f9c4b..6c66611d 100644 --- a/CDP4Orm/AutoGenDao/IIdCorrespondenceDao.cs +++ b/CDP4Orm/AutoGenDao/IIdCorrespondenceDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IIdCorrespondenceDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IIdCorrespondenceDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IdCorrespondence idCorrespondence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IdCorrespondence idCorrespondence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IIdCorrespondenceDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IIndependentParameterTypeAssignmentDao.cs b/CDP4Orm/AutoGenDao/IIndependentParameterTypeAssignmentDao.cs index 0fc7a7ed..b2d2dbda 100644 --- a/CDP4Orm/AutoGenDao/IIndependentParameterTypeAssignmentDao.cs +++ b/CDP4Orm/AutoGenDao/IIndependentParameterTypeAssignmentDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IIndependentParameterTypeAssignmentDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IIndependentParameterTypeAssignmentDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IndependentParameterTypeAssignment independentParameterTypeAssignment, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IndependentParameterTypeAssignment independentParameterTypeAssignment, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IIndependentParameterTypeAssignmentDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IIntervalScaleDao.cs b/CDP4Orm/AutoGenDao/IIntervalScaleDao.cs index 743bb57c..fa13d628 100644 --- a/CDP4Orm/AutoGenDao/IIntervalScaleDao.cs +++ b/CDP4Orm/AutoGenDao/IIntervalScaleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IIntervalScaleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IIntervalScaleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IntervalScale intervalScale, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IntervalScale intervalScale, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IIntervalScaleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IIterationDao.cs b/CDP4Orm/AutoGenDao/IIterationDao.cs index 65f5ed1c..435f723f 100644 --- a/CDP4Orm/AutoGenDao/IIterationDao.cs +++ b/CDP4Orm/AutoGenDao/IIterationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IIterationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IIterationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Iteration iteration, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Iteration iteration, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IIterationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IIterationSetupDao.cs b/CDP4Orm/AutoGenDao/IIterationSetupDao.cs index 6399eafe..dbdad67f 100644 --- a/CDP4Orm/AutoGenDao/IIterationSetupDao.cs +++ b/CDP4Orm/AutoGenDao/IIterationSetupDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IIterationSetupDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IIterationSetupDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IterationSetup iterationSetup, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IterationSetup iterationSetup, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IIterationSetupDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ILinearConversionUnitDao.cs b/CDP4Orm/AutoGenDao/ILinearConversionUnitDao.cs index 775d3838..509fe621 100644 --- a/CDP4Orm/AutoGenDao/ILinearConversionUnitDao.cs +++ b/CDP4Orm/AutoGenDao/ILinearConversionUnitDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ILinearConversionUnitDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ILinearConversionUnitDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LinearConversionUnit linearConversionUnit, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LinearConversionUnit linearConversionUnit, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ILinearConversionUnitDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ILogEntryChangelogItemDao.cs b/CDP4Orm/AutoGenDao/ILogEntryChangelogItemDao.cs index eb62ad63..83c719de 100644 --- a/CDP4Orm/AutoGenDao/ILogEntryChangelogItemDao.cs +++ b/CDP4Orm/AutoGenDao/ILogEntryChangelogItemDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ILogEntryChangelogItemDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ILogEntryChangelogItemDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LogEntryChangelogItem logEntryChangelogItem, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LogEntryChangelogItem logEntryChangelogItem, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ILogEntryChangelogItemDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ILogarithmicScaleDao.cs b/CDP4Orm/AutoGenDao/ILogarithmicScaleDao.cs index a426e7b4..c0502c8b 100644 --- a/CDP4Orm/AutoGenDao/ILogarithmicScaleDao.cs +++ b/CDP4Orm/AutoGenDao/ILogarithmicScaleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ILogarithmicScaleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ILogarithmicScaleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LogarithmicScale logarithmicScale, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LogarithmicScale logarithmicScale, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ILogarithmicScaleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IMappingToReferenceScaleDao.cs b/CDP4Orm/AutoGenDao/IMappingToReferenceScaleDao.cs index 1ed5e387..20e46bc8 100644 --- a/CDP4Orm/AutoGenDao/IMappingToReferenceScaleDao.cs +++ b/CDP4Orm/AutoGenDao/IMappingToReferenceScaleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IMappingToReferenceScaleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IMappingToReferenceScaleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MappingToReferenceScale mappingToReferenceScale, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MappingToReferenceScale mappingToReferenceScale, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IMappingToReferenceScaleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IModelLogEntryDao.cs b/CDP4Orm/AutoGenDao/IModelLogEntryDao.cs index 171d5265..e84afd62 100644 --- a/CDP4Orm/AutoGenDao/IModelLogEntryDao.cs +++ b/CDP4Orm/AutoGenDao/IModelLogEntryDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IModelLogEntryDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IModelLogEntryDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModelLogEntry modelLogEntry, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModelLogEntry modelLogEntry, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IModelLogEntryDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IModelReferenceDataLibraryDao.cs b/CDP4Orm/AutoGenDao/IModelReferenceDataLibraryDao.cs index 41c05c87..bd005144 100644 --- a/CDP4Orm/AutoGenDao/IModelReferenceDataLibraryDao.cs +++ b/CDP4Orm/AutoGenDao/IModelReferenceDataLibraryDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IModelReferenceDataLibraryDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IModelReferenceDataLibraryDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModelReferenceDataLibrary modelReferenceDataLibrary, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModelReferenceDataLibrary modelReferenceDataLibrary, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IModelReferenceDataLibraryDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IModellingThingReferenceDao.cs b/CDP4Orm/AutoGenDao/IModellingThingReferenceDao.cs index c06f3cb7..b68b63d4 100644 --- a/CDP4Orm/AutoGenDao/IModellingThingReferenceDao.cs +++ b/CDP4Orm/AutoGenDao/IModellingThingReferenceDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IModellingThingReferenceDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IModellingThingReferenceDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModellingThingReference modellingThingReference, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModellingThingReference modellingThingReference, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IModellingThingReferenceDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IMultiRelationshipDao.cs b/CDP4Orm/AutoGenDao/IMultiRelationshipDao.cs index c5dce4b1..59a349f7 100644 --- a/CDP4Orm/AutoGenDao/IMultiRelationshipDao.cs +++ b/CDP4Orm/AutoGenDao/IMultiRelationshipDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IMultiRelationshipDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IMultiRelationshipDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MultiRelationship multiRelationship, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MultiRelationship multiRelationship, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IMultiRelationshipDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IMultiRelationshipRuleDao.cs b/CDP4Orm/AutoGenDao/IMultiRelationshipRuleDao.cs index a41115db..ad2ee1bb 100644 --- a/CDP4Orm/AutoGenDao/IMultiRelationshipRuleDao.cs +++ b/CDP4Orm/AutoGenDao/IMultiRelationshipRuleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IMultiRelationshipRuleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IMultiRelationshipRuleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MultiRelationshipRule multiRelationshipRule, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MultiRelationshipRule multiRelationshipRule, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IMultiRelationshipRuleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/INaturalLanguageDao.cs b/CDP4Orm/AutoGenDao/INaturalLanguageDao.cs index b81d2a72..791d7b38 100644 --- a/CDP4Orm/AutoGenDao/INaturalLanguageDao.cs +++ b/CDP4Orm/AutoGenDao/INaturalLanguageDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface INaturalLanguageDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface INaturalLanguageDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NaturalLanguage naturalLanguage, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NaturalLanguage naturalLanguage, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface INaturalLanguageDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/INestedElementDao.cs b/CDP4Orm/AutoGenDao/INestedElementDao.cs index 43f80341..470afdc7 100644 --- a/CDP4Orm/AutoGenDao/INestedElementDao.cs +++ b/CDP4Orm/AutoGenDao/INestedElementDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface INestedElementDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface INestedElementDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NestedElement nestedElement, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NestedElement nestedElement, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface INestedElementDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/INestedParameterDao.cs b/CDP4Orm/AutoGenDao/INestedParameterDao.cs index fee1fc42..8c1ccb7f 100644 --- a/CDP4Orm/AutoGenDao/INestedParameterDao.cs +++ b/CDP4Orm/AutoGenDao/INestedParameterDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface INestedParameterDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface INestedParameterDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NestedParameter nestedParameter, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NestedParameter nestedParameter, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface INestedParameterDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/INotExpressionDao.cs b/CDP4Orm/AutoGenDao/INotExpressionDao.cs index f4a5a63c..4770b703 100644 --- a/CDP4Orm/AutoGenDao/INotExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/INotExpressionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface INotExpressionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface INotExpressionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NotExpression notExpression, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NotExpression notExpression, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface INotExpressionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IOptionDao.cs b/CDP4Orm/AutoGenDao/IOptionDao.cs index 884766b0..ecd0b466 100644 --- a/CDP4Orm/AutoGenDao/IOptionDao.cs +++ b/CDP4Orm/AutoGenDao/IOptionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IOptionDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IOptionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Option option, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Option option, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IOptionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IOrExpressionDao.cs b/CDP4Orm/AutoGenDao/IOrExpressionDao.cs index f38efa3f..fc75f9e1 100644 --- a/CDP4Orm/AutoGenDao/IOrExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/IOrExpressionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IOrExpressionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IOrExpressionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrExpression orExpression, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrExpression orExpression, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IOrExpressionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IOrdinalScaleDao.cs b/CDP4Orm/AutoGenDao/IOrdinalScaleDao.cs index 2cc9b94a..d66ce7b5 100644 --- a/CDP4Orm/AutoGenDao/IOrdinalScaleDao.cs +++ b/CDP4Orm/AutoGenDao/IOrdinalScaleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IOrdinalScaleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IOrdinalScaleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrdinalScale ordinalScale, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrdinalScale ordinalScale, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IOrdinalScaleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IOrganizationDao.cs b/CDP4Orm/AutoGenDao/IOrganizationDao.cs index 90f6e83a..ec80a778 100644 --- a/CDP4Orm/AutoGenDao/IOrganizationDao.cs +++ b/CDP4Orm/AutoGenDao/IOrganizationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IOrganizationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IOrganizationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Organization organization, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Organization organization, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IOrganizationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IOrganizationalParticipantDao.cs b/CDP4Orm/AutoGenDao/IOrganizationalParticipantDao.cs index 918d7233..ce4b9458 100644 --- a/CDP4Orm/AutoGenDao/IOrganizationalParticipantDao.cs +++ b/CDP4Orm/AutoGenDao/IOrganizationalParticipantDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IOrganizationalParticipantDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IOrganizationalParticipantDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrganizationalParticipant organizationalParticipant, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrganizationalParticipant organizationalParticipant, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IOrganizationalParticipantDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IOwnedStyleDao.cs b/CDP4Orm/AutoGenDao/IOwnedStyleDao.cs index 45ce798f..b27b58f4 100644 --- a/CDP4Orm/AutoGenDao/IOwnedStyleDao.cs +++ b/CDP4Orm/AutoGenDao/IOwnedStyleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IOwnedStyleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IOwnedStyleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OwnedStyle ownedStyle, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OwnedStyle ownedStyle, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IOwnedStyleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPageDao.cs b/CDP4Orm/AutoGenDao/IPageDao.cs index 5f479e4d..59ef3811 100644 --- a/CDP4Orm/AutoGenDao/IPageDao.cs +++ b/CDP4Orm/AutoGenDao/IPageDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IPageDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IPageDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Page page, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Page page, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IPageDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterDao.cs b/CDP4Orm/AutoGenDao/IParameterDao.cs index 3091c5fd..5120857e 100644 --- a/CDP4Orm/AutoGenDao/IParameterDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Parameter parameter, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Parameter parameter, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterGroupDao.cs b/CDP4Orm/AutoGenDao/IParameterGroupDao.cs index d2310fa1..6fc549bd 100644 --- a/CDP4Orm/AutoGenDao/IParameterGroupDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterGroupDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterGroupDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterGroupDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterGroup parameterGroup, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterGroup parameterGroup, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterGroupDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterOverrideDao.cs b/CDP4Orm/AutoGenDao/IParameterOverrideDao.cs index ef5ed59c..c869f00a 100644 --- a/CDP4Orm/AutoGenDao/IParameterOverrideDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterOverrideDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterOverrideDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterOverrideDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterOverride parameterOverride, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterOverride parameterOverride, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterOverrideDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterOverrideValueSetDao.cs b/CDP4Orm/AutoGenDao/IParameterOverrideValueSetDao.cs index d8a737a2..0e7fc315 100644 --- a/CDP4Orm/AutoGenDao/IParameterOverrideValueSetDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterOverrideValueSetDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterOverrideValueSetDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterOverrideValueSetDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterOverrideValueSet parameterOverrideValueSet, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterOverrideValueSet parameterOverrideValueSet, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterOverrideValueSetDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterSubscriptionDao.cs b/CDP4Orm/AutoGenDao/IParameterSubscriptionDao.cs index 592f9c72..d4d727d4 100644 --- a/CDP4Orm/AutoGenDao/IParameterSubscriptionDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterSubscriptionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterSubscriptionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterSubscriptionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterSubscription parameterSubscription, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterSubscription parameterSubscription, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterSubscriptionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterSubscriptionValueSetDao.cs b/CDP4Orm/AutoGenDao/IParameterSubscriptionValueSetDao.cs index 85493999..2c60d856 100644 --- a/CDP4Orm/AutoGenDao/IParameterSubscriptionValueSetDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterSubscriptionValueSetDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterSubscriptionValueSetDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterSubscriptionValueSetDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterSubscriptionValueSet parameterSubscriptionValueSet, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterSubscriptionValueSet parameterSubscriptionValueSet, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterSubscriptionValueSetDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterTypeComponentDao.cs b/CDP4Orm/AutoGenDao/IParameterTypeComponentDao.cs index 7eccef51..3705b925 100644 --- a/CDP4Orm/AutoGenDao/IParameterTypeComponentDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterTypeComponentDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IParameterTypeComponentDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IParameterTypeComponentDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterTypeComponent parameterTypeComponent, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterTypeComponent parameterTypeComponent, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IParameterTypeComponentDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterValueSetDao.cs b/CDP4Orm/AutoGenDao/IParameterValueSetDao.cs index 3ba187c0..e5ff6d4f 100644 --- a/CDP4Orm/AutoGenDao/IParameterValueSetDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterValueSetDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterValueSetDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterValueSetDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterValueSet parameterValueSet, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterValueSet parameterValueSet, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterValueSetDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParameterizedCategoryRuleDao.cs b/CDP4Orm/AutoGenDao/IParameterizedCategoryRuleDao.cs index 243baca4..f17280af 100644 --- a/CDP4Orm/AutoGenDao/IParameterizedCategoryRuleDao.cs +++ b/CDP4Orm/AutoGenDao/IParameterizedCategoryRuleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParameterizedCategoryRuleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParameterizedCategoryRuleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterizedCategoryRule parameterizedCategoryRule, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterizedCategoryRule parameterizedCategoryRule, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParameterizedCategoryRuleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParametricConstraintDao.cs b/CDP4Orm/AutoGenDao/IParametricConstraintDao.cs index 30764dc0..8356c220 100644 --- a/CDP4Orm/AutoGenDao/IParametricConstraintDao.cs +++ b/CDP4Orm/AutoGenDao/IParametricConstraintDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IParametricConstraintDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IParametricConstraintDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParametricConstraint parametricConstraint, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParametricConstraint parametricConstraint, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IParametricConstraintDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParticipantDao.cs b/CDP4Orm/AutoGenDao/IParticipantDao.cs index f2bfce05..8085d725 100644 --- a/CDP4Orm/AutoGenDao/IParticipantDao.cs +++ b/CDP4Orm/AutoGenDao/IParticipantDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParticipantDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParticipantDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Participant participant, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Participant participant, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParticipantDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParticipantPermissionDao.cs b/CDP4Orm/AutoGenDao/IParticipantPermissionDao.cs index 6a3a3de0..73efcbc1 100644 --- a/CDP4Orm/AutoGenDao/IParticipantPermissionDao.cs +++ b/CDP4Orm/AutoGenDao/IParticipantPermissionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParticipantPermissionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParticipantPermissionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParticipantPermission participantPermission, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParticipantPermission participantPermission, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParticipantPermissionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IParticipantRoleDao.cs b/CDP4Orm/AutoGenDao/IParticipantRoleDao.cs index 97990a8f..6313f6d9 100644 --- a/CDP4Orm/AutoGenDao/IParticipantRoleDao.cs +++ b/CDP4Orm/AutoGenDao/IParticipantRoleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IParticipantRoleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IParticipantRoleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParticipantRole participantRole, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParticipantRole participantRole, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IParticipantRoleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPersonDao.cs b/CDP4Orm/AutoGenDao/IPersonDao.cs index 794b197f..575b6390 100644 --- a/CDP4Orm/AutoGenDao/IPersonDao.cs +++ b/CDP4Orm/AutoGenDao/IPersonDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IPersonDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IPersonDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Person person, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Person person, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IPersonDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPersonPermissionDao.cs b/CDP4Orm/AutoGenDao/IPersonPermissionDao.cs index ba64030c..19d41a5b 100644 --- a/CDP4Orm/AutoGenDao/IPersonPermissionDao.cs +++ b/CDP4Orm/AutoGenDao/IPersonPermissionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IPersonPermissionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IPersonPermissionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PersonPermission personPermission, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PersonPermission personPermission, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IPersonPermissionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPersonRoleDao.cs b/CDP4Orm/AutoGenDao/IPersonRoleDao.cs index c47720ab..8f5095ce 100644 --- a/CDP4Orm/AutoGenDao/IPersonRoleDao.cs +++ b/CDP4Orm/AutoGenDao/IPersonRoleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IPersonRoleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IPersonRoleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PersonRole personRole, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PersonRole personRole, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IPersonRoleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPointDao.cs b/CDP4Orm/AutoGenDao/IPointDao.cs index b7b21079..ca9588d8 100644 --- a/CDP4Orm/AutoGenDao/IPointDao.cs +++ b/CDP4Orm/AutoGenDao/IPointDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IPointDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IPointDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Point point, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Point point, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IPointDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPossibleFiniteStateDao.cs b/CDP4Orm/AutoGenDao/IPossibleFiniteStateDao.cs index 6b644045..adaeffb9 100644 --- a/CDP4Orm/AutoGenDao/IPossibleFiniteStateDao.cs +++ b/CDP4Orm/AutoGenDao/IPossibleFiniteStateDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IPossibleFiniteStateDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IPossibleFiniteStateDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PossibleFiniteState possibleFiniteState, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PossibleFiniteState possibleFiniteState, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IPossibleFiniteStateDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPossibleFiniteStateListDao.cs b/CDP4Orm/AutoGenDao/IPossibleFiniteStateListDao.cs index ee413667..13b753df 100644 --- a/CDP4Orm/AutoGenDao/IPossibleFiniteStateListDao.cs +++ b/CDP4Orm/AutoGenDao/IPossibleFiniteStateListDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IPossibleFiniteStateListDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IPossibleFiniteStateListDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PossibleFiniteStateList possibleFiniteStateList, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PossibleFiniteStateList possibleFiniteStateList, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IPossibleFiniteStateListDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPrefixedUnitDao.cs b/CDP4Orm/AutoGenDao/IPrefixedUnitDao.cs index 622ba5a2..cbdb535e 100644 --- a/CDP4Orm/AutoGenDao/IPrefixedUnitDao.cs +++ b/CDP4Orm/AutoGenDao/IPrefixedUnitDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IPrefixedUnitDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IPrefixedUnitDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PrefixedUnit prefixedUnit, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PrefixedUnit prefixedUnit, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IPrefixedUnitDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IPublicationDao.cs b/CDP4Orm/AutoGenDao/IPublicationDao.cs index d86206c1..22e2f0ed 100644 --- a/CDP4Orm/AutoGenDao/IPublicationDao.cs +++ b/CDP4Orm/AutoGenDao/IPublicationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IPublicationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IPublicationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Publication publication, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Publication publication, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IPublicationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IQuantityKindFactorDao.cs b/CDP4Orm/AutoGenDao/IQuantityKindFactorDao.cs index 1d0363ef..3a217a2b 100644 --- a/CDP4Orm/AutoGenDao/IQuantityKindFactorDao.cs +++ b/CDP4Orm/AutoGenDao/IQuantityKindFactorDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IQuantityKindFactorDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IQuantityKindFactorDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.QuantityKindFactor quantityKindFactor, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.QuantityKindFactor quantityKindFactor, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IQuantityKindFactorDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRatioScaleDao.cs b/CDP4Orm/AutoGenDao/IRatioScaleDao.cs index 9acb7bd2..9f30e891 100644 --- a/CDP4Orm/AutoGenDao/IRatioScaleDao.cs +++ b/CDP4Orm/AutoGenDao/IRatioScaleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRatioScaleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRatioScaleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RatioScale ratioScale, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RatioScale ratioScale, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRatioScaleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IReferenceSourceDao.cs b/CDP4Orm/AutoGenDao/IReferenceSourceDao.cs index b12eca35..978a22c1 100644 --- a/CDP4Orm/AutoGenDao/IReferenceSourceDao.cs +++ b/CDP4Orm/AutoGenDao/IReferenceSourceDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IReferenceSourceDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IReferenceSourceDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReferenceSource referenceSource, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReferenceSource referenceSource, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IReferenceSourceDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IReferencerRuleDao.cs b/CDP4Orm/AutoGenDao/IReferencerRuleDao.cs index 4d353b26..7e8370d4 100644 --- a/CDP4Orm/AutoGenDao/IReferencerRuleDao.cs +++ b/CDP4Orm/AutoGenDao/IReferencerRuleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IReferencerRuleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IReferencerRuleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReferencerRule referencerRule, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReferencerRule referencerRule, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IReferencerRuleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRelationalExpressionDao.cs b/CDP4Orm/AutoGenDao/IRelationalExpressionDao.cs index 1e2e88c1..00ac554e 100644 --- a/CDP4Orm/AutoGenDao/IRelationalExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/IRelationalExpressionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRelationalExpressionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRelationalExpressionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RelationalExpression relationalExpression, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RelationalExpression relationalExpression, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRelationalExpressionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRelationshipParameterValueDao.cs b/CDP4Orm/AutoGenDao/IRelationshipParameterValueDao.cs index 5a7fb46d..3b6d26d0 100644 --- a/CDP4Orm/AutoGenDao/IRelationshipParameterValueDao.cs +++ b/CDP4Orm/AutoGenDao/IRelationshipParameterValueDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRelationshipParameterValueDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRelationshipParameterValueDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RelationshipParameterValue relationshipParameterValue, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RelationshipParameterValue relationshipParameterValue, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRelationshipParameterValueDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRequestForDeviationDao.cs b/CDP4Orm/AutoGenDao/IRequestForDeviationDao.cs index 6d541521..24013750 100644 --- a/CDP4Orm/AutoGenDao/IRequestForDeviationDao.cs +++ b/CDP4Orm/AutoGenDao/IRequestForDeviationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRequestForDeviationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRequestForDeviationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequestForDeviation requestForDeviation, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequestForDeviation requestForDeviation, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRequestForDeviationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRequestForWaiverDao.cs b/CDP4Orm/AutoGenDao/IRequestForWaiverDao.cs index 25935983..2cf8732a 100644 --- a/CDP4Orm/AutoGenDao/IRequestForWaiverDao.cs +++ b/CDP4Orm/AutoGenDao/IRequestForWaiverDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRequestForWaiverDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRequestForWaiverDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequestForWaiver requestForWaiver, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequestForWaiver requestForWaiver, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRequestForWaiverDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRequirementDao.cs b/CDP4Orm/AutoGenDao/IRequirementDao.cs index 4feb94c8..ca45a6ac 100644 --- a/CDP4Orm/AutoGenDao/IRequirementDao.cs +++ b/CDP4Orm/AutoGenDao/IRequirementDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRequirementDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRequirementDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Requirement requirement, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Requirement requirement, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRequirementDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRequirementsContainerParameterValueDao.cs b/CDP4Orm/AutoGenDao/IRequirementsContainerParameterValueDao.cs index 4d331f2c..94263850 100644 --- a/CDP4Orm/AutoGenDao/IRequirementsContainerParameterValueDao.cs +++ b/CDP4Orm/AutoGenDao/IRequirementsContainerParameterValueDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRequirementsContainerParameterValueDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRequirementsContainerParameterValueDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsContainerParameterValue requirementsContainerParameterValue, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsContainerParameterValue requirementsContainerParameterValue, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRequirementsContainerParameterValueDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRequirementsGroupDao.cs b/CDP4Orm/AutoGenDao/IRequirementsGroupDao.cs index dd025276..4fbef6c6 100644 --- a/CDP4Orm/AutoGenDao/IRequirementsGroupDao.cs +++ b/CDP4Orm/AutoGenDao/IRequirementsGroupDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRequirementsGroupDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRequirementsGroupDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsGroup requirementsGroup, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsGroup requirementsGroup, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRequirementsGroupDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRequirementsSpecificationDao.cs b/CDP4Orm/AutoGenDao/IRequirementsSpecificationDao.cs index 36ce288c..bf69be20 100644 --- a/CDP4Orm/AutoGenDao/IRequirementsSpecificationDao.cs +++ b/CDP4Orm/AutoGenDao/IRequirementsSpecificationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRequirementsSpecificationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRequirementsSpecificationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsSpecification requirementsSpecification, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsSpecification requirementsSpecification, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRequirementsSpecificationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IReviewItemDiscrepancyDao.cs b/CDP4Orm/AutoGenDao/IReviewItemDiscrepancyDao.cs index 4a7d1b63..e11fe35a 100644 --- a/CDP4Orm/AutoGenDao/IReviewItemDiscrepancyDao.cs +++ b/CDP4Orm/AutoGenDao/IReviewItemDiscrepancyDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IReviewItemDiscrepancyDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IReviewItemDiscrepancyDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReviewItemDiscrepancy reviewItemDiscrepancy, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReviewItemDiscrepancy reviewItemDiscrepancy, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IReviewItemDiscrepancyDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRuleVerificationListDao.cs b/CDP4Orm/AutoGenDao/IRuleVerificationListDao.cs index f7149134..7dc22a57 100644 --- a/CDP4Orm/AutoGenDao/IRuleVerificationListDao.cs +++ b/CDP4Orm/AutoGenDao/IRuleVerificationListDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRuleVerificationListDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRuleVerificationListDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RuleVerificationList ruleVerificationList, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RuleVerificationList ruleVerificationList, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRuleVerificationListDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IRuleViolationDao.cs b/CDP4Orm/AutoGenDao/IRuleViolationDao.cs index ff47a47b..eeeb5471 100644 --- a/CDP4Orm/AutoGenDao/IRuleViolationDao.cs +++ b/CDP4Orm/AutoGenDao/IRuleViolationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IRuleViolationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IRuleViolationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RuleViolation ruleViolation, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RuleViolation ruleViolation, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IRuleViolationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISampledFunctionParameterTypeDao.cs b/CDP4Orm/AutoGenDao/ISampledFunctionParameterTypeDao.cs index 7d68a7e0..bd2734cb 100644 --- a/CDP4Orm/AutoGenDao/ISampledFunctionParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/ISampledFunctionParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISampledFunctionParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISampledFunctionParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SampledFunctionParameterType sampledFunctionParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SampledFunctionParameterType sampledFunctionParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISampledFunctionParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IScaleReferenceQuantityValueDao.cs b/CDP4Orm/AutoGenDao/IScaleReferenceQuantityValueDao.cs index 0fbb662f..f0f6c4bc 100644 --- a/CDP4Orm/AutoGenDao/IScaleReferenceQuantityValueDao.cs +++ b/CDP4Orm/AutoGenDao/IScaleReferenceQuantityValueDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IScaleReferenceQuantityValueDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IScaleReferenceQuantityValueDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ScaleReferenceQuantityValue scaleReferenceQuantityValue, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ScaleReferenceQuantityValue scaleReferenceQuantityValue, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IScaleReferenceQuantityValueDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IScaleValueDefinitionDao.cs b/CDP4Orm/AutoGenDao/IScaleValueDefinitionDao.cs index 52e811e7..401c5031 100644 --- a/CDP4Orm/AutoGenDao/IScaleValueDefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/IScaleValueDefinitionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IScaleValueDefinitionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IScaleValueDefinitionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ScaleValueDefinition scaleValueDefinition, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ScaleValueDefinition scaleValueDefinition, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IScaleValueDefinitionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISectionDao.cs b/CDP4Orm/AutoGenDao/ISectionDao.cs index e8019ca1..09ac780c 100644 --- a/CDP4Orm/AutoGenDao/ISectionDao.cs +++ b/CDP4Orm/AutoGenDao/ISectionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface ISectionDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface ISectionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Section section, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Section section, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface ISectionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISharedStyleDao.cs b/CDP4Orm/AutoGenDao/ISharedStyleDao.cs index 32dad1a9..0e177845 100644 --- a/CDP4Orm/AutoGenDao/ISharedStyleDao.cs +++ b/CDP4Orm/AutoGenDao/ISharedStyleDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISharedStyleDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISharedStyleDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SharedStyle sharedStyle, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SharedStyle sharedStyle, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISharedStyleDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISimpleParameterValueDao.cs b/CDP4Orm/AutoGenDao/ISimpleParameterValueDao.cs index 4a9a17e5..2059ea70 100644 --- a/CDP4Orm/AutoGenDao/ISimpleParameterValueDao.cs +++ b/CDP4Orm/AutoGenDao/ISimpleParameterValueDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISimpleParameterValueDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISimpleParameterValueDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleParameterValue simpleParameterValue, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleParameterValue simpleParameterValue, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISimpleParameterValueDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISimpleQuantityKindDao.cs b/CDP4Orm/AutoGenDao/ISimpleQuantityKindDao.cs index d25accdd..e5e57ba2 100644 --- a/CDP4Orm/AutoGenDao/ISimpleQuantityKindDao.cs +++ b/CDP4Orm/AutoGenDao/ISimpleQuantityKindDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISimpleQuantityKindDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISimpleQuantityKindDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleQuantityKind simpleQuantityKind, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleQuantityKind simpleQuantityKind, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISimpleQuantityKindDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISimpleUnitDao.cs b/CDP4Orm/AutoGenDao/ISimpleUnitDao.cs index d1fd6386..c874138f 100644 --- a/CDP4Orm/AutoGenDao/ISimpleUnitDao.cs +++ b/CDP4Orm/AutoGenDao/ISimpleUnitDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISimpleUnitDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISimpleUnitDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleUnit simpleUnit, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleUnit simpleUnit, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISimpleUnitDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISiteDirectoryDao.cs b/CDP4Orm/AutoGenDao/ISiteDirectoryDao.cs index 39d0abbc..803e1556 100644 --- a/CDP4Orm/AutoGenDao/ISiteDirectoryDao.cs +++ b/CDP4Orm/AutoGenDao/ISiteDirectoryDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISiteDirectoryDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISiteDirectoryDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectory siteDirectory, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectory siteDirectory, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISiteDirectoryDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISiteDirectoryDataAnnotationDao.cs b/CDP4Orm/AutoGenDao/ISiteDirectoryDataAnnotationDao.cs index 1cab409b..ac25bce8 100644 --- a/CDP4Orm/AutoGenDao/ISiteDirectoryDataAnnotationDao.cs +++ b/CDP4Orm/AutoGenDao/ISiteDirectoryDataAnnotationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISiteDirectoryDataAnnotationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISiteDirectoryDataAnnotationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryDataAnnotation siteDirectoryDataAnnotation, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryDataAnnotation siteDirectoryDataAnnotation, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISiteDirectoryDataAnnotationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISiteDirectoryDataDiscussionItemDao.cs b/CDP4Orm/AutoGenDao/ISiteDirectoryDataDiscussionItemDao.cs index 9c51378f..89cfda53 100644 --- a/CDP4Orm/AutoGenDao/ISiteDirectoryDataDiscussionItemDao.cs +++ b/CDP4Orm/AutoGenDao/ISiteDirectoryDataDiscussionItemDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISiteDirectoryDataDiscussionItemDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISiteDirectoryDataDiscussionItemDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryDataDiscussionItem siteDirectoryDataDiscussionItem, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryDataDiscussionItem siteDirectoryDataDiscussionItem, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISiteDirectoryDataDiscussionItemDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISiteDirectoryThingReferenceDao.cs b/CDP4Orm/AutoGenDao/ISiteDirectoryThingReferenceDao.cs index 69d3a8b4..941d4734 100644 --- a/CDP4Orm/AutoGenDao/ISiteDirectoryThingReferenceDao.cs +++ b/CDP4Orm/AutoGenDao/ISiteDirectoryThingReferenceDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISiteDirectoryThingReferenceDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISiteDirectoryThingReferenceDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryThingReference siteDirectoryThingReference, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryThingReference siteDirectoryThingReference, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISiteDirectoryThingReferenceDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISiteLogEntryDao.cs b/CDP4Orm/AutoGenDao/ISiteLogEntryDao.cs index 23ade376..06e719ca 100644 --- a/CDP4Orm/AutoGenDao/ISiteLogEntryDao.cs +++ b/CDP4Orm/AutoGenDao/ISiteLogEntryDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISiteLogEntryDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISiteLogEntryDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteLogEntry siteLogEntry, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteLogEntry siteLogEntry, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISiteLogEntryDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISiteReferenceDataLibraryDao.cs b/CDP4Orm/AutoGenDao/ISiteReferenceDataLibraryDao.cs index 2873c815..3e5982ce 100644 --- a/CDP4Orm/AutoGenDao/ISiteReferenceDataLibraryDao.cs +++ b/CDP4Orm/AutoGenDao/ISiteReferenceDataLibraryDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISiteReferenceDataLibraryDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISiteReferenceDataLibraryDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteReferenceDataLibrary siteReferenceDataLibrary, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteReferenceDataLibrary siteReferenceDataLibrary, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISiteReferenceDataLibraryDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISolutionDao.cs b/CDP4Orm/AutoGenDao/ISolutionDao.cs index b7d17621..354affd3 100644 --- a/CDP4Orm/AutoGenDao/ISolutionDao.cs +++ b/CDP4Orm/AutoGenDao/ISolutionDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISolutionDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISolutionDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Solution solution, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Solution solution, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISolutionDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ISpecializedQuantityKindDao.cs b/CDP4Orm/AutoGenDao/ISpecializedQuantityKindDao.cs index bc90d227..3f5d21eb 100644 --- a/CDP4Orm/AutoGenDao/ISpecializedQuantityKindDao.cs +++ b/CDP4Orm/AutoGenDao/ISpecializedQuantityKindDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ISpecializedQuantityKindDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ISpecializedQuantityKindDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SpecializedQuantityKind specializedQuantityKind, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SpecializedQuantityKind specializedQuantityKind, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ISpecializedQuantityKindDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IStakeHolderValueMapDao.cs b/CDP4Orm/AutoGenDao/IStakeHolderValueMapDao.cs index e61ce9e1..0dafbfa8 100644 --- a/CDP4Orm/AutoGenDao/IStakeHolderValueMapDao.cs +++ b/CDP4Orm/AutoGenDao/IStakeHolderValueMapDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IStakeHolderValueMapDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IStakeHolderValueMapDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeHolderValueMap stakeHolderValueMap, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeHolderValueMap stakeHolderValueMap, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IStakeHolderValueMapDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IStakeHolderValueMapSettingsDao.cs b/CDP4Orm/AutoGenDao/IStakeHolderValueMapSettingsDao.cs index 591fd564..dfa96805 100644 --- a/CDP4Orm/AutoGenDao/IStakeHolderValueMapSettingsDao.cs +++ b/CDP4Orm/AutoGenDao/IStakeHolderValueMapSettingsDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IStakeHolderValueMapSettingsDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IStakeHolderValueMapSettingsDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeHolderValueMapSettings stakeHolderValueMapSettings, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeHolderValueMapSettings stakeHolderValueMapSettings, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IStakeHolderValueMapSettingsDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IStakeholderDao.cs b/CDP4Orm/AutoGenDao/IStakeholderDao.cs index 4c587c8a..d596896f 100644 --- a/CDP4Orm/AutoGenDao/IStakeholderDao.cs +++ b/CDP4Orm/AutoGenDao/IStakeholderDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IStakeholderDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IStakeholderDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Stakeholder stakeholder, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Stakeholder stakeholder, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IStakeholderDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IStakeholderValueDao.cs b/CDP4Orm/AutoGenDao/IStakeholderValueDao.cs index 406fbc34..6ca56dd5 100644 --- a/CDP4Orm/AutoGenDao/IStakeholderValueDao.cs +++ b/CDP4Orm/AutoGenDao/IStakeholderValueDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IStakeholderValueDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IStakeholderValueDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeholderValue stakeholderValue, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeholderValue stakeholderValue, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IStakeholderValueDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ITelephoneNumberDao.cs b/CDP4Orm/AutoGenDao/ITelephoneNumberDao.cs index eabaf02a..be4560c2 100644 --- a/CDP4Orm/AutoGenDao/ITelephoneNumberDao.cs +++ b/CDP4Orm/AutoGenDao/ITelephoneNumberDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ITelephoneNumberDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ITelephoneNumberDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TelephoneNumber telephoneNumber, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TelephoneNumber telephoneNumber, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ITelephoneNumberDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ITermDao.cs b/CDP4Orm/AutoGenDao/ITermDao.cs index ce802a3a..c7ab991c 100644 --- a/CDP4Orm/AutoGenDao/ITermDao.cs +++ b/CDP4Orm/AutoGenDao/ITermDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ITermDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ITermDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Term term, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Term term, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ITermDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ITextParameterTypeDao.cs b/CDP4Orm/AutoGenDao/ITextParameterTypeDao.cs index d98d45a2..d64a48fd 100644 --- a/CDP4Orm/AutoGenDao/ITextParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/ITextParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ITextParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ITextParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TextParameterType textParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TextParameterType textParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ITextParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ITextualNoteDao.cs b/CDP4Orm/AutoGenDao/ITextualNoteDao.cs index 2d1918fd..b95d9154 100644 --- a/CDP4Orm/AutoGenDao/ITextualNoteDao.cs +++ b/CDP4Orm/AutoGenDao/ITextualNoteDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ITextualNoteDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ITextualNoteDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TextualNote textualNote, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TextualNote textualNote, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ITextualNoteDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ITimeOfDayParameterTypeDao.cs b/CDP4Orm/AutoGenDao/ITimeOfDayParameterTypeDao.cs index 7c02b033..ea7c9b23 100644 --- a/CDP4Orm/AutoGenDao/ITimeOfDayParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/ITimeOfDayParameterTypeDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface ITimeOfDayParameterTypeDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface ITimeOfDayParameterTypeDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TimeOfDayParameterType timeOfDayParameterType, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TimeOfDayParameterType timeOfDayParameterType, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface ITimeOfDayParameterTypeDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IUnitFactorDao.cs b/CDP4Orm/AutoGenDao/IUnitFactorDao.cs index 286e165b..c4d1cb5b 100644 --- a/CDP4Orm/AutoGenDao/IUnitFactorDao.cs +++ b/CDP4Orm/AutoGenDao/IUnitFactorDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,11 +67,9 @@ public partial interface IUnitFactorDao : IDao /// /// The that is to be persisted. /// - /// /// The order sequence used to persist this instance. /// - /// /// The container of the DTO to be persisted. /// @@ -80,6 +78,30 @@ public partial interface IUnitFactorDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UnitFactor unitFactor, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UnitFactor unitFactor, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -180,6 +202,25 @@ public partial interface IUnitFactorDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IUnitPrefixDao.cs b/CDP4Orm/AutoGenDao/IUnitPrefixDao.cs index d0d1b51a..d73c8785 100644 --- a/CDP4Orm/AutoGenDao/IUnitPrefixDao.cs +++ b/CDP4Orm/AutoGenDao/IUnitPrefixDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IUnitPrefixDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IUnitPrefixDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UnitPrefix unitPrefix, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UnitPrefix unitPrefix, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IUnitPrefixDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IUserPreferenceDao.cs b/CDP4Orm/AutoGenDao/IUserPreferenceDao.cs index 3d2d7de1..1f2fe7e3 100644 --- a/CDP4Orm/AutoGenDao/IUserPreferenceDao.cs +++ b/CDP4Orm/AutoGenDao/IUserPreferenceDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IUserPreferenceDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IUserPreferenceDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UserPreference userPreference, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UserPreference userPreference, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IUserPreferenceDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IUserRuleVerificationDao.cs b/CDP4Orm/AutoGenDao/IUserRuleVerificationDao.cs index e211aa9c..f22afdef 100644 --- a/CDP4Orm/AutoGenDao/IUserRuleVerificationDao.cs +++ b/CDP4Orm/AutoGenDao/IUserRuleVerificationDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IUserRuleVerificationDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IUserRuleVerificationDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UserRuleVerification userRuleVerification, long sequence, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UserRuleVerification userRuleVerification, long sequence, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IUserRuleVerificationDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IValueGroupDao.cs b/CDP4Orm/AutoGenDao/IValueGroupDao.cs index f1ac963e..20eb49e7 100644 --- a/CDP4Orm/AutoGenDao/IValueGroupDao.cs +++ b/CDP4Orm/AutoGenDao/IValueGroupDao.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -67,7 +67,6 @@ public partial interface IValueGroupDao : IDao /// /// The that is to be persisted. /// - /// /// The container of the DTO to be persisted. /// @@ -76,6 +75,27 @@ public partial interface IValueGroupDao : IDao /// bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ValueGroup valueGroup, CDP4Common.DTO.Thing container = null); + /// + /// Insert a database record from the supplied data transfer object and updates it if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ValueGroup valueGroup, CDP4Common.DTO.Thing container = null); + /// /// Update a database record from the supplied data transfer object. /// @@ -159,6 +179,25 @@ public partial interface IValueGroupDao : IDao /// bool Delete(NpgsqlTransaction transaction, string partition, Guid iid); + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid); + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/IdCorrespondenceDao.cs b/CDP4Orm/AutoGenDao/IdCorrespondenceDao.cs index f3b81086..9c6536b7 100644 --- a/CDP4Orm/AutoGenDao/IdCorrespondenceDao.cs +++ b/CDP4Orm/AutoGenDao/IdCorrespondenceDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -231,6 +227,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, idCorrespondence, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The idCorrespondence DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IdCorrespondence idCorrespondence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, idCorrespondence, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ExternalId", !this.IsDerived(idCorrespondence, "ExternalId") ? idCorrespondence.ExternalId.Escape() : string.Empty }, + { "InternalThing", !this.IsDerived(idCorrespondence, "InternalThing") ? idCorrespondence.InternalThing.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"IdCorrespondence\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = idCorrespondence.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -313,5 +365,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/IndependentParameterTypeAssignmentDao.cs b/CDP4Orm/AutoGenDao/IndependentParameterTypeAssignmentDao.cs index e4c76ce2..073f80b7 100644 --- a/CDP4Orm/AutoGenDao/IndependentParameterTypeAssignmentDao.cs +++ b/CDP4Orm/AutoGenDao/IndependentParameterTypeAssignmentDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -220,6 +216,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, independentParameterTypeAssignment, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The independentParameterTypeAssignment DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IndependentParameterTypeAssignment independentParameterTypeAssignment, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, independentParameterTypeAssignment, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"IndependentParameterTypeAssignment\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Sequence\", \"Container\", \"MeasurementScale\", \"ParameterType\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :sequence, :container, :measurementScale, :parameterType)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = independentParameterTypeAssignment.Iid; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("measurementScale", NpgsqlDbType.Uuid).Value = !this.IsDerived(independentParameterTypeAssignment, "MeasurementScale") ? Utils.NullableValue(independentParameterTypeAssignment.MeasurementScale) : Utils.NullableValue(null); + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(independentParameterTypeAssignment, "ParameterType") ? independentParameterTypeAssignment.ParameterType : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"MeasurementScale\", \"ParameterType\")"); + sqlBuilder.Append(" = (:container, :measurementScale, :parameterType);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -336,5 +387,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/IntervalScaleDao.cs b/CDP4Orm/AutoGenDao/IntervalScaleDao.cs index eb955c67..af01fc71 100644 --- a/CDP4Orm/AutoGenDao/IntervalScaleDao.cs +++ b/CDP4Orm/AutoGenDao/IntervalScaleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -277,6 +273,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, intervalScale, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The intervalScale DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IntervalScale intervalScale, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, intervalScale, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"IntervalScale\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = intervalScale.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -334,5 +376,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/IterationDao.cs b/CDP4Orm/AutoGenDao/IterationDao.cs index 4409cc4f..cf88065a 100644 --- a/CDP4Orm/AutoGenDao/IterationDao.cs +++ b/CDP4Orm/AutoGenDao/IterationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -247,6 +243,64 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, iteration, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The iteration DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Iteration iteration, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, iteration, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "SourceIterationIid", !this.IsDerived(iteration, "SourceIterationIid") && iteration.SourceIterationIid.HasValue ? iteration.SourceIterationIid.Value.ToString() : null }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Iteration\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"DefaultOption\", \"IterationSetup\", \"TopElement\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :defaultOption, :iterationSetup, :topElement)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iteration.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("defaultOption", NpgsqlDbType.Uuid).Value = !this.IsDerived(iteration, "DefaultOption") ? Utils.NullableValue(iteration.DefaultOption) : Utils.NullableValue(null); + command.Parameters.Add("iterationSetup", NpgsqlDbType.Uuid).Value = !this.IsDerived(iteration, "IterationSetup") ? iteration.IterationSetup : Utils.NullableValue(null); + command.Parameters.Add("topElement", NpgsqlDbType.Uuid).Value = !this.IsDerived(iteration, "TopElement") ? Utils.NullableValue(iteration.TopElement) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"DefaultOption\", \"IterationSetup\", \"TopElement\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :defaultOption, :iterationSetup, :topElement);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -332,6 +386,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Copy the tables from a source to an Iteration partition /// diff --git a/CDP4Orm/AutoGenDao/IterationSetupDao.cs b/CDP4Orm/AutoGenDao/IterationSetupDao.cs index 02e0fc9b..1fb5db02 100644 --- a/CDP4Orm/AutoGenDao/IterationSetupDao.cs +++ b/CDP4Orm/AutoGenDao/IterationSetupDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -261,6 +257,67 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, iterationSetup, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The iterationSetup DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.IterationSetup iterationSetup, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, iterationSetup, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(iterationSetup, "CreatedOn") ? iterationSetup.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Description", !this.IsDerived(iterationSetup, "Description") ? iterationSetup.Description.Escape() : string.Empty }, + { "FrozenOn", !this.IsDerived(iterationSetup, "FrozenOn") && iterationSetup.FrozenOn.HasValue ? iterationSetup.FrozenOn.Value.ToString(Utils.DateTimeUtcSerializationFormat) : null }, + { "IsDeleted", !this.IsDerived(iterationSetup, "IsDeleted") ? iterationSetup.IsDeleted.ToString() : string.Empty }, + { "IterationIid", !this.IsDerived(iterationSetup, "IterationIid") ? iterationSetup.IterationIid.ToString() : string.Empty }, + { "IterationNumber", iterationSetup.IterationNumber.ToString() }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"IterationSetup\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"SourceIterationSetup\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :sourceIterationSetup)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iterationSetup.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("sourceIterationSetup", NpgsqlDbType.Uuid).Value = !this.IsDerived(iterationSetup, "SourceIterationSetup") ? Utils.NullableValue(iterationSetup.SourceIterationSetup) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"SourceIterationSetup\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :sourceIterationSetup);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -348,5 +405,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/LinearConversionUnitDao.cs b/CDP4Orm/AutoGenDao/LinearConversionUnitDao.cs index 202608e4..c8035835 100644 --- a/CDP4Orm/AutoGenDao/LinearConversionUnitDao.cs +++ b/CDP4Orm/AutoGenDao/LinearConversionUnitDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, linearConversionUnit, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The linearConversionUnit DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LinearConversionUnit linearConversionUnit, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, linearConversionUnit, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"LinearConversionUnit\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = linearConversionUnit.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -296,5 +338,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/LogEntryChangelogItemDao.cs b/CDP4Orm/AutoGenDao/LogEntryChangelogItemDao.cs index 283096fd..42017d1c 100644 --- a/CDP4Orm/AutoGenDao/LogEntryChangelogItemDao.cs +++ b/CDP4Orm/AutoGenDao/LogEntryChangelogItemDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -242,6 +238,65 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, logEntryChangelogItem, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The logEntryChangelogItem DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LogEntryChangelogItem logEntryChangelogItem, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, logEntryChangelogItem, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "AffectedItemIid", !this.IsDerived(logEntryChangelogItem, "AffectedItemIid") ? logEntryChangelogItem.AffectedItemIid.ToString() : string.Empty }, + { "ChangeDescription", !this.IsDerived(logEntryChangelogItem, "ChangeDescription") ? logEntryChangelogItem.ChangeDescription.Escape() : null }, + { "ChangelogKind", !this.IsDerived(logEntryChangelogItem, "ChangelogKind") ? logEntryChangelogItem.ChangelogKind.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"LogEntryChangelogItem\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = logEntryChangelogItem.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + logEntryChangelogItem.AffectedReferenceIid.ForEach(x => this.UpsertAffectedReferenceIid(transaction, partition, logEntryChangelogItem.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -322,6 +377,45 @@ public bool AddAffectedReferenceIid(NpgsqlTransaction transaction, string partit } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertAffectedReferenceIid(NpgsqlTransaction transaction, string partition, Guid iid, Guid affectedReferenceIid) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"LogEntryChangelogItem_AffectedReferenceIid\"", partition); + sqlBuilder.AppendFormat(" (\"LogEntryChangelogItem\", \"AffectedReferenceIid\")"); + sqlBuilder.Append(" VALUES (:logEntryChangelogItem, :affectedReferenceIid)"); + + command.Parameters.Add("logEntryChangelogItem", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("affectedReferenceIid", NpgsqlDbType.Uuid).Value = affectedReferenceIid; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -406,6 +500,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/LogarithmicScaleDao.cs b/CDP4Orm/AutoGenDao/LogarithmicScaleDao.cs index bb3d6d7e..b539bfc4 100644 --- a/CDP4Orm/AutoGenDao/LogarithmicScaleDao.cs +++ b/CDP4Orm/AutoGenDao/LogarithmicScaleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -306,6 +302,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, logarithmicScale, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The logarithmicScale DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.LogarithmicScale logarithmicScale, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, logarithmicScale, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Exponent", !this.IsDerived(logarithmicScale, "Exponent") ? logarithmicScale.Exponent.Escape() : string.Empty }, + { "Factor", !this.IsDerived(logarithmicScale, "Factor") ? logarithmicScale.Factor.Escape() : string.Empty }, + { "LogarithmBase", !this.IsDerived(logarithmicScale, "LogarithmBase") ? logarithmicScale.LogarithmBase.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"LogarithmicScale\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ReferenceQuantityKind\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :referenceQuantityKind)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = logarithmicScale.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("referenceQuantityKind", NpgsqlDbType.Uuid).Value = !this.IsDerived(logarithmicScale, "ReferenceQuantityKind") ? logarithmicScale.ReferenceQuantityKind : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ReferenceQuantityKind\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :referenceQuantityKind);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -389,5 +442,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/MappingToReferenceScaleDao.cs b/CDP4Orm/AutoGenDao/MappingToReferenceScaleDao.cs index 843978cf..c6ed135e 100644 --- a/CDP4Orm/AutoGenDao/MappingToReferenceScaleDao.cs +++ b/CDP4Orm/AutoGenDao/MappingToReferenceScaleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -216,6 +212,57 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, mappingToReferenceScale, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The mappingToReferenceScale DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MappingToReferenceScale mappingToReferenceScale, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, mappingToReferenceScale, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"MappingToReferenceScale\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"DependentScaleValue\", \"ReferenceScaleValue\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :dependentScaleValue, :referenceScaleValue)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = mappingToReferenceScale.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("dependentScaleValue", NpgsqlDbType.Uuid).Value = !this.IsDerived(mappingToReferenceScale, "DependentScaleValue") ? mappingToReferenceScale.DependentScaleValue : Utils.NullableValue(null); + command.Parameters.Add("referenceScaleValue", NpgsqlDbType.Uuid).Value = !this.IsDerived(mappingToReferenceScale, "ReferenceScaleValue") ? mappingToReferenceScale.ReferenceScaleValue : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"DependentScaleValue\", \"ReferenceScaleValue\")"); + sqlBuilder.Append(" = (:container, :dependentScaleValue, :referenceScaleValue);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -293,5 +340,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/MeasurementScaleDao.cs b/CDP4Orm/AutoGenDao/MeasurementScaleDao.cs index 1873b798..eb7725c2 100644 --- a/CDP4Orm/AutoGenDao/MeasurementScaleDao.cs +++ b/CDP4Orm/AutoGenDao/MeasurementScaleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -107,6 +103,69 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, measurementScale, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The measurementScale DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MeasurementScale measurementScale, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, measurementScale, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(measurementScale, "IsDeprecated") ? measurementScale.IsDeprecated.ToString() : string.Empty }, + { "IsMaximumInclusive", !this.IsDerived(measurementScale, "IsMaximumInclusive") ? measurementScale.IsMaximumInclusive.ToString() : string.Empty }, + { "IsMinimumInclusive", !this.IsDerived(measurementScale, "IsMinimumInclusive") ? measurementScale.IsMinimumInclusive.ToString() : string.Empty }, + { "MaximumPermissibleValue", !this.IsDerived(measurementScale, "MaximumPermissibleValue") ? measurementScale.MaximumPermissibleValue.Escape() : null }, + { "MinimumPermissibleValue", !this.IsDerived(measurementScale, "MinimumPermissibleValue") ? measurementScale.MinimumPermissibleValue.Escape() : null }, + { "NegativeValueConnotation", !this.IsDerived(measurementScale, "NegativeValueConnotation") ? measurementScale.NegativeValueConnotation.Escape() : null }, + { "NumberSet", !this.IsDerived(measurementScale, "NumberSet") ? measurementScale.NumberSet.ToString() : string.Empty }, + { "PositiveValueConnotation", !this.IsDerived(measurementScale, "PositiveValueConnotation") ? measurementScale.PositiveValueConnotation.Escape() : null }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"MeasurementScale\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Unit\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :unit)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = measurementScale.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("unit", NpgsqlDbType.Uuid).Value = !this.IsDerived(measurementScale, "Unit") ? measurementScale.Unit : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Unit\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :unit);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -214,5 +273,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"MeasurementScale\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/MeasurementUnitDao.cs b/CDP4Orm/AutoGenDao/MeasurementUnitDao.cs index 0cfd61df..ad768cae 100644 --- a/CDP4Orm/AutoGenDao/MeasurementUnitDao.cs +++ b/CDP4Orm/AutoGenDao/MeasurementUnitDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -99,6 +95,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, measurementUnit, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The measurementUnit DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MeasurementUnit measurementUnit, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, measurementUnit, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(measurementUnit, "IsDeprecated") ? measurementUnit.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"MeasurementUnit\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = measurementUnit.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -198,5 +249,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"MeasurementUnit\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ModelLogEntryDao.cs b/CDP4Orm/AutoGenDao/ModelLogEntryDao.cs index dfe19862..d1d3a3b0 100644 --- a/CDP4Orm/AutoGenDao/ModelLogEntryDao.cs +++ b/CDP4Orm/AutoGenDao/ModelLogEntryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -258,6 +254,70 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, modelLogEntry, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The modelLogEntry DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModelLogEntry modelLogEntry, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, modelLogEntry, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Content", !this.IsDerived(modelLogEntry, "Content") ? modelLogEntry.Content.Escape() : string.Empty }, + { "CreatedOn", !this.IsDerived(modelLogEntry, "CreatedOn") ? modelLogEntry.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "LanguageCode", !this.IsDerived(modelLogEntry, "LanguageCode") ? modelLogEntry.LanguageCode.Escape() : string.Empty }, + { "Level", !this.IsDerived(modelLogEntry, "Level") ? modelLogEntry.Level.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModelLogEntry\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Author\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :author)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = modelLogEntry.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(modelLogEntry, "Author") ? Utils.NullableValue(modelLogEntry.Author) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Author\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :author);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + modelLogEntry.AffectedDomainIid.ForEach(x => this.UpsertAffectedDomainIid(transaction, partition, modelLogEntry.Iid, x)); + + modelLogEntry.AffectedItemIid.ForEach(x => this.UpsertAffectedItemIid(transaction, partition, modelLogEntry.Iid, x)); + modelLogEntry.Category.ForEach(x => this.UpsertCategory(transaction, partition, modelLogEntry.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -349,6 +409,45 @@ public bool AddAffectedDomainIid(NpgsqlTransaction transaction, string partition return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertAffectedDomainIid(NpgsqlTransaction transaction, string partition, Guid iid, Guid affectedDomainIid) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModelLogEntry_AffectedDomainIid\"", partition); + sqlBuilder.AppendFormat(" (\"ModelLogEntry\", \"AffectedDomainIid\")"); + sqlBuilder.Append(" VALUES (:modelLogEntry, :affectedDomainIid)"); + + command.Parameters.Add("modelLogEntry", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("affectedDomainIid", NpgsqlDbType.Uuid).Value = affectedDomainIid; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -387,6 +486,45 @@ public bool AddAffectedItemIid(NpgsqlTransaction transaction, string partition, } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertAffectedItemIid(NpgsqlTransaction transaction, string partition, Guid iid, Guid affectedItemIid) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModelLogEntry_AffectedItemIid\"", partition); + sqlBuilder.AppendFormat(" (\"ModelLogEntry\", \"AffectedItemIid\")"); + sqlBuilder.Append(" VALUES (:modelLogEntry, :affectedItemIid)"); + + command.Parameters.Add("modelLogEntry", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("affectedItemIid", NpgsqlDbType.Uuid).Value = affectedItemIid; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Insert a new association record in the link table. /// @@ -425,6 +563,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModelLogEntry_Category\"", partition); + sqlBuilder.AppendFormat(" (\"ModelLogEntry\", \"Category\")"); + sqlBuilder.Append(" VALUES (:modelLogEntry, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ModelLogEntry_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ModelLogEntry\", \"Category\")"); + sqlBuilder.Append(" = (:modelLogEntry, :category);"); + + command.Parameters.Add("modelLogEntry", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -511,6 +692,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ModelReferenceDataLibraryDao.cs b/CDP4Orm/AutoGenDao/ModelReferenceDataLibraryDao.cs index 9a9b90c9..75ae6189 100644 --- a/CDP4Orm/AutoGenDao/ModelReferenceDataLibraryDao.cs +++ b/CDP4Orm/AutoGenDao/ModelReferenceDataLibraryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -240,6 +236,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, modelReferenceDataLibrary, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The modelReferenceDataLibrary DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModelReferenceDataLibrary modelReferenceDataLibrary, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, modelReferenceDataLibrary, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModelReferenceDataLibrary\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = modelReferenceDataLibrary.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -315,5 +360,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ModellingAnnotationItemDao.cs b/CDP4Orm/AutoGenDao/ModellingAnnotationItemDao.cs index 7409649d..2ca1e7d0 100644 --- a/CDP4Orm/AutoGenDao/ModellingAnnotationItemDao.cs +++ b/CDP4Orm/AutoGenDao/ModellingAnnotationItemDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -105,6 +101,67 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, modellingAnnotationItem, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The modellingAnnotationItem DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModellingAnnotationItem modellingAnnotationItem, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, modellingAnnotationItem, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Classification", !this.IsDerived(modellingAnnotationItem, "Classification") ? modellingAnnotationItem.Classification.ToString() : string.Empty }, + { "ShortName", !this.IsDerived(modellingAnnotationItem, "ShortName") ? modellingAnnotationItem.ShortName.Escape() : string.Empty }, + { "Status", !this.IsDerived(modellingAnnotationItem, "Status") ? modellingAnnotationItem.Status.ToString() : string.Empty }, + { "Title", !this.IsDerived(modellingAnnotationItem, "Title") ? modellingAnnotationItem.Title.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModellingAnnotationItem\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = modellingAnnotationItem.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(modellingAnnotationItem, "Owner") ? modellingAnnotationItem.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + modellingAnnotationItem.Category.ForEach(x => this.UpsertCategory(transaction, partition, modellingAnnotationItem.Iid, x)); + modellingAnnotationItem.SourceAnnotation.ForEach(x => this.UpsertSourceAnnotation(transaction, partition, modellingAnnotationItem.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -190,6 +247,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModellingAnnotationItem_Category\"", partition); + sqlBuilder.AppendFormat(" (\"ModellingAnnotationItem\", \"Category\")"); + sqlBuilder.Append(" VALUES (:modellingAnnotationItem, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ModellingAnnotationItem_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ModellingAnnotationItem\", \"Category\")"); + sqlBuilder.Append(" = (:modellingAnnotationItem, :category);"); + + command.Parameters.Add("modellingAnnotationItem", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -228,6 +328,49 @@ public bool AddSourceAnnotation(NpgsqlTransaction transaction, string partition, } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertSourceAnnotation(NpgsqlTransaction transaction, string partition, Guid iid, Guid sourceAnnotation) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModellingAnnotationItem_SourceAnnotation\"", partition); + sqlBuilder.AppendFormat(" (\"ModellingAnnotationItem\", \"SourceAnnotation\")"); + sqlBuilder.Append(" VALUES (:modellingAnnotationItem, :sourceAnnotation)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ModellingAnnotationItem_SourceAnnotation_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ModellingAnnotationItem\", \"SourceAnnotation\")"); + sqlBuilder.Append(" = (:modellingAnnotationItem, :sourceAnnotation);"); + + command.Parameters.Add("modellingAnnotationItem", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("sourceAnnotation", NpgsqlDbType.Uuid).Value = sourceAnnotation; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -314,6 +457,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ModellingThingReferenceDao.cs b/CDP4Orm/AutoGenDao/ModellingThingReferenceDao.cs index 6db4ceca..f32fd050 100644 --- a/CDP4Orm/AutoGenDao/ModellingThingReferenceDao.cs +++ b/CDP4Orm/AutoGenDao/ModellingThingReferenceDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -219,6 +215,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, modellingThingReference, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The modellingThingReference DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ModellingThingReference modellingThingReference, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, modellingThingReference, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ModellingThingReference\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = modellingThingReference.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -294,5 +339,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/MultiRelationshipDao.cs b/CDP4Orm/AutoGenDao/MultiRelationshipDao.cs index 0a6a8a2d..7ba0c10c 100644 --- a/CDP4Orm/AutoGenDao/MultiRelationshipDao.cs +++ b/CDP4Orm/AutoGenDao/MultiRelationshipDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -222,6 +218,53 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, multiRelationship, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The multiRelationship DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MultiRelationship multiRelationship, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, multiRelationship, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"MultiRelationship\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = multiRelationship.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + multiRelationship.RelatedThing.ForEach(x => this.UpsertRelatedThing(transaction, partition, multiRelationship.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -302,6 +345,49 @@ public bool AddRelatedThing(NpgsqlTransaction transaction, string partition, Gui } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertRelatedThing(NpgsqlTransaction transaction, string partition, Guid iid, Guid relatedThing) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"MultiRelationship_RelatedThing\"", partition); + sqlBuilder.AppendFormat(" (\"MultiRelationship\", \"RelatedThing\")"); + sqlBuilder.Append(" VALUES (:multiRelationship, :relatedThing)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"MultiRelationship_RelatedThing_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"MultiRelationship\", \"RelatedThing\")"); + sqlBuilder.Append(" = (:multiRelationship, :relatedThing);"); + + command.Parameters.Add("multiRelationship", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("relatedThing", NpgsqlDbType.Uuid).Value = relatedThing; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -360,6 +446,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/MultiRelationshipRuleDao.cs b/CDP4Orm/AutoGenDao/MultiRelationshipRuleDao.cs index fe49fca0..4071511c 100644 --- a/CDP4Orm/AutoGenDao/MultiRelationshipRuleDao.cs +++ b/CDP4Orm/AutoGenDao/MultiRelationshipRuleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -255,6 +251,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, multiRelationshipRule, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The multiRelationshipRule DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.MultiRelationshipRule multiRelationshipRule, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, multiRelationshipRule, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "MaxRelated", !this.IsDerived(multiRelationshipRule, "MaxRelated") ? multiRelationshipRule.MaxRelated.ToString() : string.Empty }, + { "MinRelated", !this.IsDerived(multiRelationshipRule, "MinRelated") ? multiRelationshipRule.MinRelated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"MultiRelationshipRule\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"RelationshipCategory\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :relationshipCategory)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = multiRelationshipRule.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("relationshipCategory", NpgsqlDbType.Uuid).Value = !this.IsDerived(multiRelationshipRule, "RelationshipCategory") ? multiRelationshipRule.RelationshipCategory : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"RelationshipCategory\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :relationshipCategory);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + multiRelationshipRule.RelatedCategory.ForEach(x => this.UpsertRelatedCategory(transaction, partition, multiRelationshipRule.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -335,6 +388,49 @@ public bool AddRelatedCategory(NpgsqlTransaction transaction, string partition, } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertRelatedCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid relatedCategory) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"MultiRelationshipRule_RelatedCategory\"", partition); + sqlBuilder.AppendFormat(" (\"MultiRelationshipRule\", \"RelatedCategory\")"); + sqlBuilder.Append(" VALUES (:multiRelationshipRule, :relatedCategory)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"MultiRelationshipRule_RelatedCategory_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"MultiRelationshipRule\", \"RelatedCategory\")"); + sqlBuilder.Append(" = (:multiRelationshipRule, :relatedCategory);"); + + command.Parameters.Add("multiRelationshipRule", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("relatedCategory", NpgsqlDbType.Uuid).Value = relatedCategory; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -418,6 +514,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/NaturalLanguageDao.cs b/CDP4Orm/AutoGenDao/NaturalLanguageDao.cs index 3cf1068f..dbf60ed8 100644 --- a/CDP4Orm/AutoGenDao/NaturalLanguageDao.cs +++ b/CDP4Orm/AutoGenDao/NaturalLanguageDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, naturalLanguage, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The naturalLanguage DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NaturalLanguage naturalLanguage, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, naturalLanguage, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "LanguageCode", !this.IsDerived(naturalLanguage, "LanguageCode") ? naturalLanguage.LanguageCode.Escape() : string.Empty }, + { "Name", !this.IsDerived(naturalLanguage, "Name") ? naturalLanguage.Name.Escape() : string.Empty }, + { "NativeName", !this.IsDerived(naturalLanguage, "NativeName") ? naturalLanguage.NativeName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"NaturalLanguage\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = naturalLanguage.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -321,5 +374,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/NestedElementDao.cs b/CDP4Orm/AutoGenDao/NestedElementDao.cs index db8fac17..426df9df 100644 --- a/CDP4Orm/AutoGenDao/NestedElementDao.cs +++ b/CDP4Orm/AutoGenDao/NestedElementDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -229,6 +225,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, nestedElement, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The nestedElement DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NestedElement nestedElement, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, nestedElement, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsVolatile", !this.IsDerived(nestedElement, "IsVolatile") ? nestedElement.IsVolatile.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"NestedElement\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"RootElement\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :rootElement)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = nestedElement.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("rootElement", NpgsqlDbType.Uuid).Value = !this.IsDerived(nestedElement, "RootElement") ? nestedElement.RootElement : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"RootElement\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :rootElement);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + nestedElement.ElementUsage.ForEach(x => this.UpsertElementUsage(transaction, partition, nestedElement.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -310,6 +363,50 @@ public bool AddElementUsage(NpgsqlTransaction transaction, string partition, Gui } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertElementUsage(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem elementUsage) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"NestedElement_ElementUsage\"", partition); + sqlBuilder.AppendFormat(" (\"NestedElement\", \"ElementUsage\", \"Sequence\")"); + sqlBuilder.Append(" VALUES (:nestedElement, :elementUsage, :sequence)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"NestedElement_ElementUsage_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.AppendFormat(" SET (\"NestedElement\", \"ElementUsage\", \"Sequence\")"); + sqlBuilder.Append(" = (:nestedElement, :elementUsage, :sequence);"); + + command.Parameters.Add("nestedElement", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("elementUsage", NpgsqlDbType.Uuid).Value = Guid.Parse(elementUsage.V.ToString()); + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = elementUsage.K; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -478,6 +575,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/NestedParameterDao.cs b/CDP4Orm/AutoGenDao/NestedParameterDao.cs index fb33c537..ee886a1a 100644 --- a/CDP4Orm/AutoGenDao/NestedParameterDao.cs +++ b/CDP4Orm/AutoGenDao/NestedParameterDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -244,6 +240,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, nestedParameter, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The nestedParameter DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NestedParameter nestedParameter, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, nestedParameter, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ActualValue", !this.IsDerived(nestedParameter, "ActualValue") ? nestedParameter.ActualValue.Escape() : string.Empty }, + { "Formula", !this.IsDerived(nestedParameter, "Formula") ? nestedParameter.Formula.Escape() : string.Empty }, + { "IsVolatile", !this.IsDerived(nestedParameter, "IsVolatile") ? nestedParameter.IsVolatile.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"NestedParameter\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ActualState\", \"AssociatedParameter\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :actualState, :associatedParameter, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = nestedParameter.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("actualState", NpgsqlDbType.Uuid).Value = !this.IsDerived(nestedParameter, "ActualState") ? Utils.NullableValue(nestedParameter.ActualState) : Utils.NullableValue(null); + command.Parameters.Add("associatedParameter", NpgsqlDbType.Uuid).Value = !this.IsDerived(nestedParameter, "AssociatedParameter") ? nestedParameter.AssociatedParameter : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(nestedParameter, "Owner") ? nestedParameter.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ActualState\", \"AssociatedParameter\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :actualState, :associatedParameter, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -330,5 +386,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/NotExpressionDao.cs b/CDP4Orm/AutoGenDao/NotExpressionDao.cs index bb99e962..f8826cce 100644 --- a/CDP4Orm/AutoGenDao/NotExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/NotExpressionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -213,6 +209,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, notExpression, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The notExpression DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.NotExpression notExpression, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, notExpression, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"NotExpression\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Term\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :term)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = notExpression.Iid; + command.Parameters.Add("term", NpgsqlDbType.Uuid).Value = !this.IsDerived(notExpression, "Term") ? notExpression.Term : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Term\""); + sqlBuilder.Append(" = :term;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -288,5 +333,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/NoteDao.cs b/CDP4Orm/AutoGenDao/NoteDao.cs index 611ce2bb..1a2d4f97 100644 --- a/CDP4Orm/AutoGenDao/NoteDao.cs +++ b/CDP4Orm/AutoGenDao/NoteDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -107,6 +103,69 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, note, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The note DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Note note, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, note, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(note, "CreatedOn") ? note.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(note, "Name") ? note.Name.Escape() : string.Empty }, + { "ShortName", !this.IsDerived(note, "ShortName") ? note.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Note\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = note.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(note, "Owner") ? note.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + note.Category.ForEach(x => this.UpsertCategory(transaction, partition, note.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -187,6 +246,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Note_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Note\", \"Category\")"); + sqlBuilder.Append(" VALUES (:note, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Note_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Note\", \"Category\")"); + sqlBuilder.Append(" = (:note, :category);"); + + command.Parameters.Add("note", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -311,6 +413,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/OptionDao.cs b/CDP4Orm/AutoGenDao/OptionDao.cs index 025b77cf..aa4514f2 100644 --- a/CDP4Orm/AutoGenDao/OptionDao.cs +++ b/CDP4Orm/AutoGenDao/OptionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -234,6 +230,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, option, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The option DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Option option, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, option, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Option\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Sequence\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :sequence, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = option.Iid; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + option.Category.ForEach(x => this.UpsertCategory(transaction, partition, option.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -314,6 +364,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Option_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Option\", \"Category\")"); + sqlBuilder.Append(" VALUES (:option, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Option_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Option\", \"Category\")"); + sqlBuilder.Append(" = (:option, :category);"); + + command.Parameters.Add("option", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -429,6 +522,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/OrExpressionDao.cs b/CDP4Orm/AutoGenDao/OrExpressionDao.cs index a33dff28..b819fcb1 100644 --- a/CDP4Orm/AutoGenDao/OrExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/OrExpressionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -213,6 +209,53 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, orExpression, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The orExpression DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrExpression orExpression, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, orExpression, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"OrExpression\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = orExpression.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + orExpression.Term.ForEach(x => this.UpsertTerm(transaction, partition, orExpression.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -293,6 +336,49 @@ public bool AddTerm(NpgsqlTransaction transaction, string partition, Guid iid, G } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertTerm(NpgsqlTransaction transaction, string partition, Guid iid, Guid term) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"OrExpression_Term\"", partition); + sqlBuilder.AppendFormat(" (\"OrExpression\", \"Term\")"); + sqlBuilder.Append(" VALUES (:orExpression, :term)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"OrExpression_Term_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"OrExpression\", \"Term\")"); + sqlBuilder.Append(" = (:orExpression, :term);"); + + command.Parameters.Add("orExpression", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("term", NpgsqlDbType.Uuid).Value = term; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,6 +437,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/OrdinalScaleDao.cs b/CDP4Orm/AutoGenDao/OrdinalScaleDao.cs index 8b9a820b..d7f03e18 100644 --- a/CDP4Orm/AutoGenDao/OrdinalScaleDao.cs +++ b/CDP4Orm/AutoGenDao/OrdinalScaleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -289,6 +285,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, ordinalScale, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The ordinalScale DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrdinalScale ordinalScale, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, ordinalScale, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "UseShortNameValues", !this.IsDerived(ordinalScale, "UseShortNameValues") ? ordinalScale.UseShortNameValues.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"OrdinalScale\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = ordinalScale.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -369,5 +419,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/OrganizationDao.cs b/CDP4Orm/AutoGenDao/OrganizationDao.cs index a3b0c975..53df8eed 100644 --- a/CDP4Orm/AutoGenDao/OrganizationDao.cs +++ b/CDP4Orm/AutoGenDao/OrganizationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, organization, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The organization DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Organization organization, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, organization, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(organization, "IsDeprecated") ? organization.IsDeprecated.ToString() : string.Empty }, + { "Name", !this.IsDerived(organization, "Name") ? organization.Name.Escape() : string.Empty }, + { "ShortName", !this.IsDerived(organization, "ShortName") ? organization.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Organization\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = organization.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -339,5 +392,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Organization\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/OrganizationalParticipantDao.cs b/CDP4Orm/AutoGenDao/OrganizationalParticipantDao.cs index a6f587e2..711f9dbb 100644 --- a/CDP4Orm/AutoGenDao/OrganizationalParticipantDao.cs +++ b/CDP4Orm/AutoGenDao/OrganizationalParticipantDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -214,6 +210,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, organizationalParticipant, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The organizationalParticipant DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OrganizationalParticipant organizationalParticipant, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, organizationalParticipant, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"OrganizationalParticipant\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Organization\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :organization)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = organizationalParticipant.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("organization", NpgsqlDbType.Uuid).Value = !this.IsDerived(organizationalParticipant, "Organization") ? organizationalParticipant.Organization : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Organization\")"); + sqlBuilder.Append(" = (:container, :organization);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -290,5 +336,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/OwnedStyleDao.cs b/CDP4Orm/AutoGenDao/OwnedStyleDao.cs index da7beae7..b701454e 100644 --- a/CDP4Orm/AutoGenDao/OwnedStyleDao.cs +++ b/CDP4Orm/AutoGenDao/OwnedStyleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -276,6 +272,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, ownedStyle, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The ownedStyle DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.OwnedStyle ownedStyle, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, ownedStyle, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"OwnedStyle\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = ownedStyle.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,5 +396,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PageDao.cs b/CDP4Orm/AutoGenDao/PageDao.cs index ed904a6a..4b4c3648 100644 --- a/CDP4Orm/AutoGenDao/PageDao.cs +++ b/CDP4Orm/AutoGenDao/PageDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -247,6 +243,69 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, page, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The page DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Page page, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, page, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(page, "CreatedOn") ? page.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(page, "Name") ? page.Name.Escape() : string.Empty }, + { "ShortName", !this.IsDerived(page, "ShortName") ? page.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Page\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = page.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(page, "Owner") ? page.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + page.Category.ForEach(x => this.UpsertCategory(transaction, partition, page.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -327,6 +386,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Page_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Page\", \"Category\")"); + sqlBuilder.Append(" VALUES (:page, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Page_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Page\", \"Category\")"); + sqlBuilder.Append(" = (:page, :category);"); + + command.Parameters.Add("page", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -451,6 +553,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ParameterBaseDao.cs b/CDP4Orm/AutoGenDao/ParameterBaseDao.cs index 1e4c89ac..c9b76cf0 100644 --- a/CDP4Orm/AutoGenDao/ParameterBaseDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterBaseDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -103,6 +99,65 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterBase, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterBase DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterBase parameterBase, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterBase, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsOptionDependent", !this.IsDerived(parameterBase, "IsOptionDependent") ? parameterBase.IsOptionDependent.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterBase\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Group\", \"Owner\", \"ParameterType\", \"Scale\", \"StateDependence\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :group, :owner, :parameterType, :scale, :stateDependence)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterBase.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("group", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterBase, "Group") ? Utils.NullableValue(parameterBase.Group) : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterBase, "Owner") ? parameterBase.Owner : Utils.NullableValue(null); + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterBase, "ParameterType") ? parameterBase.ParameterType : Utils.NullableValue(null); + command.Parameters.Add("scale", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterBase, "Scale") ? Utils.NullableValue(parameterBase.Scale) : Utils.NullableValue(null); + command.Parameters.Add("stateDependence", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterBase, "StateDependence") ? Utils.NullableValue(parameterBase.StateDependence) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Group\", \"Owner\", \"ParameterType\", \"Scale\", \"StateDependence\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :group, :owner, :parameterType, :scale, :stateDependence);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -188,5 +243,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterDao.cs b/CDP4Orm/AutoGenDao/ParameterDao.cs index 585f3538..cb20b47c 100644 --- a/CDP4Orm/AutoGenDao/ParameterDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -246,6 +242,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameter, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameter DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Parameter parameter, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameter, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "AllowDifferentOwnerOfOverride", !this.IsDerived(parameter, "AllowDifferentOwnerOfOverride") ? parameter.AllowDifferentOwnerOfOverride.ToString() : string.Empty }, + { "ExpectsOverride", !this.IsDerived(parameter, "ExpectsOverride") ? parameter.ExpectsOverride.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Parameter\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"RequestedBy\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :requestedBy)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameter.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("requestedBy", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameter, "RequestedBy") ? Utils.NullableValue(parameter.RequestedBy) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"RequestedBy\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :requestedBy);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -329,5 +382,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterGroupDao.cs b/CDP4Orm/AutoGenDao/ParameterGroupDao.cs index 6476c4d2..11c71aee 100644 --- a/CDP4Orm/AutoGenDao/ParameterGroupDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterGroupDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -226,6 +222,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterGroup, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterGroup DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterGroup parameterGroup, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterGroup, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Name", !this.IsDerived(parameterGroup, "Name") ? parameterGroup.Name.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterGroup\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ContainingGroup\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :containingGroup)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterGroup.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("containingGroup", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterGroup, "ContainingGroup") ? Utils.NullableValue(parameterGroup.ContainingGroup) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ContainingGroup\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :containingGroup);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -308,5 +360,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterOrOverrideBaseDao.cs b/CDP4Orm/AutoGenDao/ParameterOrOverrideBaseDao.cs index 7d3696e4..bf295edd 100644 --- a/CDP4Orm/AutoGenDao/ParameterOrOverrideBaseDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterOrOverrideBaseDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -92,6 +88,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterOrOverrideBase, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterOrOverrideBase DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterOrOverrideBase parameterOrOverrideBase, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterOrOverrideBase, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterOrOverrideBase\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterOrOverrideBase.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -149,5 +191,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterOverrideDao.cs b/CDP4Orm/AutoGenDao/ParameterOverrideDao.cs index 98e2d4d0..2ec5c615 100644 --- a/CDP4Orm/AutoGenDao/ParameterOverrideDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterOverrideDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -217,6 +213,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterOverride, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterOverride DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterOverride parameterOverride, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterOverride, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterOverride\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Parameter\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :parameter)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterOverride.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("parameter", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterOverride, "Parameter") ? parameterOverride.Parameter : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Parameter\")"); + sqlBuilder.Append(" = (:container, :parameter);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -293,5 +339,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterOverrideValueSetDao.cs b/CDP4Orm/AutoGenDao/ParameterOverrideValueSetDao.cs index 50cd2854..cbe5d2a2 100644 --- a/CDP4Orm/AutoGenDao/ParameterOverrideValueSetDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterOverrideValueSetDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -250,6 +246,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterOverrideValueSet, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterOverrideValueSet DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterOverrideValueSet parameterOverrideValueSet, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterOverrideValueSet, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterOverrideValueSet\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"ParameterValueSet\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :parameterValueSet)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterOverrideValueSet.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("parameterValueSet", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterOverrideValueSet, "ParameterValueSet") ? parameterOverrideValueSet.ParameterValueSet : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"ParameterValueSet\")"); + sqlBuilder.Append(" = (:container, :parameterValueSet);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -326,5 +372,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterSubscriptionDao.cs b/CDP4Orm/AutoGenDao/ParameterSubscriptionDao.cs index e4f07e61..1d6bcf53 100644 --- a/CDP4Orm/AutoGenDao/ParameterSubscriptionDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterSubscriptionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -214,6 +210,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterSubscription, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterSubscription DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterSubscription parameterSubscription, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterSubscription, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterSubscription\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterSubscription.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -289,5 +334,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterSubscriptionValueSetDao.cs b/CDP4Orm/AutoGenDao/ParameterSubscriptionValueSetDao.cs index 89908a88..b679d149 100644 --- a/CDP4Orm/AutoGenDao/ParameterSubscriptionValueSetDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterSubscriptionValueSetDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -233,6 +229,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterSubscriptionValueSet, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterSubscriptionValueSet DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterSubscriptionValueSet parameterSubscriptionValueSet, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterSubscriptionValueSet, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Manual", !this.IsDerived(parameterSubscriptionValueSet, "Manual") ? parameterSubscriptionValueSet.Manual.ToHstoreString() : string.Empty }, + { "ValueSwitch", !this.IsDerived(parameterSubscriptionValueSet, "ValueSwitch") ? parameterSubscriptionValueSet.ValueSwitch.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterSubscriptionValueSet\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"SubscribedValueSet\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :subscribedValueSet)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterSubscriptionValueSet.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("subscribedValueSet", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterSubscriptionValueSet, "SubscribedValueSet") ? parameterSubscriptionValueSet.SubscribedValueSet : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"SubscribedValueSet\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :subscribedValueSet);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -316,5 +369,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterTypeComponentDao.cs b/CDP4Orm/AutoGenDao/ParameterTypeComponentDao.cs index 82e44d7b..69a3b0a6 100644 --- a/CDP4Orm/AutoGenDao/ParameterTypeComponentDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterTypeComponentDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -232,6 +228,67 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterTypeComponent, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterTypeComponent DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterTypeComponent parameterTypeComponent, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterTypeComponent, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ShortName", !this.IsDerived(parameterTypeComponent, "ShortName") ? parameterTypeComponent.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterTypeComponent\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\", \"ParameterType\", \"Scale\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container, :parameterType, :scale)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterTypeComponent.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterTypeComponent, "ParameterType") ? parameterTypeComponent.ParameterType : Utils.NullableValue(null); + command.Parameters.Add("scale", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterTypeComponent, "Scale") ? Utils.NullableValue(parameterTypeComponent.Scale) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ParameterType\", \"Scale\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :parameterType, :scale);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -354,5 +411,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterTypeDao.cs b/CDP4Orm/AutoGenDao/ParameterTypeDao.cs index cbf6dcf9..466f61c6 100644 --- a/CDP4Orm/AutoGenDao/ParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -101,6 +97,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterType parameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterType, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(parameterType, "IsDeprecated") ? parameterType.IsDeprecated.ToString() : string.Empty }, + { "Symbol", !this.IsDerived(parameterType, "Symbol") ? parameterType.Symbol.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterType.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + parameterType.Category.ForEach(x => this.UpsertCategory(transaction, partition, parameterType.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -181,6 +234,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterType_Category\"", partition); + sqlBuilder.AppendFormat(" (\"ParameterType\", \"Category\")"); + sqlBuilder.Append(" VALUES (:parameterType, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ParameterType_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ParameterType\", \"Category\")"); + sqlBuilder.Append(" = (:parameterType, :category);"); + + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -282,6 +378,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"ParameterType\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ParameterValueDao.cs b/CDP4Orm/AutoGenDao/ParameterValueDao.cs index 1e1c0a6e..2ec1c063 100644 --- a/CDP4Orm/AutoGenDao/ParameterValueDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterValueDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -100,6 +96,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterValue, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterValue DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterValue parameterValue, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterValue, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Value", !this.IsDerived(parameterValue, "Value") ? parameterValue.Value.ToHstoreString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterValue\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ParameterType\", \"Scale\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :parameterType, :scale)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterValue.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterValue, "ParameterType") ? parameterValue.ParameterType : Utils.NullableValue(null); + command.Parameters.Add("scale", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterValue, "Scale") ? Utils.NullableValue(parameterValue.Scale) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ParameterType\", \"Scale\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :parameterType, :scale);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -182,5 +234,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterValueSetBaseDao.cs b/CDP4Orm/AutoGenDao/ParameterValueSetBaseDao.cs index 1d86ecfa..1fbb71f0 100644 --- a/CDP4Orm/AutoGenDao/ParameterValueSetBaseDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterValueSetBaseDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -105,6 +101,67 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterValueSetBase, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterValueSetBase DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterValueSetBase parameterValueSetBase, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterValueSetBase, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Computed", !this.IsDerived(parameterValueSetBase, "Computed") ? parameterValueSetBase.Computed.ToHstoreString() : string.Empty }, + { "Formula", !this.IsDerived(parameterValueSetBase, "Formula") ? parameterValueSetBase.Formula.ToHstoreString() : string.Empty }, + { "Manual", !this.IsDerived(parameterValueSetBase, "Manual") ? parameterValueSetBase.Manual.ToHstoreString() : string.Empty }, + { "Published", !this.IsDerived(parameterValueSetBase, "Published") ? parameterValueSetBase.Published.ToHstoreString() : string.Empty }, + { "Reference", !this.IsDerived(parameterValueSetBase, "Reference") ? parameterValueSetBase.Reference.ToHstoreString() : string.Empty }, + { "ValueSwitch", !this.IsDerived(parameterValueSetBase, "ValueSwitch") ? parameterValueSetBase.ValueSwitch.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterValueSetBase\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ActualOption\", \"ActualState\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :actualOption, :actualState)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterValueSetBase.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("actualOption", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterValueSetBase, "ActualOption") ? Utils.NullableValue(parameterValueSetBase.ActualOption) : Utils.NullableValue(null); + command.Parameters.Add("actualState", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterValueSetBase, "ActualState") ? Utils.NullableValue(parameterValueSetBase.ActualState) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ActualOption\", \"ActualState\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :actualOption, :actualState);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -192,5 +249,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterValueSetDao.cs b/CDP4Orm/AutoGenDao/ParameterValueSetDao.cs index ff59bd8f..57b42723 100644 --- a/CDP4Orm/AutoGenDao/ParameterValueSetDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterValueSetDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -250,6 +246,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterValueSet, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterValueSet DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterValueSet parameterValueSet, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterValueSet, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterValueSet\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterValueSet.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -325,5 +370,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParameterizedCategoryRuleDao.cs b/CDP4Orm/AutoGenDao/ParameterizedCategoryRuleDao.cs index 28e0f297..1549cd69 100644 --- a/CDP4Orm/AutoGenDao/ParameterizedCategoryRuleDao.cs +++ b/CDP4Orm/AutoGenDao/ParameterizedCategoryRuleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -236,6 +232,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parameterizedCategoryRule, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parameterizedCategoryRule DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParameterizedCategoryRule parameterizedCategoryRule, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parameterizedCategoryRule, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterizedCategoryRule\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Category\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :category)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parameterizedCategoryRule.Iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = !this.IsDerived(parameterizedCategoryRule, "Category") ? parameterizedCategoryRule.Category : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Category\""); + sqlBuilder.Append(" = :category;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + parameterizedCategoryRule.ParameterType.ForEach(x => this.UpsertParameterType(transaction, partition, parameterizedCategoryRule.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -316,6 +362,49 @@ public bool AddParameterType(NpgsqlTransaction transaction, string partition, Gu } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertParameterType(NpgsqlTransaction transaction, string partition, Guid iid, Guid parameterType) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParameterizedCategoryRule_ParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"ParameterizedCategoryRule\", \"ParameterType\")"); + sqlBuilder.Append(" VALUES (:parameterizedCategoryRule, :parameterType)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ParameterizedCategoryRule_ParameterType_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ParameterizedCategoryRule\", \"ParameterType\")"); + sqlBuilder.Append(" = (:parameterizedCategoryRule, :parameterType);"); + + command.Parameters.Add("parameterizedCategoryRule", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = parameterType; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -392,6 +481,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ParametricConstraintDao.cs b/CDP4Orm/AutoGenDao/ParametricConstraintDao.cs index 7f709dde..ed8be1b6 100644 --- a/CDP4Orm/AutoGenDao/ParametricConstraintDao.cs +++ b/CDP4Orm/AutoGenDao/ParametricConstraintDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -219,6 +215,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, parametricConstraint, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The parametricConstraint DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParametricConstraint parametricConstraint, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, parametricConstraint, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParametricConstraint\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Sequence\", \"Container\", \"TopExpression\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :sequence, :container, :topExpression)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = parametricConstraint.Iid; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("topExpression", NpgsqlDbType.Uuid).Value = !this.IsDerived(parametricConstraint, "TopExpression") ? Utils.NullableValue(parametricConstraint.TopExpression) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"TopExpression\")"); + sqlBuilder.Append(" = (:container, :topExpression);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -334,5 +384,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParticipantDao.cs b/CDP4Orm/AutoGenDao/ParticipantDao.cs index d2f9aa05..850a4d9c 100644 --- a/CDP4Orm/AutoGenDao/ParticipantDao.cs +++ b/CDP4Orm/AutoGenDao/ParticipantDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -232,6 +228,65 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, participant, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The participant DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Participant participant, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, participant, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsActive", !this.IsDerived(participant, "IsActive") ? participant.IsActive.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Participant\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Person\", \"Role\", \"SelectedDomain\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :person, :role, :selectedDomain)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = participant.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("person", NpgsqlDbType.Uuid).Value = !this.IsDerived(participant, "Person") ? participant.Person : Utils.NullableValue(null); + command.Parameters.Add("role", NpgsqlDbType.Uuid).Value = !this.IsDerived(participant, "Role") ? participant.Role : Utils.NullableValue(null); + command.Parameters.Add("selectedDomain", NpgsqlDbType.Uuid).Value = !this.IsDerived(participant, "SelectedDomain") ? participant.SelectedDomain : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Person\", \"Role\", \"SelectedDomain\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :person, :role, :selectedDomain);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + participant.Domain.ForEach(x => this.UpsertDomain(transaction, partition, participant.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -312,6 +367,49 @@ public bool AddDomain(NpgsqlTransaction transaction, string partition, Guid iid, } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertDomain(NpgsqlTransaction transaction, string partition, Guid iid, Guid domain) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Participant_Domain\"", partition); + sqlBuilder.AppendFormat(" (\"Participant\", \"Domain\")"); + sqlBuilder.Append(" VALUES (:participant, :domain)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Participant_Domain_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Participant\", \"Domain\")"); + sqlBuilder.Append(" = (:participant, :domain);"); + + command.Parameters.Add("participant", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("domain", NpgsqlDbType.Uuid).Value = domain; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -397,6 +495,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ParticipantPermissionDao.cs b/CDP4Orm/AutoGenDao/ParticipantPermissionDao.cs index 7f943432..5fdee100 100644 --- a/CDP4Orm/AutoGenDao/ParticipantPermissionDao.cs +++ b/CDP4Orm/AutoGenDao/ParticipantPermissionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, participantPermission, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The participantPermission DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParticipantPermission participantPermission, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, participantPermission, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "AccessRight", !this.IsDerived(participantPermission, "AccessRight") ? participantPermission.AccessRight.ToString() : string.Empty }, + { "IsDeprecated", !this.IsDerived(participantPermission, "IsDeprecated") ? participantPermission.IsDeprecated.ToString() : string.Empty }, + { "ObjectClass", !this.IsDerived(participantPermission, "ObjectClass") ? participantPermission.ObjectClass.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParticipantPermission\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = participantPermission.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -339,5 +392,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"ParticipantPermission\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ParticipantRoleDao.cs b/CDP4Orm/AutoGenDao/ParticipantRoleDao.cs index 5418e80f..e4b02e1a 100644 --- a/CDP4Orm/AutoGenDao/ParticipantRoleDao.cs +++ b/CDP4Orm/AutoGenDao/ParticipantRoleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -240,6 +236,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, participantRole, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The participantRole DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ParticipantRole participantRole, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, participantRole, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(participantRole, "IsDeprecated") ? participantRole.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ParticipantRole\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = participantRole.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -339,5 +390,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"ParticipantRole\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PersonDao.cs b/CDP4Orm/AutoGenDao/PersonDao.cs index b0f2835c..8545c0fb 100644 --- a/CDP4Orm/AutoGenDao/PersonDao.cs +++ b/CDP4Orm/AutoGenDao/PersonDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -279,6 +275,72 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, person, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The person DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Person person, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, person, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "GivenName", !this.IsDerived(person, "GivenName") ? person.GivenName.Escape() : string.Empty }, + { "IsActive", !this.IsDerived(person, "IsActive") ? person.IsActive.ToString() : string.Empty }, + { "IsDeprecated", !this.IsDerived(person, "IsDeprecated") ? person.IsDeprecated.ToString() : string.Empty }, + { "OrganizationalUnit", !this.IsDerived(person, "OrganizationalUnit") ? person.OrganizationalUnit.Escape() : null }, + { "Password", !this.IsDerived(person, "Password") ? person.Password.Escape() : null }, + { "ShortName", !this.IsDerived(person, "ShortName") ? person.ShortName.Escape() : string.Empty }, + { "Surname", !this.IsDerived(person, "Surname") ? person.Surname.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Person\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"DefaultDomain\", \"DefaultEmailAddress\", \"DefaultTelephoneNumber\", \"Organization\", \"Role\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :defaultDomain, :defaultEmailAddress, :defaultTelephoneNumber, :organization, :role)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = person.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("defaultDomain", NpgsqlDbType.Uuid).Value = !this.IsDerived(person, "DefaultDomain") ? Utils.NullableValue(person.DefaultDomain) : Utils.NullableValue(null); + command.Parameters.Add("defaultEmailAddress", NpgsqlDbType.Uuid).Value = !this.IsDerived(person, "DefaultEmailAddress") ? Utils.NullableValue(person.DefaultEmailAddress) : Utils.NullableValue(null); + command.Parameters.Add("defaultTelephoneNumber", NpgsqlDbType.Uuid).Value = !this.IsDerived(person, "DefaultTelephoneNumber") ? Utils.NullableValue(person.DefaultTelephoneNumber) : Utils.NullableValue(null); + command.Parameters.Add("organization", NpgsqlDbType.Uuid).Value = !this.IsDerived(person, "Organization") ? Utils.NullableValue(person.Organization) : Utils.NullableValue(null); + command.Parameters.Add("role", NpgsqlDbType.Uuid).Value = !this.IsDerived(person, "Role") ? Utils.NullableValue(person.Role) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"DefaultDomain\", \"DefaultEmailAddress\", \"DefaultTelephoneNumber\", \"Organization\", \"Role\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :defaultDomain, :defaultEmailAddress, :defaultTelephoneNumber, :organization, :role);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -389,5 +451,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Person\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PersonPermissionDao.cs b/CDP4Orm/AutoGenDao/PersonPermissionDao.cs index 30842582..a8af613a 100644 --- a/CDP4Orm/AutoGenDao/PersonPermissionDao.cs +++ b/CDP4Orm/AutoGenDao/PersonPermissionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, personPermission, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The personPermission DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PersonPermission personPermission, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, personPermission, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "AccessRight", !this.IsDerived(personPermission, "AccessRight") ? personPermission.AccessRight.ToString() : string.Empty }, + { "IsDeprecated", !this.IsDerived(personPermission, "IsDeprecated") ? personPermission.IsDeprecated.ToString() : string.Empty }, + { "ObjectClass", !this.IsDerived(personPermission, "ObjectClass") ? personPermission.ObjectClass.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"PersonPermission\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = personPermission.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -339,5 +392,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"PersonPermission\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PersonRoleDao.cs b/CDP4Orm/AutoGenDao/PersonRoleDao.cs index ffb2383e..1e389af8 100644 --- a/CDP4Orm/AutoGenDao/PersonRoleDao.cs +++ b/CDP4Orm/AutoGenDao/PersonRoleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -240,6 +236,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, personRole, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The personRole DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PersonRole personRole, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, personRole, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(personRole, "IsDeprecated") ? personRole.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"PersonRole\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = personRole.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -339,5 +390,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"PersonRole\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PointDao.cs b/CDP4Orm/AutoGenDao/PointDao.cs index bd1e1fcf..217ec4a8 100644 --- a/CDP4Orm/AutoGenDao/PointDao.cs +++ b/CDP4Orm/AutoGenDao/PointDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -241,6 +237,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, point, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The point DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Point point, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, point, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "X", !this.IsDerived(point, "X") ? point.X.ToString() : string.Empty }, + { "Y", !this.IsDerived(point, "Y") ? point.Y.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Point\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = point.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -362,5 +418,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PossibleFiniteStateDao.cs b/CDP4Orm/AutoGenDao/PossibleFiniteStateDao.cs index ef03da21..e8b195fe 100644 --- a/CDP4Orm/AutoGenDao/PossibleFiniteStateDao.cs +++ b/CDP4Orm/AutoGenDao/PossibleFiniteStateDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -231,6 +227,59 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, possibleFiniteState, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The possibleFiniteState DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PossibleFiniteState possibleFiniteState, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, possibleFiniteState, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"PossibleFiniteState\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Sequence\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :sequence, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = possibleFiniteState.Iid; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -345,5 +394,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PossibleFiniteStateListDao.cs b/CDP4Orm/AutoGenDao/PossibleFiniteStateListDao.cs index f86e8e5c..7427b090 100644 --- a/CDP4Orm/AutoGenDao/PossibleFiniteStateListDao.cs +++ b/CDP4Orm/AutoGenDao/PossibleFiniteStateListDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -234,6 +230,58 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, possibleFiniteStateList, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The possibleFiniteStateList DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PossibleFiniteStateList possibleFiniteStateList, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, possibleFiniteStateList, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"PossibleFiniteStateList\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"DefaultState\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :defaultState, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = possibleFiniteStateList.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("defaultState", NpgsqlDbType.Uuid).Value = !this.IsDerived(possibleFiniteStateList, "DefaultState") ? Utils.NullableValue(possibleFiniteStateList.DefaultState) : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(possibleFiniteStateList, "Owner") ? possibleFiniteStateList.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"DefaultState\", \"Owner\")"); + sqlBuilder.Append(" = (:container, :defaultState, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + possibleFiniteStateList.Category.ForEach(x => this.UpsertCategory(transaction, partition, possibleFiniteStateList.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -314,6 +362,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"PossibleFiniteStateList_Category\"", partition); + sqlBuilder.AppendFormat(" (\"PossibleFiniteStateList\", \"Category\")"); + sqlBuilder.Append(" VALUES (:possibleFiniteStateList, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"PossibleFiniteStateList_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"PossibleFiniteStateList\", \"Category\")"); + sqlBuilder.Append(" = (:possibleFiniteStateList, :category);"); + + command.Parameters.Add("possibleFiniteStateList", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -392,6 +483,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/PrefixedUnitDao.cs b/CDP4Orm/AutoGenDao/PrefixedUnitDao.cs index c9b8514b..28fbde6b 100644 --- a/CDP4Orm/AutoGenDao/PrefixedUnitDao.cs +++ b/CDP4Orm/AutoGenDao/PrefixedUnitDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -223,6 +219,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, prefixedUnit, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The prefixedUnit DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.PrefixedUnit prefixedUnit, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, prefixedUnit, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"PrefixedUnit\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Prefix\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :prefix)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = prefixedUnit.Iid; + command.Parameters.Add("prefix", NpgsqlDbType.Uuid).Value = !this.IsDerived(prefixedUnit, "Prefix") ? prefixedUnit.Prefix : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Prefix\""); + sqlBuilder.Append(" = :prefix;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -298,5 +343,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/PublicationDao.cs b/CDP4Orm/AutoGenDao/PublicationDao.cs index 80bb7183..6e0ec45e 100644 --- a/CDP4Orm/AutoGenDao/PublicationDao.cs +++ b/CDP4Orm/AutoGenDao/PublicationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -228,6 +224,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, publication, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The publication DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Publication publication, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, publication, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(publication, "CreatedOn") ? publication.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Publication\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = publication.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + publication.Domain.ForEach(x => this.UpsertDomain(transaction, partition, publication.Iid, x)); + publication.PublishedParameter.ForEach(x => this.UpsertPublishedParameter(transaction, partition, publication.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -313,6 +366,49 @@ public bool AddDomain(NpgsqlTransaction transaction, string partition, Guid iid, return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertDomain(NpgsqlTransaction transaction, string partition, Guid iid, Guid domain) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Publication_Domain\"", partition); + sqlBuilder.AppendFormat(" (\"Publication\", \"Domain\")"); + sqlBuilder.Append(" VALUES (:publication, :domain)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Publication_Domain_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Publication\", \"Domain\")"); + sqlBuilder.Append(" = (:publication, :domain);"); + + command.Parameters.Add("publication", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("domain", NpgsqlDbType.Uuid).Value = domain; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -351,6 +447,49 @@ public bool AddPublishedParameter(NpgsqlTransaction transaction, string partitio } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertPublishedParameter(NpgsqlTransaction transaction, string partition, Guid iid, Guid publishedParameter) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Publication_PublishedParameter\"", partition); + sqlBuilder.AppendFormat(" (\"Publication\", \"PublishedParameter\")"); + sqlBuilder.Append(" VALUES (:publication, :publishedParameter)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Publication_PublishedParameter_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Publication\", \"PublishedParameter\")"); + sqlBuilder.Append(" = (:publication, :publishedParameter);"); + + command.Parameters.Add("publication", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("publishedParameter", NpgsqlDbType.Uuid).Value = publishedParameter; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -433,6 +572,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/QuantityKindDao.cs b/CDP4Orm/AutoGenDao/QuantityKindDao.cs index fbbeb056..6c4b2de8 100644 --- a/CDP4Orm/AutoGenDao/QuantityKindDao.cs +++ b/CDP4Orm/AutoGenDao/QuantityKindDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -100,6 +96,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, quantityKind, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The quantityKind DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.QuantityKind quantityKind, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, quantityKind, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "QuantityDimensionSymbol", !this.IsDerived(quantityKind, "QuantityDimensionSymbol") ? quantityKind.QuantityDimensionSymbol.Escape() : null }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"QuantityKind\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"DefaultScale\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :defaultScale)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = quantityKind.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("defaultScale", NpgsqlDbType.Uuid).Value = !this.IsDerived(quantityKind, "DefaultScale") ? quantityKind.DefaultScale : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"DefaultScale\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :defaultScale);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + quantityKind.PossibleScale.ForEach(x => this.UpsertPossibleScale(transaction, partition, quantityKind.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -180,6 +232,49 @@ public bool AddPossibleScale(NpgsqlTransaction transaction, string partition, Gu } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertPossibleScale(NpgsqlTransaction transaction, string partition, Guid iid, Guid possibleScale) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"QuantityKind_PossibleScale\"", partition); + sqlBuilder.AppendFormat(" (\"QuantityKind\", \"PossibleScale\")"); + sqlBuilder.Append(" VALUES (:quantityKind, :possibleScale)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"QuantityKind_PossibleScale_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"QuantityKind\", \"PossibleScale\")"); + sqlBuilder.Append(" = (:quantityKind, :possibleScale);"); + + command.Parameters.Add("quantityKind", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("possibleScale", NpgsqlDbType.Uuid).Value = possibleScale; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -262,6 +357,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/QuantityKindFactorDao.cs b/CDP4Orm/AutoGenDao/QuantityKindFactorDao.cs index c870ba99..ceffb32c 100644 --- a/CDP4Orm/AutoGenDao/QuantityKindFactorDao.cs +++ b/CDP4Orm/AutoGenDao/QuantityKindFactorDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -230,6 +226,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, quantityKindFactor, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The quantityKindFactor DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.QuantityKindFactor quantityKindFactor, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, quantityKindFactor, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Exponent", !this.IsDerived(quantityKindFactor, "Exponent") ? quantityKindFactor.Exponent.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"QuantityKindFactor\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\", \"QuantityKind\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container, :quantityKind)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = quantityKindFactor.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("quantityKind", NpgsqlDbType.Uuid).Value = !this.IsDerived(quantityKindFactor, "QuantityKind") ? quantityKindFactor.QuantityKind : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"QuantityKind\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :quantityKind);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,5 +407,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RatioScaleDao.cs b/CDP4Orm/AutoGenDao/RatioScaleDao.cs index 6f7403d7..a9b1e0d5 100644 --- a/CDP4Orm/AutoGenDao/RatioScaleDao.cs +++ b/CDP4Orm/AutoGenDao/RatioScaleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -278,6 +274,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, ratioScale, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The ratioScale DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RatioScale ratioScale, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, ratioScale, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RatioScale\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = ratioScale.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -335,5 +377,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ReferenceDataLibraryDao.cs b/CDP4Orm/AutoGenDao/ReferenceDataLibraryDao.cs index 2fcf52e7..9f2e304c 100644 --- a/CDP4Orm/AutoGenDao/ReferenceDataLibraryDao.cs +++ b/CDP4Orm/AutoGenDao/ReferenceDataLibraryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -95,6 +91,57 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, referenceDataLibrary, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The referenceDataLibrary DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReferenceDataLibrary referenceDataLibrary, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, referenceDataLibrary, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReferenceDataLibrary\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"RequiredRdl\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :requiredRdl)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = referenceDataLibrary.Iid; + command.Parameters.Add("requiredRdl", NpgsqlDbType.Uuid).Value = !this.IsDerived(referenceDataLibrary, "RequiredRdl") ? Utils.NullableValue(referenceDataLibrary.RequiredRdl) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"RequiredRdl\""); + sqlBuilder.Append(" = :requiredRdl;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + referenceDataLibrary.BaseQuantityKind.ForEach(x => this.UpsertBaseQuantityKind(transaction, partition, referenceDataLibrary.Iid, x)); + referenceDataLibrary.BaseUnit.ForEach(x => this.UpsertBaseUnit(transaction, partition, referenceDataLibrary.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -181,6 +228,50 @@ public bool AddBaseQuantityKind(NpgsqlTransaction transaction, string partition, return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertBaseQuantityKind(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem baseQuantityKind) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReferenceDataLibrary_BaseQuantityKind\"", partition); + sqlBuilder.AppendFormat(" (\"ReferenceDataLibrary\", \"BaseQuantityKind\", \"Sequence\")"); + sqlBuilder.Append(" VALUES (:referenceDataLibrary, :baseQuantityKind, :sequence)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ReferenceDataLibrary_BaseQuantityKind_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.AppendFormat(" SET (\"ReferenceDataLibrary\", \"BaseQuantityKind\", \"Sequence\")"); + sqlBuilder.Append(" = (:referenceDataLibrary, :baseQuantityKind, :sequence);"); + + command.Parameters.Add("referenceDataLibrary", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("baseQuantityKind", NpgsqlDbType.Uuid).Value = Guid.Parse(baseQuantityKind.V.ToString()); + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = baseQuantityKind.K; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -219,6 +310,49 @@ public bool AddBaseUnit(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertBaseUnit(NpgsqlTransaction transaction, string partition, Guid iid, Guid baseUnit) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReferenceDataLibrary_BaseUnit\"", partition); + sqlBuilder.AppendFormat(" (\"ReferenceDataLibrary\", \"BaseUnit\")"); + sqlBuilder.Append(" VALUES (:referenceDataLibrary, :baseUnit)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ReferenceDataLibrary_BaseUnit_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ReferenceDataLibrary\", \"BaseUnit\")"); + sqlBuilder.Append(" = (:referenceDataLibrary, :baseUnit);"); + + command.Parameters.Add("referenceDataLibrary", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("baseUnit", NpgsqlDbType.Uuid).Value = baseUnit; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -380,6 +514,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ReferenceSourceDao.cs b/CDP4Orm/AutoGenDao/ReferenceSourceDao.cs index d85a489b..2ee5ebf3 100644 --- a/CDP4Orm/AutoGenDao/ReferenceSourceDao.cs +++ b/CDP4Orm/AutoGenDao/ReferenceSourceDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -280,6 +276,69 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, referenceSource, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The referenceSource DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReferenceSource referenceSource, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, referenceSource, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Author", !this.IsDerived(referenceSource, "Author") ? referenceSource.Author.Escape() : null }, + { "IsDeprecated", !this.IsDerived(referenceSource, "IsDeprecated") ? referenceSource.IsDeprecated.ToString() : string.Empty }, + { "Language", !this.IsDerived(referenceSource, "Language") ? referenceSource.Language.Escape() : null }, + { "PublicationYear", !this.IsDerived(referenceSource, "PublicationYear") && referenceSource.PublicationYear.HasValue ? referenceSource.PublicationYear.Value.ToString() : null }, + { "VersionDate", !this.IsDerived(referenceSource, "VersionDate") && referenceSource.VersionDate.HasValue ? referenceSource.VersionDate.Value.ToString(Utils.DateTimeUtcSerializationFormat) : null }, + { "VersionIdentifier", !this.IsDerived(referenceSource, "VersionIdentifier") ? referenceSource.VersionIdentifier.Escape() : null }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReferenceSource\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"PublishedIn\", \"Publisher\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :publishedIn, :publisher)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = referenceSource.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("publishedIn", NpgsqlDbType.Uuid).Value = !this.IsDerived(referenceSource, "PublishedIn") ? Utils.NullableValue(referenceSource.PublishedIn) : Utils.NullableValue(null); + command.Parameters.Add("publisher", NpgsqlDbType.Uuid).Value = !this.IsDerived(referenceSource, "Publisher") ? Utils.NullableValue(referenceSource.Publisher) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"PublishedIn\", \"Publisher\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :publishedIn, :publisher);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + referenceSource.Category.ForEach(x => this.UpsertCategory(transaction, partition, referenceSource.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -360,6 +419,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReferenceSource_Category\"", partition); + sqlBuilder.AppendFormat(" (\"ReferenceSource\", \"Category\")"); + sqlBuilder.Append(" VALUES (:referenceSource, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ReferenceSource_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ReferenceSource\", \"Category\")"); + sqlBuilder.Append(" = (:referenceSource, :category);"); + + command.Parameters.Add("referenceSource", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -467,6 +569,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"ReferenceSource\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ReferencerRuleDao.cs b/CDP4Orm/AutoGenDao/ReferencerRuleDao.cs index 0b139b8e..3e4c13ec 100644 --- a/CDP4Orm/AutoGenDao/ReferencerRuleDao.cs +++ b/CDP4Orm/AutoGenDao/ReferencerRuleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -255,6 +251,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, referencerRule, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The referencerRule DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReferencerRule referencerRule, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, referencerRule, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "MaxReferenced", !this.IsDerived(referencerRule, "MaxReferenced") ? referencerRule.MaxReferenced.ToString() : string.Empty }, + { "MinReferenced", !this.IsDerived(referencerRule, "MinReferenced") ? referencerRule.MinReferenced.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReferencerRule\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ReferencingCategory\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :referencingCategory)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = referencerRule.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("referencingCategory", NpgsqlDbType.Uuid).Value = !this.IsDerived(referencerRule, "ReferencingCategory") ? referencerRule.ReferencingCategory : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ReferencingCategory\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :referencingCategory);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + referencerRule.ReferencedCategory.ForEach(x => this.UpsertReferencedCategory(transaction, partition, referencerRule.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -335,6 +388,49 @@ public bool AddReferencedCategory(NpgsqlTransaction transaction, string partitio } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertReferencedCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid referencedCategory) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReferencerRule_ReferencedCategory\"", partition); + sqlBuilder.AppendFormat(" (\"ReferencerRule\", \"ReferencedCategory\")"); + sqlBuilder.Append(" VALUES (:referencerRule, :referencedCategory)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ReferencerRule_ReferencedCategory_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ReferencerRule\", \"ReferencedCategory\")"); + sqlBuilder.Append(" = (:referencerRule, :referencedCategory);"); + + command.Parameters.Add("referencerRule", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("referencedCategory", NpgsqlDbType.Uuid).Value = referencedCategory; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -418,6 +514,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/RelationalExpressionDao.cs b/CDP4Orm/AutoGenDao/RelationalExpressionDao.cs index 21e67a20..4223b7e8 100644 --- a/CDP4Orm/AutoGenDao/RelationalExpressionDao.cs +++ b/CDP4Orm/AutoGenDao/RelationalExpressionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -234,6 +230,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, relationalExpression, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The relationalExpression DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RelationalExpression relationalExpression, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, relationalExpression, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "RelationalOperator", !this.IsDerived(relationalExpression, "RelationalOperator") ? relationalExpression.RelationalOperator.ToString() : string.Empty }, + { "Value", !this.IsDerived(relationalExpression, "Value") ? relationalExpression.Value.ToHstoreString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RelationalExpression\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ParameterType\", \"Scale\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :parameterType, :scale)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = relationalExpression.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(relationalExpression, "ParameterType") ? relationalExpression.ParameterType : Utils.NullableValue(null); + command.Parameters.Add("scale", NpgsqlDbType.Uuid).Value = !this.IsDerived(relationalExpression, "Scale") ? Utils.NullableValue(relationalExpression.Scale) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ParameterType\", \"Scale\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :parameterType, :scale);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -317,5 +370,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RelationshipDao.cs b/CDP4Orm/AutoGenDao/RelationshipDao.cs index dd6d2c53..80660795 100644 --- a/CDP4Orm/AutoGenDao/RelationshipDao.cs +++ b/CDP4Orm/AutoGenDao/RelationshipDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -101,6 +97,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, relationship, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The relationship DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Relationship relationship, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, relationship, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Name", !this.IsDerived(relationship, "Name") ? relationship.Name.Escape() : null }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Relationship\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = relationship.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(relationship, "Owner") ? relationship.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + relationship.Category.ForEach(x => this.UpsertCategory(transaction, partition, relationship.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -181,6 +234,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Relationship_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Relationship\", \"Category\")"); + sqlBuilder.Append(" VALUES (:relationship, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Relationship_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Relationship\", \"Category\")"); + sqlBuilder.Append(" = (:relationship, :category);"); + + command.Parameters.Add("relationship", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -264,6 +360,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/RelationshipParameterValueDao.cs b/CDP4Orm/AutoGenDao/RelationshipParameterValueDao.cs index 23e0fd65..4642fc42 100644 --- a/CDP4Orm/AutoGenDao/RelationshipParameterValueDao.cs +++ b/CDP4Orm/AutoGenDao/RelationshipParameterValueDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -220,6 +216,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, relationshipParameterValue, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The relationshipParameterValue DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RelationshipParameterValue relationshipParameterValue, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, relationshipParameterValue, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RelationshipParameterValue\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = relationshipParameterValue.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -295,5 +340,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RequestForDeviationDao.cs b/CDP4Orm/AutoGenDao/RequestForDeviationDao.cs index 5c533507..33fcdcb9 100644 --- a/CDP4Orm/AutoGenDao/RequestForDeviationDao.cs +++ b/CDP4Orm/AutoGenDao/RequestForDeviationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -261,6 +257,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, requestForDeviation, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The requestForDeviation DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequestForDeviation requestForDeviation, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, requestForDeviation, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RequestForDeviation\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = requestForDeviation.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -318,5 +360,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RequestForWaiverDao.cs b/CDP4Orm/AutoGenDao/RequestForWaiverDao.cs index 58473d48..3718c163 100644 --- a/CDP4Orm/AutoGenDao/RequestForWaiverDao.cs +++ b/CDP4Orm/AutoGenDao/RequestForWaiverDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -261,6 +257,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, requestForWaiver, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The requestForWaiver DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequestForWaiver requestForWaiver, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, requestForWaiver, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RequestForWaiver\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = requestForWaiver.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -318,5 +360,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RequirementDao.cs b/CDP4Orm/AutoGenDao/RequirementDao.cs index 30e3dccb..5cec5d8d 100644 --- a/CDP4Orm/AutoGenDao/RequirementDao.cs +++ b/CDP4Orm/AutoGenDao/RequirementDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -246,6 +242,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, requirement, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The requirement DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Requirement requirement, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, requirement, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(requirement, "IsDeprecated") ? requirement.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Requirement\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Group\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :group)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = requirement.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("group", NpgsqlDbType.Uuid).Value = !this.IsDerived(requirement, "Group") ? Utils.NullableValue(requirement.Group) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Group\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :group);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + requirement.Category.ForEach(x => this.UpsertCategory(transaction, partition, requirement.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -326,6 +379,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Requirement_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Requirement\", \"Category\")"); + sqlBuilder.Append(" VALUES (:requirement, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Requirement_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Requirement\", \"Category\")"); + sqlBuilder.Append(" = (:requirement, :category);"); + + command.Parameters.Add("requirement", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -427,6 +523,50 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Requirement\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/RequirementsContainerDao.cs b/CDP4Orm/AutoGenDao/RequirementsContainerDao.cs index 24d8e74b..3f4cd296 100644 --- a/CDP4Orm/AutoGenDao/RequirementsContainerDao.cs +++ b/CDP4Orm/AutoGenDao/RequirementsContainerDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -94,6 +90,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, requirementsContainer, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The requirementsContainer DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsContainer requirementsContainer, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, requirementsContainer, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RequirementsContainer\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = requirementsContainer.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(requirementsContainer, "Owner") ? requirementsContainer.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Owner\""); + sqlBuilder.Append(" = :owner;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + requirementsContainer.Category.ForEach(x => this.UpsertCategory(transaction, partition, requirementsContainer.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -174,6 +220,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RequirementsContainer_Category\"", partition); + sqlBuilder.AppendFormat(" (\"RequirementsContainer\", \"Category\")"); + sqlBuilder.Append(" VALUES (:requirementsContainer, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"RequirementsContainer_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"RequirementsContainer\", \"Category\")"); + sqlBuilder.Append(" = (:requirementsContainer, :category);"); + + command.Parameters.Add("requirementsContainer", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -250,6 +339,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/RequirementsContainerParameterValueDao.cs b/CDP4Orm/AutoGenDao/RequirementsContainerParameterValueDao.cs index 88fbfd32..e68d747d 100644 --- a/CDP4Orm/AutoGenDao/RequirementsContainerParameterValueDao.cs +++ b/CDP4Orm/AutoGenDao/RequirementsContainerParameterValueDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -220,6 +216,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, requirementsContainerParameterValue, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The requirementsContainerParameterValue DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsContainerParameterValue requirementsContainerParameterValue, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, requirementsContainerParameterValue, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RequirementsContainerParameterValue\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = requirementsContainerParameterValue.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -295,5 +340,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RequirementsGroupDao.cs b/CDP4Orm/AutoGenDao/RequirementsGroupDao.cs index b88129d1..76e3a18b 100644 --- a/CDP4Orm/AutoGenDao/RequirementsGroupDao.cs +++ b/CDP4Orm/AutoGenDao/RequirementsGroupDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -231,6 +227,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, requirementsGroup, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The requirementsGroup DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsGroup requirementsGroup, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, requirementsGroup, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RequirementsGroup\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = requirementsGroup.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -306,5 +351,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RequirementsSpecificationDao.cs b/CDP4Orm/AutoGenDao/RequirementsSpecificationDao.cs index 43a6a63d..e4e1fcb9 100644 --- a/CDP4Orm/AutoGenDao/RequirementsSpecificationDao.cs +++ b/CDP4Orm/AutoGenDao/RequirementsSpecificationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -244,6 +240,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, requirementsSpecification, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The requirementsSpecification DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RequirementsSpecification requirementsSpecification, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, requirementsSpecification, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(requirementsSpecification, "IsDeprecated") ? requirementsSpecification.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RequirementsSpecification\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = requirementsSpecification.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -343,5 +394,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"RequirementsSpecification\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ReviewItemDiscrepancyDao.cs b/CDP4Orm/AutoGenDao/ReviewItemDiscrepancyDao.cs index e45dcd35..24b3d702 100644 --- a/CDP4Orm/AutoGenDao/ReviewItemDiscrepancyDao.cs +++ b/CDP4Orm/AutoGenDao/ReviewItemDiscrepancyDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -262,6 +258,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, reviewItemDiscrepancy, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The reviewItemDiscrepancy DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ReviewItemDiscrepancy reviewItemDiscrepancy, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, reviewItemDiscrepancy, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ReviewItemDiscrepancy\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = reviewItemDiscrepancy.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -319,5 +361,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RuleDao.cs b/CDP4Orm/AutoGenDao/RuleDao.cs index fcb5af13..7deb3989 100644 --- a/CDP4Orm/AutoGenDao/RuleDao.cs +++ b/CDP4Orm/AutoGenDao/RuleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -99,6 +95,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, rule, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The rule DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Rule rule, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, rule, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(rule, "IsDeprecated") ? rule.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Rule\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = rule.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -198,5 +249,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Rule\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RuleVerificationDao.cs b/CDP4Orm/AutoGenDao/RuleVerificationDao.cs index 62aebf2b..4c406f69 100644 --- a/CDP4Orm/AutoGenDao/RuleVerificationDao.cs +++ b/CDP4Orm/AutoGenDao/RuleVerificationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -106,6 +102,68 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, ruleVerification, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The ruleVerification DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RuleVerification ruleVerification, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, ruleVerification, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ExecutedOn", !this.IsDerived(ruleVerification, "ExecutedOn") && ruleVerification.ExecutedOn.HasValue ? ruleVerification.ExecutedOn.Value.ToString(Utils.DateTimeUtcSerializationFormat) : null }, + { "IsActive", !this.IsDerived(ruleVerification, "IsActive") ? ruleVerification.IsActive.ToString() : string.Empty }, + { "Name", !this.IsDerived(ruleVerification, "Name") ? ruleVerification.Name.Escape() : string.Empty }, + { "Status", !this.IsDerived(ruleVerification, "Status") ? ruleVerification.Status.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RuleVerification\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = ruleVerification.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -229,5 +287,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RuleVerificationListDao.cs b/CDP4Orm/AutoGenDao/RuleVerificationListDao.cs index f3e98c17..30ade618 100644 --- a/CDP4Orm/AutoGenDao/RuleVerificationListDao.cs +++ b/CDP4Orm/AutoGenDao/RuleVerificationListDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -230,6 +226,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, ruleVerificationList, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The ruleVerificationList DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RuleVerificationList ruleVerificationList, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, ruleVerificationList, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RuleVerificationList\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = ruleVerificationList.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(ruleVerificationList, "Owner") ? ruleVerificationList.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -306,5 +352,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/RuleViolationDao.cs b/CDP4Orm/AutoGenDao/RuleViolationDao.cs index 06e70a4f..af0324eb 100644 --- a/CDP4Orm/AutoGenDao/RuleViolationDao.cs +++ b/CDP4Orm/AutoGenDao/RuleViolationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -228,6 +224,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, ruleViolation, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The ruleViolation DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.RuleViolation ruleViolation, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, ruleViolation, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Description", !this.IsDerived(ruleViolation, "Description") ? ruleViolation.Description.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RuleViolation\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = ruleViolation.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + ruleViolation.ViolatingThing.ForEach(x => this.UpsertViolatingThing(transaction, partition, ruleViolation.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -308,6 +361,45 @@ public bool AddViolatingThing(NpgsqlTransaction transaction, string partition, G } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertViolatingThing(NpgsqlTransaction transaction, string partition, Guid iid, Guid violatingThing) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"RuleViolation_ViolatingThing\"", partition); + sqlBuilder.AppendFormat(" (\"RuleViolation\", \"ViolatingThing\")"); + sqlBuilder.Append(" VALUES (:ruleViolation, :violatingThing)"); + + command.Parameters.Add("ruleViolation", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("violatingThing", NpgsqlDbType.Uuid).Value = violatingThing; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -390,6 +482,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/SampledFunctionParameterTypeDao.cs b/CDP4Orm/AutoGenDao/SampledFunctionParameterTypeDao.cs index d63d1835..b15e0a8a 100644 --- a/CDP4Orm/AutoGenDao/SampledFunctionParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/SampledFunctionParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -260,6 +256,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, sampledFunctionParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The sampledFunctionParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SampledFunctionParameterType sampledFunctionParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, sampledFunctionParameterType, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "DegreeOfInterpolation", !this.IsDerived(sampledFunctionParameterType, "DegreeOfInterpolation") && sampledFunctionParameterType.DegreeOfInterpolation.HasValue ? sampledFunctionParameterType.DegreeOfInterpolation.Value.ToString() : null }, + { "InterpolationPeriod", !this.IsDerived(sampledFunctionParameterType, "InterpolationPeriod") ? sampledFunctionParameterType.InterpolationPeriod.ToHstoreString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SampledFunctionParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = sampledFunctionParameterType.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -341,5 +392,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ScalarParameterTypeDao.cs b/CDP4Orm/AutoGenDao/ScalarParameterTypeDao.cs index 6b09bc39..03320462 100644 --- a/CDP4Orm/AutoGenDao/ScalarParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/ScalarParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -92,6 +88,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, scalarParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The scalarParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ScalarParameterType scalarParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, scalarParameterType, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ScalarParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = scalarParameterType.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -149,5 +191,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ScaleReferenceQuantityValueDao.cs b/CDP4Orm/AutoGenDao/ScaleReferenceQuantityValueDao.cs index ca949713..fdc9d917 100644 --- a/CDP4Orm/AutoGenDao/ScaleReferenceQuantityValueDao.cs +++ b/CDP4Orm/AutoGenDao/ScaleReferenceQuantityValueDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -226,6 +222,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, scaleReferenceQuantityValue, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The scaleReferenceQuantityValue DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ScaleReferenceQuantityValue scaleReferenceQuantityValue, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, scaleReferenceQuantityValue, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Value", !this.IsDerived(scaleReferenceQuantityValue, "Value") ? scaleReferenceQuantityValue.Value.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ScaleReferenceQuantityValue\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Scale\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :scale)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = scaleReferenceQuantityValue.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("scale", NpgsqlDbType.Uuid).Value = !this.IsDerived(scaleReferenceQuantityValue, "Scale") ? scaleReferenceQuantityValue.Scale : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Scale\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :scale);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -308,5 +360,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ScaleValueDefinitionDao.cs b/CDP4Orm/AutoGenDao/ScaleValueDefinitionDao.cs index 2ca245b2..c8d33eb0 100644 --- a/CDP4Orm/AutoGenDao/ScaleValueDefinitionDao.cs +++ b/CDP4Orm/AutoGenDao/ScaleValueDefinitionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, scaleValueDefinition, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The scaleValueDefinition DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ScaleValueDefinition scaleValueDefinition, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, scaleValueDefinition, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Value", !this.IsDerived(scaleValueDefinition, "Value") ? scaleValueDefinition.Value.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ScaleValueDefinition\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = scaleValueDefinition.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -320,5 +371,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SectionDao.cs b/CDP4Orm/AutoGenDao/SectionDao.cs index 48d1591f..87c4fb4a 100644 --- a/CDP4Orm/AutoGenDao/SectionDao.cs +++ b/CDP4Orm/AutoGenDao/SectionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -247,6 +243,69 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, section, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The section DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Section section, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, section, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(section, "CreatedOn") ? section.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(section, "Name") ? section.Name.Escape() : string.Empty }, + { "ShortName", !this.IsDerived(section, "ShortName") ? section.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Section\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = section.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(section, "Owner") ? section.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Owner\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + section.Category.ForEach(x => this.UpsertCategory(transaction, partition, section.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -327,6 +386,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Section_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Section\", \"Category\")"); + sqlBuilder.Append(" VALUES (:section, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Section_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Section\", \"Category\")"); + sqlBuilder.Append(" = (:section, :category);"); + + command.Parameters.Add("section", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -451,6 +553,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/SharedStyleDao.cs b/CDP4Orm/AutoGenDao/SharedStyleDao.cs index 6668242d..482b09d9 100644 --- a/CDP4Orm/AutoGenDao/SharedStyleDao.cs +++ b/CDP4Orm/AutoGenDao/SharedStyleDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -276,6 +272,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, sharedStyle, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The sharedStyle DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SharedStyle sharedStyle, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, sharedStyle, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SharedStyle\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = sharedStyle.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,5 +396,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SimpleParameterValueDao.cs b/CDP4Orm/AutoGenDao/SimpleParameterValueDao.cs index 3f85fd26..80c1d2b2 100644 --- a/CDP4Orm/AutoGenDao/SimpleParameterValueDao.cs +++ b/CDP4Orm/AutoGenDao/SimpleParameterValueDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -228,6 +224,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, simpleParameterValue, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The simpleParameterValue DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleParameterValue simpleParameterValue, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, simpleParameterValue, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Value", !this.IsDerived(simpleParameterValue, "Value") ? simpleParameterValue.Value.ToHstoreString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SimpleParameterValue\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"ParameterType\", \"Scale\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :parameterType, :scale)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = simpleParameterValue.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("parameterType", NpgsqlDbType.Uuid).Value = !this.IsDerived(simpleParameterValue, "ParameterType") ? simpleParameterValue.ParameterType : Utils.NullableValue(null); + command.Parameters.Add("scale", NpgsqlDbType.Uuid).Value = !this.IsDerived(simpleParameterValue, "Scale") ? Utils.NullableValue(simpleParameterValue.Scale) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"ParameterType\", \"Scale\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :parameterType, :scale);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -311,5 +364,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SimpleParameterizableThingDao.cs b/CDP4Orm/AutoGenDao/SimpleParameterizableThingDao.cs index e16bb057..3acbb0b2 100644 --- a/CDP4Orm/AutoGenDao/SimpleParameterizableThingDao.cs +++ b/CDP4Orm/AutoGenDao/SimpleParameterizableThingDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -93,6 +89,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, simpleParameterizableThing, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The simpleParameterizableThing DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleParameterizableThing simpleParameterizableThing, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, simpleParameterizableThing, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SimpleParameterizableThing\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = simpleParameterizableThing.Iid; + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(simpleParameterizableThing, "Owner") ? simpleParameterizableThing.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Owner\""); + sqlBuilder.Append(" = :owner;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -168,5 +213,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SimpleQuantityKindDao.cs b/CDP4Orm/AutoGenDao/SimpleQuantityKindDao.cs index ed3e4dbb..6efa4daf 100644 --- a/CDP4Orm/AutoGenDao/SimpleQuantityKindDao.cs +++ b/CDP4Orm/AutoGenDao/SimpleQuantityKindDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -247,6 +243,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, simpleQuantityKind, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The simpleQuantityKind DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleQuantityKind simpleQuantityKind, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, simpleQuantityKind, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SimpleQuantityKind\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = simpleQuantityKind.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -304,5 +346,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SimpleUnitDao.cs b/CDP4Orm/AutoGenDao/SimpleUnitDao.cs index 0a5b9016..3c657495 100644 --- a/CDP4Orm/AutoGenDao/SimpleUnitDao.cs +++ b/CDP4Orm/AutoGenDao/SimpleUnitDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -232,6 +228,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, simpleUnit, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The simpleUnit DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SimpleUnit simpleUnit, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, simpleUnit, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SimpleUnit\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = simpleUnit.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -289,5 +331,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SiteDirectoryDao.cs b/CDP4Orm/AutoGenDao/SiteDirectoryDao.cs index ac641379..9143a062 100644 --- a/CDP4Orm/AutoGenDao/SiteDirectoryDao.cs +++ b/CDP4Orm/AutoGenDao/SiteDirectoryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -258,6 +254,64 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, siteDirectory, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The siteDirectory DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectory siteDirectory, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, siteDirectory, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "CreatedOn", !this.IsDerived(siteDirectory, "CreatedOn") ? siteDirectory.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "Name", !this.IsDerived(siteDirectory, "Name") ? siteDirectory.Name.Escape() : string.Empty }, + { "ShortName", !this.IsDerived(siteDirectory, "ShortName") ? siteDirectory.ShortName.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteDirectory\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"DefaultParticipantRole\", \"DefaultPersonRole\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :defaultParticipantRole, :defaultPersonRole)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = siteDirectory.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("defaultParticipantRole", NpgsqlDbType.Uuid).Value = !this.IsDerived(siteDirectory, "DefaultParticipantRole") ? Utils.NullableValue(siteDirectory.DefaultParticipantRole) : Utils.NullableValue(null); + command.Parameters.Add("defaultPersonRole", NpgsqlDbType.Uuid).Value = !this.IsDerived(siteDirectory, "DefaultPersonRole") ? Utils.NullableValue(siteDirectory.DefaultPersonRole) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"DefaultParticipantRole\", \"DefaultPersonRole\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :defaultParticipantRole, :defaultPersonRole);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -342,5 +396,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SiteDirectoryDataAnnotationDao.cs b/CDP4Orm/AutoGenDao/SiteDirectoryDataAnnotationDao.cs index bf19f285..ec46b890 100644 --- a/CDP4Orm/AutoGenDao/SiteDirectoryDataAnnotationDao.cs +++ b/CDP4Orm/AutoGenDao/SiteDirectoryDataAnnotationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -236,6 +232,57 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, siteDirectoryDataAnnotation, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The siteDirectoryDataAnnotation DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryDataAnnotation siteDirectoryDataAnnotation, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, siteDirectoryDataAnnotation, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteDirectoryDataAnnotation\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Author\", \"PrimaryAnnotatedThing\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :author, :primaryAnnotatedThing)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = siteDirectoryDataAnnotation.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(siteDirectoryDataAnnotation, "Author") ? siteDirectoryDataAnnotation.Author : Utils.NullableValue(null); + command.Parameters.Add("primaryAnnotatedThing", NpgsqlDbType.Uuid).Value = !this.IsDerived(siteDirectoryDataAnnotation, "PrimaryAnnotatedThing") ? siteDirectoryDataAnnotation.PrimaryAnnotatedThing : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Author\", \"PrimaryAnnotatedThing\")"); + sqlBuilder.Append(" = (:container, :author, :primaryAnnotatedThing);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -313,5 +360,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SiteDirectoryDataDiscussionItemDao.cs b/CDP4Orm/AutoGenDao/SiteDirectoryDataDiscussionItemDao.cs index f5de60dd..af97eb79 100644 --- a/CDP4Orm/AutoGenDao/SiteDirectoryDataDiscussionItemDao.cs +++ b/CDP4Orm/AutoGenDao/SiteDirectoryDataDiscussionItemDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -233,6 +229,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, siteDirectoryDataDiscussionItem, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The siteDirectoryDataDiscussionItem DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryDataDiscussionItem siteDirectoryDataDiscussionItem, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, siteDirectoryDataDiscussionItem, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteDirectoryDataDiscussionItem\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Author\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :author)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = siteDirectoryDataDiscussionItem.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(siteDirectoryDataDiscussionItem, "Author") ? siteDirectoryDataDiscussionItem.Author : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Author\")"); + sqlBuilder.Append(" = (:container, :author);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -309,5 +355,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SiteDirectoryThingReferenceDao.cs b/CDP4Orm/AutoGenDao/SiteDirectoryThingReferenceDao.cs index db486266..2a0b5dd7 100644 --- a/CDP4Orm/AutoGenDao/SiteDirectoryThingReferenceDao.cs +++ b/CDP4Orm/AutoGenDao/SiteDirectoryThingReferenceDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -219,6 +215,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, siteDirectoryThingReference, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The siteDirectoryThingReference DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteDirectoryThingReference siteDirectoryThingReference, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, siteDirectoryThingReference, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteDirectoryThingReference\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = siteDirectoryThingReference.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -294,5 +339,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SiteLogEntryDao.cs b/CDP4Orm/AutoGenDao/SiteLogEntryDao.cs index df6e5ae2..b38462f1 100644 --- a/CDP4Orm/AutoGenDao/SiteLogEntryDao.cs +++ b/CDP4Orm/AutoGenDao/SiteLogEntryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -258,6 +254,70 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, siteLogEntry, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The siteLogEntry DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteLogEntry siteLogEntry, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, siteLogEntry, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Content", !this.IsDerived(siteLogEntry, "Content") ? siteLogEntry.Content.Escape() : string.Empty }, + { "CreatedOn", !this.IsDerived(siteLogEntry, "CreatedOn") ? siteLogEntry.CreatedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "LanguageCode", !this.IsDerived(siteLogEntry, "LanguageCode") ? siteLogEntry.LanguageCode.Escape() : string.Empty }, + { "Level", !this.IsDerived(siteLogEntry, "Level") ? siteLogEntry.Level.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteLogEntry\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\", \"Author\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container, :author)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = siteLogEntry.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(siteLogEntry, "Author") ? Utils.NullableValue(siteLogEntry.Author) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Author\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :author);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + siteLogEntry.AffectedDomainIid.ForEach(x => this.UpsertAffectedDomainIid(transaction, partition, siteLogEntry.Iid, x)); + + siteLogEntry.AffectedItemIid.ForEach(x => this.UpsertAffectedItemIid(transaction, partition, siteLogEntry.Iid, x)); + siteLogEntry.Category.ForEach(x => this.UpsertCategory(transaction, partition, siteLogEntry.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -349,6 +409,45 @@ public bool AddAffectedDomainIid(NpgsqlTransaction transaction, string partition return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertAffectedDomainIid(NpgsqlTransaction transaction, string partition, Guid iid, Guid affectedDomainIid) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteLogEntry_AffectedDomainIid\"", partition); + sqlBuilder.AppendFormat(" (\"SiteLogEntry\", \"AffectedDomainIid\")"); + sqlBuilder.Append(" VALUES (:siteLogEntry, :affectedDomainIid)"); + + command.Parameters.Add("siteLogEntry", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("affectedDomainIid", NpgsqlDbType.Uuid).Value = affectedDomainIid; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -387,6 +486,45 @@ public bool AddAffectedItemIid(NpgsqlTransaction transaction, string partition, } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertAffectedItemIid(NpgsqlTransaction transaction, string partition, Guid iid, Guid affectedItemIid) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteLogEntry_AffectedItemIid\"", partition); + sqlBuilder.AppendFormat(" (\"SiteLogEntry\", \"AffectedItemIid\")"); + sqlBuilder.Append(" VALUES (:siteLogEntry, :affectedItemIid)"); + + command.Parameters.Add("siteLogEntry", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("affectedItemIid", NpgsqlDbType.Uuid).Value = affectedItemIid; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Insert a new association record in the link table. /// @@ -425,6 +563,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteLogEntry_Category\"", partition); + sqlBuilder.AppendFormat(" (\"SiteLogEntry\", \"Category\")"); + sqlBuilder.Append(" VALUES (:siteLogEntry, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"SiteLogEntry_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"SiteLogEntry\", \"Category\")"); + sqlBuilder.Append(" = (:siteLogEntry, :category);"); + + command.Parameters.Add("siteLogEntry", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -511,6 +692,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/SiteReferenceDataLibraryDao.cs b/CDP4Orm/AutoGenDao/SiteReferenceDataLibraryDao.cs index 49e21025..6096ef46 100644 --- a/CDP4Orm/AutoGenDao/SiteReferenceDataLibraryDao.cs +++ b/CDP4Orm/AutoGenDao/SiteReferenceDataLibraryDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -252,6 +248,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, siteReferenceDataLibrary, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The siteReferenceDataLibrary DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SiteReferenceDataLibrary siteReferenceDataLibrary, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, siteReferenceDataLibrary, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(siteReferenceDataLibrary, "IsDeprecated") ? siteReferenceDataLibrary.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SiteReferenceDataLibrary\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = siteReferenceDataLibrary.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,5 +402,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"SiteReferenceDataLibrary\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SolutionDao.cs b/CDP4Orm/AutoGenDao/SolutionDao.cs index 893a0175..a89dd6ef 100644 --- a/CDP4Orm/AutoGenDao/SolutionDao.cs +++ b/CDP4Orm/AutoGenDao/SolutionDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -234,6 +230,57 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, solution, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The solution DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Solution solution, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, solution, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Solution\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"Author\", \"Owner\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :author, :owner)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = solution.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("author", NpgsqlDbType.Uuid).Value = !this.IsDerived(solution, "Author") ? solution.Author : Utils.NullableValue(null); + command.Parameters.Add("owner", NpgsqlDbType.Uuid).Value = !this.IsDerived(solution, "Owner") ? solution.Owner : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"Author\", \"Owner\")"); + sqlBuilder.Append(" = (:container, :author, :owner);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -311,5 +358,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/SpecializedQuantityKindDao.cs b/CDP4Orm/AutoGenDao/SpecializedQuantityKindDao.cs index a6be209d..ce4cdfac 100644 --- a/CDP4Orm/AutoGenDao/SpecializedQuantityKindDao.cs +++ b/CDP4Orm/AutoGenDao/SpecializedQuantityKindDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -249,6 +245,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, specializedQuantityKind, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The specializedQuantityKind DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.SpecializedQuantityKind specializedQuantityKind, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, specializedQuantityKind, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"SpecializedQuantityKind\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"General\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :general)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = specializedQuantityKind.Iid; + command.Parameters.Add("general", NpgsqlDbType.Uuid).Value = !this.IsDerived(specializedQuantityKind, "General") ? specializedQuantityKind.General : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"General\""); + sqlBuilder.Append(" = :general;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -324,5 +369,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/StakeHolderValueMapDao.cs b/CDP4Orm/AutoGenDao/StakeHolderValueMapDao.cs index d276d37f..1ff7c807 100644 --- a/CDP4Orm/AutoGenDao/StakeHolderValueMapDao.cs +++ b/CDP4Orm/AutoGenDao/StakeHolderValueMapDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -238,6 +234,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, stakeHolderValueMap, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The stakeHolderValueMap DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeHolderValueMap stakeHolderValueMap, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, stakeHolderValueMap, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeHolderValueMap\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = stakeHolderValueMap.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + stakeHolderValueMap.Category.ForEach(x => this.UpsertCategory(transaction, partition, stakeHolderValueMap.Iid, x)); + stakeHolderValueMap.Goal.ForEach(x => this.UpsertGoal(transaction, partition, stakeHolderValueMap.Iid, x)); + stakeHolderValueMap.Requirement.ForEach(x => this.UpsertRequirement(transaction, partition, stakeHolderValueMap.Iid, x)); + stakeHolderValueMap.StakeholderValue.ForEach(x => this.UpsertStakeholderValue(transaction, partition, stakeHolderValueMap.Iid, x)); + stakeHolderValueMap.ValueGroup.ForEach(x => this.UpsertValueGroup(transaction, partition, stakeHolderValueMap.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -341,6 +391,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeHolderValueMap_Category\"", partition); + sqlBuilder.AppendFormat(" (\"StakeHolderValueMap\", \"Category\")"); + sqlBuilder.Append(" VALUES (:stakeHolderValueMap, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"StakeHolderValueMap_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"StakeHolderValueMap\", \"Category\")"); + sqlBuilder.Append(" = (:stakeHolderValueMap, :category);"); + + command.Parameters.Add("stakeHolderValueMap", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -378,6 +471,49 @@ public bool AddGoal(NpgsqlTransaction transaction, string partition, Guid iid, G return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertGoal(NpgsqlTransaction transaction, string partition, Guid iid, Guid goal) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeHolderValueMap_Goal\"", partition); + sqlBuilder.AppendFormat(" (\"StakeHolderValueMap\", \"Goal\")"); + sqlBuilder.Append(" VALUES (:stakeHolderValueMap, :goal)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"StakeHolderValueMap_Goal_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"StakeHolderValueMap\", \"Goal\")"); + sqlBuilder.Append(" = (:stakeHolderValueMap, :goal);"); + + command.Parameters.Add("stakeHolderValueMap", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("goal", NpgsqlDbType.Uuid).Value = goal; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -415,6 +551,49 @@ public bool AddRequirement(NpgsqlTransaction transaction, string partition, Guid return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertRequirement(NpgsqlTransaction transaction, string partition, Guid iid, Guid requirement) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeHolderValueMap_Requirement\"", partition); + sqlBuilder.AppendFormat(" (\"StakeHolderValueMap\", \"Requirement\")"); + sqlBuilder.Append(" VALUES (:stakeHolderValueMap, :requirement)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"StakeHolderValueMap_Requirement_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"StakeHolderValueMap\", \"Requirement\")"); + sqlBuilder.Append(" = (:stakeHolderValueMap, :requirement);"); + + command.Parameters.Add("stakeHolderValueMap", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("requirement", NpgsqlDbType.Uuid).Value = requirement; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -452,6 +631,49 @@ public bool AddStakeholderValue(NpgsqlTransaction transaction, string partition, return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertStakeholderValue(NpgsqlTransaction transaction, string partition, Guid iid, Guid stakeholderValue) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeHolderValueMap_StakeholderValue\"", partition); + sqlBuilder.AppendFormat(" (\"StakeHolderValueMap\", \"StakeholderValue\")"); + sqlBuilder.Append(" VALUES (:stakeHolderValueMap, :stakeholderValue)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"StakeHolderValueMap_StakeholderValue_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"StakeHolderValueMap\", \"StakeholderValue\")"); + sqlBuilder.Append(" = (:stakeHolderValueMap, :stakeholderValue);"); + + command.Parameters.Add("stakeHolderValueMap", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("stakeholderValue", NpgsqlDbType.Uuid).Value = stakeholderValue; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -490,6 +712,49 @@ public bool AddValueGroup(NpgsqlTransaction transaction, string partition, Guid } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertValueGroup(NpgsqlTransaction transaction, string partition, Guid iid, Guid valueGroup) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeHolderValueMap_ValueGroup\"", partition); + sqlBuilder.AppendFormat(" (\"StakeHolderValueMap\", \"ValueGroup\")"); + sqlBuilder.Append(" VALUES (:stakeHolderValueMap, :valueGroup)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"StakeHolderValueMap_ValueGroup_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"StakeHolderValueMap\", \"ValueGroup\")"); + sqlBuilder.Append(" = (:stakeHolderValueMap, :valueGroup);"); + + command.Parameters.Add("stakeHolderValueMap", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueGroup", NpgsqlDbType.Uuid).Value = valueGroup; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -566,6 +831,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/StakeHolderValueMapSettingsDao.cs b/CDP4Orm/AutoGenDao/StakeHolderValueMapSettingsDao.cs index 6a7efa41..c6fb905a 100644 --- a/CDP4Orm/AutoGenDao/StakeHolderValueMapSettingsDao.cs +++ b/CDP4Orm/AutoGenDao/StakeHolderValueMapSettingsDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -218,6 +214,58 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, stakeHolderValueMapSettings, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The stakeHolderValueMapSettings DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeHolderValueMapSettings stakeHolderValueMapSettings, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, stakeHolderValueMapSettings, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeHolderValueMapSettings\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\", \"GoalToValueGroupRelationship\", \"StakeholderValueToRequirementRelationship\", \"ValueGroupToStakeholderValueRelationship\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container, :goalToValueGroupRelationship, :stakeholderValueToRequirementRelationship, :valueGroupToStakeholderValueRelationship)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = stakeHolderValueMapSettings.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("goalToValueGroupRelationship", NpgsqlDbType.Uuid).Value = !this.IsDerived(stakeHolderValueMapSettings, "GoalToValueGroupRelationship") ? Utils.NullableValue(stakeHolderValueMapSettings.GoalToValueGroupRelationship) : Utils.NullableValue(null); + command.Parameters.Add("stakeholderValueToRequirementRelationship", NpgsqlDbType.Uuid).Value = !this.IsDerived(stakeHolderValueMapSettings, "StakeholderValueToRequirementRelationship") ? Utils.NullableValue(stakeHolderValueMapSettings.StakeholderValueToRequirementRelationship) : Utils.NullableValue(null); + command.Parameters.Add("valueGroupToStakeholderValueRelationship", NpgsqlDbType.Uuid).Value = !this.IsDerived(stakeHolderValueMapSettings, "ValueGroupToStakeholderValueRelationship") ? Utils.NullableValue(stakeHolderValueMapSettings.ValueGroupToStakeholderValueRelationship) : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Container\", \"GoalToValueGroupRelationship\", \"StakeholderValueToRequirementRelationship\", \"ValueGroupToStakeholderValueRelationship\")"); + sqlBuilder.Append(" = (:container, :goalToValueGroupRelationship, :stakeholderValueToRequirementRelationship, :valueGroupToStakeholderValueRelationship);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -296,5 +344,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/StakeholderDao.cs b/CDP4Orm/AutoGenDao/StakeholderDao.cs index 67ffca75..5d0ee693 100644 --- a/CDP4Orm/AutoGenDao/StakeholderDao.cs +++ b/CDP4Orm/AutoGenDao/StakeholderDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -231,6 +227,57 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, stakeholder, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The stakeholder DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Stakeholder stakeholder, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, stakeholder, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Stakeholder\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = stakeholder.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + stakeholder.Category.ForEach(x => this.UpsertCategory(transaction, partition, stakeholder.Iid, x)); + stakeholder.StakeholderValue.ForEach(x => this.UpsertStakeholderValue(transaction, partition, stakeholder.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -316,6 +363,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Stakeholder_Category\"", partition); + sqlBuilder.AppendFormat(" (\"Stakeholder\", \"Category\")"); + sqlBuilder.Append(" VALUES (:stakeholder, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Stakeholder_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Stakeholder\", \"Category\")"); + sqlBuilder.Append(" = (:stakeholder, :category);"); + + command.Parameters.Add("stakeholder", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -354,6 +444,49 @@ public bool AddStakeholderValue(NpgsqlTransaction transaction, string partition, } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertStakeholderValue(NpgsqlTransaction transaction, string partition, Guid iid, Guid stakeholderValue) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Stakeholder_StakeholderValue\"", partition); + sqlBuilder.AppendFormat(" (\"Stakeholder\", \"StakeholderValue\")"); + sqlBuilder.Append(" VALUES (:stakeholder, :stakeholderValue)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Stakeholder_StakeholderValue_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Stakeholder\", \"StakeholderValue\")"); + sqlBuilder.Append(" = (:stakeholder, :stakeholderValue);"); + + command.Parameters.Add("stakeholder", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("stakeholderValue", NpgsqlDbType.Uuid).Value = stakeholderValue; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -430,6 +563,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/StakeholderValueDao.cs b/CDP4Orm/AutoGenDao/StakeholderValueDao.cs index acd36423..05cfe0ee 100644 --- a/CDP4Orm/AutoGenDao/StakeholderValueDao.cs +++ b/CDP4Orm/AutoGenDao/StakeholderValueDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -229,6 +225,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, stakeholderValue, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The stakeholderValue DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.StakeholderValue stakeholderValue, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, stakeholderValue, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeholderValue\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = stakeholderValue.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + stakeholderValue.Category.ForEach(x => this.UpsertCategory(transaction, partition, stakeholderValue.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -309,6 +355,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"StakeholderValue_Category\"", partition); + sqlBuilder.AppendFormat(" (\"StakeholderValue\", \"Category\")"); + sqlBuilder.Append(" VALUES (:stakeholderValue, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"StakeholderValue_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"StakeholderValue\", \"Category\")"); + sqlBuilder.Append(" = (:stakeholderValue, :category);"); + + command.Parameters.Add("stakeholderValue", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -385,6 +474,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/TelephoneNumberDao.cs b/CDP4Orm/AutoGenDao/TelephoneNumberDao.cs index be1496cd..7fd2905b 100644 --- a/CDP4Orm/AutoGenDao/TelephoneNumberDao.cs +++ b/CDP4Orm/AutoGenDao/TelephoneNumberDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -227,6 +223,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, telephoneNumber, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The telephoneNumber DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TelephoneNumber telephoneNumber, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, telephoneNumber, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Value", !this.IsDerived(telephoneNumber, "Value") ? telephoneNumber.Value.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"TelephoneNumber\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = telephoneNumber.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + telephoneNumber.VcardType.ForEach(x => this.UpsertVcardType(transaction, partition, telephoneNumber.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -307,6 +360,45 @@ public bool AddVcardType(NpgsqlTransaction transaction, string partition, Guid i } } + /// + /// Insert a new association record in the link table, or update an existing one if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertVcardType(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.SiteDirectoryData.VcardTelephoneNumberKind vcardType) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"TelephoneNumber_VcardType\"", partition); + sqlBuilder.AppendFormat(" (\"TelephoneNumber\", \"VcardType\")"); + sqlBuilder.Append(" VALUES (:telephoneNumber, :vcardType)"); + + command.Parameters.Add("telephoneNumber", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("vcardType", NpgsqlDbType.Text).Value = vcardType.ToString(); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -389,6 +481,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/TermDao.cs b/CDP4Orm/AutoGenDao/TermDao.cs index a49e5767..cbffbff4 100644 --- a/CDP4Orm/AutoGenDao/TermDao.cs +++ b/CDP4Orm/AutoGenDao/TermDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, term, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The term DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Term term, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, term, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", !this.IsDerived(term, "IsDeprecated") ? term.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Term\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = term.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -338,5 +389,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Term\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/TextParameterTypeDao.cs b/CDP4Orm/AutoGenDao/TextParameterTypeDao.cs index aac98850..3e48fa37 100644 --- a/CDP4Orm/AutoGenDao/TextParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/TextParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, textParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The textParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TextParameterType textParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, textParameterType, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"TextParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = textParameterType.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -296,5 +338,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/TextualNoteDao.cs b/CDP4Orm/AutoGenDao/TextualNoteDao.cs index 3362d652..282af4bd 100644 --- a/CDP4Orm/AutoGenDao/TextualNoteDao.cs +++ b/CDP4Orm/AutoGenDao/TextualNoteDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -250,6 +246,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, textualNote, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The textualNote DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TextualNote textualNote, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, textualNote, sequence, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Content", !this.IsDerived(textualNote, "Content") ? textualNote.Content.Escape() : string.Empty }, + { "LanguageCode", !this.IsDerived(textualNote, "LanguageCode") ? textualNote.LanguageCode.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"TextualNote\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = textualNote.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -331,5 +382,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ThingDao.cs b/CDP4Orm/AutoGenDao/ThingDao.cs index 7c3816f8..5e312fc1 100644 --- a/CDP4Orm/AutoGenDao/ThingDao.cs +++ b/CDP4Orm/AutoGenDao/ThingDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -101,6 +97,63 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, thing, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The thing DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.Thing thing, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + var valueTypeDictionaryContents = new Dictionary + { + { "ClassKind", thing.ClassKind.ToString() }, + { "ModifiedOn", !this.IsDerived(thing, "ModifiedOn") ? thing.ModifiedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + { "RevisionNumber", thing.RevisionNumber.ToString() }, + { "ThingPreference", !this.IsDerived(thing, "ThingPreference") ? thing.ThingPreference.Escape() : null }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Thing\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = thing.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + thing.ExcludedDomain.ForEach(x => this.UpsertExcludedDomain(transaction, partition, thing.Iid, x)); + thing.ExcludedPerson.ForEach(x => this.UpsertExcludedPerson(transaction, partition, thing.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -186,6 +239,49 @@ public bool AddExcludedDomain(NpgsqlTransaction transaction, string partition, G return this.ExecuteAndLogCommand(command) > 0; } } + + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertExcludedDomain(NpgsqlTransaction transaction, string partition, Guid iid, Guid excludedDomain) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Thing_ExcludedDomain\"", partition); + sqlBuilder.AppendFormat(" (\"Thing\", \"ExcludedDomain\")"); + sqlBuilder.Append(" VALUES (:thing, :excludedDomain)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Thing_ExcludedDomain_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Thing\", \"ExcludedDomain\")"); + sqlBuilder.Append(" = (:thing, :excludedDomain);"); + + command.Parameters.Add("thing", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("excludedDomain", NpgsqlDbType.Uuid).Value = excludedDomain; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } /// /// Insert a new association record in the link table. /// @@ -224,6 +320,49 @@ public bool AddExcludedPerson(NpgsqlTransaction transaction, string partition, G } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertExcludedPerson(NpgsqlTransaction transaction, string partition, Guid iid, Guid excludedPerson) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"Thing_ExcludedPerson\"", partition); + sqlBuilder.AppendFormat(" (\"Thing\", \"ExcludedPerson\")"); + sqlBuilder.Append(" VALUES (:thing, :excludedPerson)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"Thing_ExcludedPerson_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"Thing\", \"ExcludedPerson\")"); + sqlBuilder.Append(" = (:thing, :excludedPerson);"); + + command.Parameters.Add("thing", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("excludedPerson", NpgsqlDbType.Uuid).Value = excludedPerson; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -364,6 +503,44 @@ public virtual bool Delete(NpgsqlTransaction transaction, string partition, Guid return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public virtual bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("DELETE FROM \"{0}\".\"Thing\"", partition); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4Orm/AutoGenDao/ThingReferenceDao.cs b/CDP4Orm/AutoGenDao/ThingReferenceDao.cs index fe0d717d..a82c9966 100644 --- a/CDP4Orm/AutoGenDao/ThingReferenceDao.cs +++ b/CDP4Orm/AutoGenDao/ThingReferenceDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -99,6 +95,61 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, thingReference, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The thingReference DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ThingReference thingReference, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, thingReference, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ReferencedRevisionNumber", !this.IsDerived(thingReference, "ReferencedRevisionNumber") ? thingReference.ReferencedRevisionNumber.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ThingReference\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"ReferencedThing\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :referencedThing)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = thingReference.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("referencedThing", NpgsqlDbType.Uuid).Value = !this.IsDerived(thingReference, "ReferencedThing") ? thingReference.ReferencedThing : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"ReferencedThing\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :referencedThing);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -180,5 +231,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/TimeOfDayParameterTypeDao.cs b/CDP4Orm/AutoGenDao/TimeOfDayParameterTypeDao.cs index 1bf5a88e..e8cb4b30 100644 --- a/CDP4Orm/AutoGenDao/TimeOfDayParameterTypeDao.cs +++ b/CDP4Orm/AutoGenDao/TimeOfDayParameterTypeDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -239,6 +235,52 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, timeOfDayParameterType, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The timeOfDayParameterType DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TimeOfDayParameterType timeOfDayParameterType, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, timeOfDayParameterType, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"TimeOfDayParameterType\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\")"); + sqlBuilder.AppendFormat(" VALUES (:iid)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = timeOfDayParameterType.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO NOTHING; "); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -296,5 +338,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/TopContainerDao.cs b/CDP4Orm/AutoGenDao/TopContainerDao.cs index c0b2c4a1..9da5a842 100644 --- a/CDP4Orm/AutoGenDao/TopContainerDao.cs +++ b/CDP4Orm/AutoGenDao/TopContainerDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -98,6 +94,60 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, topContainer, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The topContainer DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.TopContainer topContainer, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, topContainer, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "LastModifiedOn", !this.IsDerived(topContainer, "LastModifiedOn") ? topContainer.LastModifiedOn.ToString(Utils.DateTimeUtcSerializationFormat) : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"TopContainer\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = topContainer.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"ValueTypeDictionary\""); + sqlBuilder.Append(" = :valueTypeDictionary;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -178,5 +228,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/UnitFactorDao.cs b/CDP4Orm/AutoGenDao/UnitFactorDao.cs index b7f9a1e7..7df0aff7 100644 --- a/CDP4Orm/AutoGenDao/UnitFactorDao.cs +++ b/CDP4Orm/AutoGenDao/UnitFactorDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -230,6 +226,66 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, unitFactor, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The unitFactor DTO that is to be persisted. + /// + /// + /// The order sequence used to persist this instance. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UnitFactor unitFactor, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, unitFactor, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "Exponent", !this.IsDerived(unitFactor, "Exponent") ? unitFactor.Exponent.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"UnitFactor\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Sequence\", \"Container\", \"Unit\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :sequence, :container, :unit)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = unitFactor.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = sequence; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + command.Parameters.Add("unit", NpgsqlDbType.Uuid).Value = !this.IsDerived(unitFactor, "Unit") ? unitFactor.Unit : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\", \"Unit\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container, :unit);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -351,5 +407,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/UnitPrefixDao.cs b/CDP4Orm/AutoGenDao/UnitPrefixDao.cs index f3bac54e..35f075a1 100644 --- a/CDP4Orm/AutoGenDao/UnitPrefixDao.cs +++ b/CDP4Orm/AutoGenDao/UnitPrefixDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -246,6 +242,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, unitPrefix, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The unitPrefix DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UnitPrefix unitPrefix, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, unitPrefix, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ConversionFactor", !this.IsDerived(unitPrefix, "ConversionFactor") ? unitPrefix.ConversionFactor.Escape() : string.Empty }, + { "IsDeprecated", !this.IsDerived(unitPrefix, "IsDeprecated") ? unitPrefix.IsDeprecated.ToString() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"UnitPrefix\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = unitPrefix.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -346,5 +398,49 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + var valueTypeDictionaryContents = new Dictionary + { + { "IsDeprecated", "true" } + }; + sqlBuilder.AppendFormat("UPDATE \"{0}\".\"UnitPrefix\"", partition); + sqlBuilder.AppendFormat(" SET \"ValueTypeDictionary\" = :valueTypeDictionary"); + sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid;"); + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + result = this.ExecuteAndLogCommand(command) > 0; + } + + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/UserPreferenceDao.cs b/CDP4Orm/AutoGenDao/UserPreferenceDao.cs index 5532e5d3..7fafe357 100644 --- a/CDP4Orm/AutoGenDao/UserPreferenceDao.cs +++ b/CDP4Orm/AutoGenDao/UserPreferenceDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -231,6 +227,62 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, userPreference, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The userPreference DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UserPreference userPreference, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, userPreference, container); + + var valueTypeDictionaryContents = new Dictionary + { + { "ShortName", !this.IsDerived(userPreference, "ShortName") ? userPreference.ShortName.Escape() : string.Empty }, + { "Value", !this.IsDerived(userPreference, "Value") ? userPreference.Value.Escape() : string.Empty }, + }.Concat(valueTypeDictionaryAdditions).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"UserPreference\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :valueTypeDictionary, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = userPreference.Iid; + command.Parameters.Add("valueTypeDictionary", NpgsqlDbType.Hstore).Value = valueTypeDictionaryContents; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueTypeDictionary\", \"Container\")"); + sqlBuilder.Append(" = (:valueTypeDictionary, :container);"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -313,5 +365,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/UserRuleVerificationDao.cs b/CDP4Orm/AutoGenDao/UserRuleVerificationDao.cs index 08dcb07a..0d94b31c 100644 --- a/CDP4Orm/AutoGenDao/UserRuleVerificationDao.cs +++ b/CDP4Orm/AutoGenDao/UserRuleVerificationDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -232,6 +228,55 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, userRuleVerification, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The userRuleVerification DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.UserRuleVerification userRuleVerification, long sequence, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, userRuleVerification, sequence, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"UserRuleVerification\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Rule\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :rule)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = userRuleVerification.Iid; + command.Parameters.Add("rule", NpgsqlDbType.Uuid).Value = !this.IsDerived(userRuleVerification, "Rule") ? userRuleVerification.Rule : Utils.NullableValue(null); + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Rule\""); + sqlBuilder.Append(" = :rule;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + + return true; + } + /// /// Update a database record from the supplied data transfer object. /// @@ -307,5 +352,30 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } } } diff --git a/CDP4Orm/AutoGenDao/ValueGroupDao.cs b/CDP4Orm/AutoGenDao/ValueGroupDao.cs index 03e486ea..6d4aae1a 100644 --- a/CDP4Orm/AutoGenDao/ValueGroupDao.cs +++ b/CDP4Orm/AutoGenDao/ValueGroupDao.cs @@ -1,20 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Kamil Wojnowski, -// Nathanael Smiechowski +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -22,9 +21,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // -// -// This is an auto-generated Dao class. Any manual changes on this file will be overwritten. -// // -------------------------------------------------------------------------------------------------------------------- namespace CDP4Orm.Dao @@ -229,6 +225,56 @@ public virtual bool Write(NpgsqlTransaction transaction, string partition, CDP4C return this.AfterWrite(beforeWrite, transaction, partition, valueGroup, container); } + /// + /// Insert a new database record, or updates one if it already exists from the supplied data transfer object. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The valueGroup DTO that is to be persisted. + /// + /// + /// The container of the DTO to be persisted. + /// + /// + /// True if the concept was successfully persisted. + /// + public virtual bool Upsert(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.ValueGroup valueGroup, CDP4Common.DTO.Thing container = null) + { + var valueTypeDictionaryAdditions = new Dictionary(); + base.Upsert(transaction, partition, valueGroup, container); + + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ValueGroup\"", partition); + sqlBuilder.AppendFormat(" (\"Iid\", \"Container\")"); + sqlBuilder.AppendFormat(" VALUES (:iid, :container)"); + + command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = valueGroup.Iid; + command.Parameters.Add("container", NpgsqlDbType.Uuid).Value = container.Iid; + sqlBuilder.Append(" ON CONFLICT (\"Iid\")"); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET \"Container\""); + sqlBuilder.Append(" = :container;"); + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + this.ExecuteAndLogCommand(command); + } + valueGroup.Category.ForEach(x => this.UpsertCategory(transaction, partition, valueGroup.Iid, x)); + + return true; + } + /// /// Add the supplied value collection to the association link table indicated by the supplied property name /// @@ -309,6 +355,49 @@ public bool AddCategory(NpgsqlTransaction transaction, string partition, Guid ii } } + /// + /// Insert a new association record in the link table, or update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The id that will be the source for each link table record. + /// + /// + /// The value for which a link table record wil be created. + /// + /// + /// True if the value link was successfully created. + /// + public bool UpsertCategory(NpgsqlTransaction transaction, string partition, Guid iid, Guid category) + { + using (var command = new NpgsqlCommand()) + { + var sqlBuilder = new System.Text.StringBuilder(); + sqlBuilder.AppendFormat("INSERT INTO \"{0}\".\"ValueGroup_Category\"", partition); + sqlBuilder.AppendFormat(" (\"ValueGroup\", \"Category\")"); + sqlBuilder.Append(" VALUES (:valueGroup, :category)"); + sqlBuilder.Append(" ON CONFLICT ON CONSTRAINT \"ValueGroup_Category_PK\""); + sqlBuilder.Append(" DO UPDATE "); + sqlBuilder.Append(" SET (\"ValueGroup\", \"Category\")"); + sqlBuilder.Append(" = (:valueGroup, :category);"); + + command.Parameters.Add("valueGroup", NpgsqlDbType.Uuid).Value = iid; + command.Parameters.Add("category", NpgsqlDbType.Uuid).Value = category; + + command.CommandText = sqlBuilder.ToString(); + command.Connection = transaction.Connection; + command.Transaction = transaction; + + return this.ExecuteAndLogCommand(command) > 0; + } + } + /// /// Update a database record from the supplied data transfer object. /// @@ -385,6 +474,31 @@ public override bool Delete(NpgsqlTransaction transaction, string partition, Gui return this.AfterDelete(beforeDelete, transaction, partition, iid); } + /// + /// Delete a database record from the supplied data transfer object. + /// A "Raw" Delete means that the delete is performed without calling BeforeDelete or AfterDelete. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be deleted. + /// + /// + /// The id that is to be deleted. + /// + /// + /// True if the concept was successfully deleted. + /// + public override bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + var result = false; + + result = base.Delete(transaction, partition, iid); + return result; + } + /// /// Delete the supplied value from the association link table indicated by the supplied property name. /// diff --git a/CDP4WebServer/Program.cs b/CDP4WebServer/Program.cs index 386d86ab..53a1ee64 100644 --- a/CDP4WebServer/Program.cs +++ b/CDP4WebServer/Program.cs @@ -60,6 +60,7 @@ public static int Main(string[] args) Logger.Debug($"Backtier-DatabaseManage: {AppConfig.Current.Backtier.DatabaseManage}"); Logger.Debug($"Backtier-StatementTimeout: {AppConfig.Current.Backtier.StatementTimeout}"); Logger.Debug($"Backtier-IsDbSeedEnabled: {AppConfig.Current.Backtier.IsDbSeedEnabled}"); + Logger.Debug($"Backtier-IsDbImportEnabled: {AppConfig.Current.Backtier.IsDbImportEnabled}"); Logger.Debug($"Backtier-IsDbRestoreEnabled: {AppConfig.Current.Backtier.IsDbRestoreEnabled}"); var hostString = $"{AppConfig.Current.Midtier.Protocol}://{AppConfig.Current.Midtier.HostName}:{AppConfig.Current.Midtier.Port}"; diff --git a/CDP4WebServices.API.Tests/OperationProcessorTestFixture.cs b/CDP4WebServices.API.Tests/OperationProcessorTestFixture.cs index 628dc727..87b73369 100644 --- a/CDP4WebServices.API.Tests/OperationProcessorTestFixture.cs +++ b/CDP4WebServices.API.Tests/OperationProcessorTestFixture.cs @@ -701,6 +701,12 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return true; } + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + this.writtenThings.Add(thing); + return true; + } + public bool AddToCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, object value) { return true; @@ -711,6 +717,11 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return true; } + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + return true; + } + public bool DeleteFromCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, object value) { return true; @@ -746,6 +757,11 @@ public bool Write(NpgsqlTransaction transaction, string partition, Parameter par return true; } + public bool Upsert(NpgsqlTransaction transaction, string partition, Parameter parameter, Thing container = null) + { + throw new NotImplementedException(); + } + public bool Update(NpgsqlTransaction transaction, string partition, Parameter parameter, Thing container = null) { throw new NotImplementedException(); @@ -766,6 +782,11 @@ public bool Delete(NpgsqlTransaction transaction, string partition, Guid iid) throw new NotImplementedException(); } + public bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + throw new NotImplementedException(); + } + public bool DeleteFromCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, object value) { throw new NotImplementedException(); @@ -796,6 +817,11 @@ public bool Write(NpgsqlTransaction transaction, string partition, ParameterOver return true; } + public bool Upsert(NpgsqlTransaction transaction, string partition, ParameterOverride parameterOverride, Thing container = null) + { + throw new NotImplementedException(); + } + public bool Update(NpgsqlTransaction transaction, string partition, ParameterOverride parameter, Thing container = null) { throw new NotImplementedException(); @@ -816,6 +842,11 @@ public bool Delete(NpgsqlTransaction transaction, string partition, Guid iid) throw new NotImplementedException(); } + public bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + throw new NotImplementedException(); + } + public bool DeleteFromCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, object value) { throw new NotImplementedException(); @@ -845,6 +876,11 @@ public bool Write(NpgsqlTransaction transaction, string partition, ElementDefini return true; } + public bool Upsert(NpgsqlTransaction transaction, string partition, ElementDefinition elementDefinition, Thing container = null) + { + throw new NotImplementedException(); + } + public bool Update(NpgsqlTransaction transaction, string partition, ElementDefinition parameter, Thing container = null) { throw new NotImplementedException(); @@ -865,6 +901,11 @@ public bool Delete(NpgsqlTransaction transaction, string partition, Guid iid) throw new NotImplementedException(); } + public bool RawDelete(NpgsqlTransaction transaction, string partition, Guid iid) + { + throw new NotImplementedException(); + } + public bool DeleteFromCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, object value) { throw new NotImplementedException(); diff --git a/CDP4WebServices.API/AutoGenServices/ActionItemService.cs b/CDP4WebServices.API/AutoGenServices/ActionItemService.cs index 3bec0350..1e148136 100644 --- a/CDP4WebServices.API/AutoGenServices/ActionItemService.cs +++ b/CDP4WebServices.API/AutoGenServices/ActionItemService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ActionItemDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ActionItemDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, actionItem); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var actionItem = thing as ActionItem; + var createSuccesful = this.ActionItemDao.Upsert(transaction, partition, actionItem, container); + return createSuccesful && this.UpsertContainment(transaction, partition, actionItem); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ActionItem actionItem) + { + var results = new List(); + + foreach (var approvedBy in this.ResolveFromRequestCache(actionItem.ApprovedBy)) + { + results.Add(this.ApprovedByService.UpsertConcept(transaction, partition, approvedBy, actionItem)); + } + + foreach (var discussion in this.ResolveFromRequestCache(actionItem.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, actionItem)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(actionItem.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, actionItem)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ActualFiniteStateListService.cs b/CDP4WebServices.API/AutoGenServices/ActualFiniteStateListService.cs index a555a8e2..5af31855 100644 --- a/CDP4WebServices.API/AutoGenServices/ActualFiniteStateListService.cs +++ b/CDP4WebServices.API/AutoGenServices/ActualFiniteStateListService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ActualFiniteStateListDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ActualFiniteStateListDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, actualFiniteStateList); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var actualFiniteStateList = thing as ActualFiniteStateList; + var createSuccesful = this.ActualFiniteStateListDao.Upsert(transaction, partition, actualFiniteStateList, container); + return createSuccesful && this.UpsertContainment(transaction, partition, actualFiniteStateList); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ActualFiniteStateList actualFiniteStateList) + { + var results = new List(); + + foreach (var actualState in this.ResolveFromRequestCache(actualFiniteStateList.ActualState)) + { + results.Add(this.ActualStateService.UpsertConcept(transaction, partition, actualState, actualFiniteStateList)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ActualFiniteStateService.cs b/CDP4WebServices.API/AutoGenServices/ActualFiniteStateService.cs index 056ef6f5..bd21a03e 100644 --- a/CDP4WebServices.API/AutoGenServices/ActualFiniteStateService.cs +++ b/CDP4WebServices.API/AutoGenServices/ActualFiniteStateService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ActualFiniteStateDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ActualFiniteStateDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ActualFiniteStateDao.Write(transaction, partition, actualFiniteState, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var actualFiniteState = thing as ActualFiniteState; + return this.ActualFiniteStateDao.Upsert(transaction, partition, actualFiniteState, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/AliasService.cs b/CDP4WebServices.API/AutoGenServices/AliasService.cs index 28aea180..60a4d037 100644 --- a/CDP4WebServices.API/AutoGenServices/AliasService.cs +++ b/CDP4WebServices.API/AutoGenServices/AliasService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.AliasDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.AliasDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.AliasDao.Write(transaction, partition, alias, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var alias = thing as Alias; + return this.AliasDao.Upsert(transaction, partition, alias, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/AndExpressionService.cs b/CDP4WebServices.API/AutoGenServices/AndExpressionService.cs index 21fdad09..04704260 100644 --- a/CDP4WebServices.API/AutoGenServices/AndExpressionService.cs +++ b/CDP4WebServices.API/AutoGenServices/AndExpressionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.AndExpressionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.AndExpressionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.AndExpressionDao.Write(transaction, partition, andExpression, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var andExpression = thing as AndExpression; + return this.AndExpressionDao.Upsert(transaction, partition, andExpression, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ApprovalService.cs b/CDP4WebServices.API/AutoGenServices/ApprovalService.cs index f97cebf6..30ffbd56 100644 --- a/CDP4WebServices.API/AutoGenServices/ApprovalService.cs +++ b/CDP4WebServices.API/AutoGenServices/ApprovalService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ApprovalDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ApprovalDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ApprovalDao.Write(transaction, partition, approval, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var approval = thing as Approval; + return this.ApprovalDao.Upsert(transaction, partition, approval, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ArrayParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/ArrayParameterTypeService.cs index cb0dbfcb..3c874613 100644 --- a/CDP4WebServices.API/AutoGenServices/ArrayParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/ArrayParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ArrayParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ArrayParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, arrayParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var arrayParameterType = thing as ArrayParameterType; + var createSuccesful = this.ArrayParameterTypeDao.Upsert(transaction, partition, arrayParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, arrayParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ArrayParameterType arrayParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(arrayParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, arrayParameterType)); + } + + foreach (var component in this.ResolveFromRequestCache(arrayParameterType.Component)) + { + results.Add(this.ComponentService.UpsertConcept(transaction, partition, (ParameterTypeComponent)component.V, arrayParameterType, component.K)); + } + + foreach (var definition in this.ResolveFromRequestCache(arrayParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, arrayParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(arrayParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, arrayParameterType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/BinaryNoteService.cs b/CDP4WebServices.API/AutoGenServices/BinaryNoteService.cs index 651c3d5c..739216cb 100644 --- a/CDP4WebServices.API/AutoGenServices/BinaryNoteService.cs +++ b/CDP4WebServices.API/AutoGenServices/BinaryNoteService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.BinaryNoteDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.BinaryNoteDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.BinaryNoteDao.Write(transaction, partition, binaryNote, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var binaryNote = thing as BinaryNote; + return this.BinaryNoteDao.Upsert(transaction, partition, binaryNote, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/BinaryRelationshipRuleService.cs b/CDP4WebServices.API/AutoGenServices/BinaryRelationshipRuleService.cs index 1a182412..af0ac457 100644 --- a/CDP4WebServices.API/AutoGenServices/BinaryRelationshipRuleService.cs +++ b/CDP4WebServices.API/AutoGenServices/BinaryRelationshipRuleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.BinaryRelationshipRuleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.BinaryRelationshipRuleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, binaryRelationshipRule); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var binaryRelationshipRule = thing as BinaryRelationshipRule; + var createSuccesful = this.BinaryRelationshipRuleDao.Upsert(transaction, partition, binaryRelationshipRule, container); + return createSuccesful && this.UpsertContainment(transaction, partition, binaryRelationshipRule); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, BinaryRelationshipRule binaryRelationshipRule) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(binaryRelationshipRule.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, binaryRelationshipRule)); + } + + foreach (var definition in this.ResolveFromRequestCache(binaryRelationshipRule.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, binaryRelationshipRule)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(binaryRelationshipRule.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, binaryRelationshipRule)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/BinaryRelationshipService.cs b/CDP4WebServices.API/AutoGenServices/BinaryRelationshipService.cs index 25ae50d9..3759a553 100644 --- a/CDP4WebServices.API/AutoGenServices/BinaryRelationshipService.cs +++ b/CDP4WebServices.API/AutoGenServices/BinaryRelationshipService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.BinaryRelationshipDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.BinaryRelationshipDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, binaryRelationship); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var binaryRelationship = thing as BinaryRelationship; + var createSuccesful = this.BinaryRelationshipDao.Upsert(transaction, partition, binaryRelationship, container); + return createSuccesful && this.UpsertContainment(transaction, partition, binaryRelationship); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, BinaryRelationship binaryRelationship) + { + var results = new List(); + + foreach (var parameterValue in this.ResolveFromRequestCache(binaryRelationship.ParameterValue)) + { + results.Add(this.ParameterValueService.UpsertConcept(transaction, partition, parameterValue, binaryRelationship)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/BookService.cs b/CDP4WebServices.API/AutoGenServices/BookService.cs index 3a821886..58921fd8 100644 --- a/CDP4WebServices.API/AutoGenServices/BookService.cs +++ b/CDP4WebServices.API/AutoGenServices/BookService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.BookDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.BookDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, book); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var book = thing as Book; + var createSuccesful = this.BookDao.Upsert(transaction, partition, book, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, book); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Book book) + { + var results = new List(); + + foreach (var section in this.ResolveFromRequestCache(book.Section)) + { + results.Add(this.SectionService.UpsertConcept(transaction, partition, (Section)section.V, book, section.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/BooleanExpressionService.cs b/CDP4WebServices.API/AutoGenServices/BooleanExpressionService.cs index 8c9cd7c8..0626ba3a 100644 --- a/CDP4WebServices.API/AutoGenServices/BooleanExpressionService.cs +++ b/CDP4WebServices.API/AutoGenServices/BooleanExpressionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -319,6 +344,58 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", booleanExpression.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var booleanExpression = thing as BooleanExpression; + if (booleanExpression.IsSameOrDerivedClass()) + { + return this.AndExpressionService.UpsertConcept(transaction, partition, booleanExpression, container); + } + + if (booleanExpression.IsSameOrDerivedClass()) + { + return this.ExclusiveOrExpressionService.UpsertConcept(transaction, partition, booleanExpression, container); + } + + if (booleanExpression.IsSameOrDerivedClass()) + { + return this.NotExpressionService.UpsertConcept(transaction, partition, booleanExpression, container); + } + + if (booleanExpression.IsSameOrDerivedClass()) + { + return this.OrExpressionService.UpsertConcept(transaction, partition, booleanExpression, container); + } + + if (booleanExpression.IsSameOrDerivedClass()) + { + return this.RelationalExpressionService.UpsertConcept(transaction, partition, booleanExpression, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", booleanExpression.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/BooleanParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/BooleanParameterTypeService.cs index e23a106d..e4ee83a4 100644 --- a/CDP4WebServices.API/AutoGenServices/BooleanParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/BooleanParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.BooleanParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.BooleanParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, booleanParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var booleanParameterType = thing as BooleanParameterType; + var createSuccesful = this.BooleanParameterTypeDao.Upsert(transaction, partition, booleanParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, booleanParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, BooleanParameterType booleanParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(booleanParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, booleanParameterType)); + } + + foreach (var definition in this.ResolveFromRequestCache(booleanParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, booleanParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(booleanParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, booleanParameterType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/BoundsService.cs b/CDP4WebServices.API/AutoGenServices/BoundsService.cs index 5207b525..391f85ff 100644 --- a/CDP4WebServices.API/AutoGenServices/BoundsService.cs +++ b/CDP4WebServices.API/AutoGenServices/BoundsService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.BoundsDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.BoundsDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.BoundsDao.Write(transaction, partition, bounds, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var bounds = thing as Bounds; + return this.BoundsDao.Upsert(transaction, partition, bounds, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/BuiltInRuleVerificationService.cs b/CDP4WebServices.API/AutoGenServices/BuiltInRuleVerificationService.cs index 16117b9e..5fc6b147 100644 --- a/CDP4WebServices.API/AutoGenServices/BuiltInRuleVerificationService.cs +++ b/CDP4WebServices.API/AutoGenServices/BuiltInRuleVerificationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.BuiltInRuleVerificationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.BuiltInRuleVerificationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, builtInRuleVerification); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var builtInRuleVerification = thing as BuiltInRuleVerification; + var createSuccesful = this.BuiltInRuleVerificationDao.Upsert(transaction, partition, builtInRuleVerification, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, builtInRuleVerification); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, BuiltInRuleVerification builtInRuleVerification) + { + var results = new List(); + + foreach (var violation in this.ResolveFromRequestCache(builtInRuleVerification.Violation)) + { + results.Add(this.ViolationService.UpsertConcept(transaction, partition, violation, builtInRuleVerification)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/CategoryService.cs b/CDP4WebServices.API/AutoGenServices/CategoryService.cs index d883a926..5a86116d 100644 --- a/CDP4WebServices.API/AutoGenServices/CategoryService.cs +++ b/CDP4WebServices.API/AutoGenServices/CategoryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.CategoryDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.CategoryDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, category); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var category = thing as Category; + var createSuccesful = this.CategoryDao.Upsert(transaction, partition, category, container); + return createSuccesful && this.UpsertContainment(transaction, partition, category); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Category category) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(category.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, category)); + } + + foreach (var definition in this.ResolveFromRequestCache(category.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, category)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(category.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, category)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ChangeProposalService.cs b/CDP4WebServices.API/AutoGenServices/ChangeProposalService.cs index 5ac73bdc..38b1763e 100644 --- a/CDP4WebServices.API/AutoGenServices/ChangeProposalService.cs +++ b/CDP4WebServices.API/AutoGenServices/ChangeProposalService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ChangeProposalDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ChangeProposalDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, changeProposal); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var changeProposal = thing as ChangeProposal; + var createSuccesful = this.ChangeProposalDao.Upsert(transaction, partition, changeProposal, container); + return createSuccesful && this.UpsertContainment(transaction, partition, changeProposal); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ChangeProposal changeProposal) + { + var results = new List(); + + foreach (var approvedBy in this.ResolveFromRequestCache(changeProposal.ApprovedBy)) + { + results.Add(this.ApprovedByService.UpsertConcept(transaction, partition, approvedBy, changeProposal)); + } + + foreach (var discussion in this.ResolveFromRequestCache(changeProposal.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, changeProposal)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(changeProposal.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, changeProposal)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ChangeRequestService.cs b/CDP4WebServices.API/AutoGenServices/ChangeRequestService.cs index 48b8db8d..b6f05ecc 100644 --- a/CDP4WebServices.API/AutoGenServices/ChangeRequestService.cs +++ b/CDP4WebServices.API/AutoGenServices/ChangeRequestService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ChangeRequestDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ChangeRequestDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, changeRequest); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var changeRequest = thing as ChangeRequest; + var createSuccesful = this.ChangeRequestDao.Upsert(transaction, partition, changeRequest, container); + return createSuccesful && this.UpsertContainment(transaction, partition, changeRequest); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ChangeRequest changeRequest) + { + var results = new List(); + + foreach (var approvedBy in this.ResolveFromRequestCache(changeRequest.ApprovedBy)) + { + results.Add(this.ApprovedByService.UpsertConcept(transaction, partition, approvedBy, changeRequest)); + } + + foreach (var discussion in this.ResolveFromRequestCache(changeRequest.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, changeRequest)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(changeRequest.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, changeRequest)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/CitationService.cs b/CDP4WebServices.API/AutoGenServices/CitationService.cs index d1710234..63050ada 100644 --- a/CDP4WebServices.API/AutoGenServices/CitationService.cs +++ b/CDP4WebServices.API/AutoGenServices/CitationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.CitationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.CitationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.CitationDao.Write(transaction, partition, citation, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var citation = thing as Citation; + return this.CitationDao.Upsert(transaction, partition, citation, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ColorService.cs b/CDP4WebServices.API/AutoGenServices/ColorService.cs index 87180f3c..f8fa2dd9 100644 --- a/CDP4WebServices.API/AutoGenServices/ColorService.cs +++ b/CDP4WebServices.API/AutoGenServices/ColorService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ColorDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ColorDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ColorDao.Write(transaction, partition, color, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var color = thing as Color; + return this.ColorDao.Upsert(transaction, partition, color, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/CommonFileStoreService.cs b/CDP4WebServices.API/AutoGenServices/CommonFileStoreService.cs index d5409cfb..95490e72 100644 --- a/CDP4WebServices.API/AutoGenServices/CommonFileStoreService.cs +++ b/CDP4WebServices.API/AutoGenServices/CommonFileStoreService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.CommonFileStoreDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.CommonFileStoreDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -267,6 +293,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, commonFileStore); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var commonFileStore = thing as CommonFileStore; + var createSuccesful = this.CommonFileStoreDao.Upsert(transaction, partition, commonFileStore, container); + return createSuccesful && this.UpsertContainment(transaction, partition, commonFileStore); + } + /// /// Get the requested data from the ORM layer. /// @@ -405,5 +460,38 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, CommonFileStore commonFileStore) + { + var results = new List(); + + foreach (var file in this.ResolveFromRequestCache(commonFileStore.File)) + { + results.Add(this.FileService.UpsertConcept(transaction, partition, file, commonFileStore)); + } + + foreach (var folder in this.ResolveFromRequestCache(commonFileStore.Folder)) + { + results.Add(this.FolderService.UpsertConcept(transaction, partition, folder, commonFileStore)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/CompoundParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/CompoundParameterTypeService.cs index b3907fd3..9f7a4423 100644 --- a/CDP4WebServices.API/AutoGenServices/CompoundParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/CompoundParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.CompoundParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.CompoundParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -291,6 +317,40 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, compoundParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var compoundParameterType = thing as CompoundParameterType; + if (compoundParameterType.IsSameOrDerivedClass()) + { + return this.ArrayParameterTypeService.UpsertConcept(transaction, partition, compoundParameterType, container); + } + + var createSuccesful = this.CompoundParameterTypeDao.Upsert(transaction, partition, compoundParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, compoundParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -446,5 +506,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, CompoundParameterType compoundParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(compoundParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, compoundParameterType)); + } + + foreach (var component in this.ResolveFromRequestCache(compoundParameterType.Component)) + { + results.Add(this.ComponentService.UpsertConcept(transaction, partition, (ParameterTypeComponent)component.V, compoundParameterType, component.K)); + } + + foreach (var definition in this.ResolveFromRequestCache(compoundParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, compoundParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(compoundParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, compoundParameterType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ConstantService.cs b/CDP4WebServices.API/AutoGenServices/ConstantService.cs index c1c6c38e..def8e166 100644 --- a/CDP4WebServices.API/AutoGenServices/ConstantService.cs +++ b/CDP4WebServices.API/AutoGenServices/ConstantService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ConstantDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ConstantDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, constant); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var constant = thing as Constant; + var createSuccesful = this.ConstantDao.Upsert(transaction, partition, constant, container); + return createSuccesful && this.UpsertContainment(transaction, partition, constant); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Constant constant) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(constant.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, constant)); + } + + foreach (var definition in this.ResolveFromRequestCache(constant.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, constant)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(constant.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, constant)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ContractChangeNoticeService.cs b/CDP4WebServices.API/AutoGenServices/ContractChangeNoticeService.cs index ed3d9a4b..d4a63e6e 100644 --- a/CDP4WebServices.API/AutoGenServices/ContractChangeNoticeService.cs +++ b/CDP4WebServices.API/AutoGenServices/ContractChangeNoticeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ContractChangeNoticeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ContractChangeNoticeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, contractChangeNotice); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var contractChangeNotice = thing as ContractChangeNotice; + var createSuccesful = this.ContractChangeNoticeDao.Upsert(transaction, partition, contractChangeNotice, container); + return createSuccesful && this.UpsertContainment(transaction, partition, contractChangeNotice); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ContractChangeNotice contractChangeNotice) + { + var results = new List(); + + foreach (var approvedBy in this.ResolveFromRequestCache(contractChangeNotice.ApprovedBy)) + { + results.Add(this.ApprovedByService.UpsertConcept(transaction, partition, approvedBy, contractChangeNotice)); + } + + foreach (var discussion in this.ResolveFromRequestCache(contractChangeNotice.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, contractChangeNotice)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(contractChangeNotice.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, contractChangeNotice)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ContractDeviationService.cs b/CDP4WebServices.API/AutoGenServices/ContractDeviationService.cs index 301f4c48..c2067efc 100644 --- a/CDP4WebServices.API/AutoGenServices/ContractDeviationService.cs +++ b/CDP4WebServices.API/AutoGenServices/ContractDeviationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -289,6 +314,48 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", contractDeviation.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var contractDeviation = thing as ContractDeviation; + if (contractDeviation.IsSameOrDerivedClass()) + { + return this.ChangeRequestService.UpsertConcept(transaction, partition, contractDeviation, container); + } + + if (contractDeviation.IsSameOrDerivedClass()) + { + return this.RequestForDeviationService.UpsertConcept(transaction, partition, contractDeviation, container); + } + + if (contractDeviation.IsSameOrDerivedClass()) + { + return this.RequestForWaiverService.UpsertConcept(transaction, partition, contractDeviation, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", contractDeviation.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ConversionBasedUnitService.cs b/CDP4WebServices.API/AutoGenServices/ConversionBasedUnitService.cs index a8b63d79..9af64b87 100644 --- a/CDP4WebServices.API/AutoGenServices/ConversionBasedUnitService.cs +++ b/CDP4WebServices.API/AutoGenServices/ConversionBasedUnitService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -274,6 +299,43 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", conversionBasedUnit.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var conversionBasedUnit = thing as ConversionBasedUnit; + if (conversionBasedUnit.IsSameOrDerivedClass()) + { + return this.LinearConversionUnitService.UpsertConcept(transaction, partition, conversionBasedUnit, container); + } + + if (conversionBasedUnit.IsSameOrDerivedClass()) + { + return this.PrefixedUnitService.UpsertConcept(transaction, partition, conversionBasedUnit, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", conversionBasedUnit.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/CyclicRatioScaleService.cs b/CDP4WebServices.API/AutoGenServices/CyclicRatioScaleService.cs index 46718ca5..d6926da1 100644 --- a/CDP4WebServices.API/AutoGenServices/CyclicRatioScaleService.cs +++ b/CDP4WebServices.API/AutoGenServices/CyclicRatioScaleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.CyclicRatioScaleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.CyclicRatioScaleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -282,6 +308,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, cyclicRatioScale); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var cyclicRatioScale = thing as CyclicRatioScale; + var createSuccesful = this.CyclicRatioScaleDao.Upsert(transaction, partition, cyclicRatioScale, container); + return createSuccesful && this.UpsertContainment(transaction, partition, cyclicRatioScale); + } + /// /// Get the requested data from the ORM layer. /// @@ -438,5 +493,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, CyclicRatioScale cyclicRatioScale) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(cyclicRatioScale.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, cyclicRatioScale)); + } + + foreach (var definition in this.ResolveFromRequestCache(cyclicRatioScale.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, cyclicRatioScale)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(cyclicRatioScale.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, cyclicRatioScale)); + } + + foreach (var mappingToReferenceScale in this.ResolveFromRequestCache(cyclicRatioScale.MappingToReferenceScale)) + { + results.Add(this.MappingToReferenceScaleService.UpsertConcept(transaction, partition, mappingToReferenceScale, cyclicRatioScale)); + } + + foreach (var valueDefinition in this.ResolveFromRequestCache(cyclicRatioScale.ValueDefinition)) + { + results.Add(this.ValueDefinitionService.UpsertConcept(transaction, partition, valueDefinition, cyclicRatioScale)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DateParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/DateParameterTypeService.cs index 7581b154..0e6025fa 100644 --- a/CDP4WebServices.API/AutoGenServices/DateParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/DateParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DateParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DateParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, dateParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var dateParameterType = thing as DateParameterType; + var createSuccesful = this.DateParameterTypeDao.Upsert(transaction, partition, dateParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, dateParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DateParameterType dateParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(dateParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, dateParameterType)); + } + + foreach (var definition in this.ResolveFromRequestCache(dateParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, dateParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(dateParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, dateParameterType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DateTimeParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/DateTimeParameterTypeService.cs index d572a856..c5ebf3bb 100644 --- a/CDP4WebServices.API/AutoGenServices/DateTimeParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/DateTimeParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DateTimeParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DateTimeParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, dateTimeParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var dateTimeParameterType = thing as DateTimeParameterType; + var createSuccesful = this.DateTimeParameterTypeDao.Upsert(transaction, partition, dateTimeParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, dateTimeParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DateTimeParameterType dateTimeParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(dateTimeParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, dateTimeParameterType)); + } + + foreach (var definition in this.ResolveFromRequestCache(dateTimeParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, dateTimeParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(dateTimeParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, dateTimeParameterType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DecompositionRuleService.cs b/CDP4WebServices.API/AutoGenServices/DecompositionRuleService.cs index 6c84db58..6d83202e 100644 --- a/CDP4WebServices.API/AutoGenServices/DecompositionRuleService.cs +++ b/CDP4WebServices.API/AutoGenServices/DecompositionRuleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DecompositionRuleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DecompositionRuleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, decompositionRule); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var decompositionRule = thing as DecompositionRule; + var createSuccesful = this.DecompositionRuleDao.Upsert(transaction, partition, decompositionRule, container); + return createSuccesful && this.UpsertContainment(transaction, partition, decompositionRule); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DecompositionRule decompositionRule) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(decompositionRule.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, decompositionRule)); + } + + foreach (var definition in this.ResolveFromRequestCache(decompositionRule.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, decompositionRule)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(decompositionRule.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, decompositionRule)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DefinedThingService.cs b/CDP4WebServices.API/AutoGenServices/DefinedThingService.cs index 615e3a68..2aa3286b 100644 --- a/CDP4WebServices.API/AutoGenServices/DefinedThingService.cs +++ b/CDP4WebServices.API/AutoGenServices/DefinedThingService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -340,6 +340,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -401,6 +426,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", definedThing.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var definedThing = thing as DefinedThing; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", definedThing.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DefinitionService.cs b/CDP4WebServices.API/AutoGenServices/DefinitionService.cs index 0796f637..6b7cb773 100644 --- a/CDP4WebServices.API/AutoGenServices/DefinitionService.cs +++ b/CDP4WebServices.API/AutoGenServices/DefinitionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DefinitionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DefinitionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, definition); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var definition = thing as Definition; + var createSuccesful = this.DefinitionDao.Upsert(transaction, partition, definition, container); + return createSuccesful && this.UpsertContainment(transaction, partition, definition); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Definition definition) + { + var results = new List(); + + foreach (var citation in this.ResolveFromRequestCache(definition.Citation)) + { + results.Add(this.CitationService.UpsertConcept(transaction, partition, citation, definition)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DependentParameterTypeAssignmentService.cs b/CDP4WebServices.API/AutoGenServices/DependentParameterTypeAssignmentService.cs index 0ac8732b..8b339367 100644 --- a/CDP4WebServices.API/AutoGenServices/DependentParameterTypeAssignmentService.cs +++ b/CDP4WebServices.API/AutoGenServices/DependentParameterTypeAssignmentService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DependentParameterTypeAssignmentDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DependentParameterTypeAssignmentDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.DependentParameterTypeAssignmentDao.Write(transaction, partition, dependentParameterTypeAssignment, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var dependentParameterTypeAssignment = thing as DependentParameterTypeAssignment; + return this.DependentParameterTypeAssignmentDao.Upsert(transaction, partition, dependentParameterTypeAssignment, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DerivedQuantityKindService.cs b/CDP4WebServices.API/AutoGenServices/DerivedQuantityKindService.cs index 2da8c23e..2b01652a 100644 --- a/CDP4WebServices.API/AutoGenServices/DerivedQuantityKindService.cs +++ b/CDP4WebServices.API/AutoGenServices/DerivedQuantityKindService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DerivedQuantityKindDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DerivedQuantityKindDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, derivedQuantityKind); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var derivedQuantityKind = thing as DerivedQuantityKind; + var createSuccesful = this.DerivedQuantityKindDao.Upsert(transaction, partition, derivedQuantityKind, container); + return createSuccesful && this.UpsertContainment(transaction, partition, derivedQuantityKind); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DerivedQuantityKind derivedQuantityKind) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(derivedQuantityKind.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, derivedQuantityKind)); + } + + foreach (var definition in this.ResolveFromRequestCache(derivedQuantityKind.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, derivedQuantityKind)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(derivedQuantityKind.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, derivedQuantityKind)); + } + + foreach (var quantityKindFactor in this.ResolveFromRequestCache(derivedQuantityKind.QuantityKindFactor)) + { + results.Add(this.QuantityKindFactorService.UpsertConcept(transaction, partition, (QuantityKindFactor)quantityKindFactor.V, derivedQuantityKind, quantityKindFactor.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DerivedUnitService.cs b/CDP4WebServices.API/AutoGenServices/DerivedUnitService.cs index 1a6fcd79..afec07d3 100644 --- a/CDP4WebServices.API/AutoGenServices/DerivedUnitService.cs +++ b/CDP4WebServices.API/AutoGenServices/DerivedUnitService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DerivedUnitDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DerivedUnitDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, derivedUnit); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var derivedUnit = thing as DerivedUnit; + var createSuccesful = this.DerivedUnitDao.Upsert(transaction, partition, derivedUnit, container); + return createSuccesful && this.UpsertContainment(transaction, partition, derivedUnit); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DerivedUnit derivedUnit) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(derivedUnit.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, derivedUnit)); + } + + foreach (var definition in this.ResolveFromRequestCache(derivedUnit.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, derivedUnit)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(derivedUnit.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, derivedUnit)); + } + + foreach (var unitFactor in this.ResolveFromRequestCache(derivedUnit.UnitFactor)) + { + results.Add(this.UnitFactorService.UpsertConcept(transaction, partition, (UnitFactor)unitFactor.V, derivedUnit, unitFactor.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DiagramCanvasService.cs b/CDP4WebServices.API/AutoGenServices/DiagramCanvasService.cs index b0f95d0c..026ad7b7 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagramCanvasService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagramCanvasService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DiagramCanvasDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DiagramCanvasDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -267,6 +293,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, diagramCanvas); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagramCanvas = thing as DiagramCanvas; + var createSuccesful = this.DiagramCanvasDao.Upsert(transaction, partition, diagramCanvas, container); + return createSuccesful && this.UpsertContainment(transaction, partition, diagramCanvas); + } + /// /// Get the requested data from the ORM layer. /// @@ -405,5 +460,38 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DiagramCanvas diagramCanvas) + { + var results = new List(); + + foreach (var bounds in this.ResolveFromRequestCache(diagramCanvas.Bounds)) + { + results.Add(this.BoundsService.UpsertConcept(transaction, partition, bounds, diagramCanvas)); + } + + foreach (var diagramElement in this.ResolveFromRequestCache(diagramCanvas.DiagramElement)) + { + results.Add(this.DiagramElementService.UpsertConcept(transaction, partition, diagramElement, diagramCanvas)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DiagramEdgeService.cs b/CDP4WebServices.API/AutoGenServices/DiagramEdgeService.cs index c824a5c1..b49de0c0 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagramEdgeService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagramEdgeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DiagramEdgeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DiagramEdgeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, diagramEdge); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagramEdge = thing as DiagramEdge; + var createSuccesful = this.DiagramEdgeDao.Upsert(transaction, partition, diagramEdge, container); + return createSuccesful && this.UpsertContainment(transaction, partition, diagramEdge); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DiagramEdge diagramEdge) + { + var results = new List(); + + foreach (var bounds in this.ResolveFromRequestCache(diagramEdge.Bounds)) + { + results.Add(this.BoundsService.UpsertConcept(transaction, partition, bounds, diagramEdge)); + } + + foreach (var diagramElement in this.ResolveFromRequestCache(diagramEdge.DiagramElement)) + { + results.Add(this.DiagramElementService.UpsertConcept(transaction, partition, diagramElement, diagramEdge)); + } + + foreach (var localStyle in this.ResolveFromRequestCache(diagramEdge.LocalStyle)) + { + results.Add(this.LocalStyleService.UpsertConcept(transaction, partition, localStyle, diagramEdge)); + } + + foreach (var point in this.ResolveFromRequestCache(diagramEdge.Point)) + { + results.Add(this.PointService.UpsertConcept(transaction, partition, (Point)point.V, diagramEdge, point.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DiagramElementContainerService.cs b/CDP4WebServices.API/AutoGenServices/DiagramElementContainerService.cs index 147eb7aa..9c88c412 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagramElementContainerService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagramElementContainerService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", diagramElementContainer.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagramElementContainer = thing as DiagramElementContainer; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", diagramElementContainer.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DiagramElementThingService.cs b/CDP4WebServices.API/AutoGenServices/DiagramElementThingService.cs index c5d6e34a..0b533d04 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagramElementThingService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagramElementThingService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -274,6 +299,43 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", diagramElementThing.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagramElementThing = thing as DiagramElementThing; + if (diagramElementThing.IsSameOrDerivedClass()) + { + return this.DiagramEdgeService.UpsertConcept(transaction, partition, diagramElementThing, container); + } + + if (diagramElementThing.IsSameOrDerivedClass()) + { + return this.DiagramShapeService.UpsertConcept(transaction, partition, diagramElementThing, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", diagramElementThing.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DiagramObjectService.cs b/CDP4WebServices.API/AutoGenServices/DiagramObjectService.cs index dcc2615c..a86f2652 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagramObjectService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagramObjectService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DiagramObjectDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DiagramObjectDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, diagramObject); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagramObject = thing as DiagramObject; + var createSuccesful = this.DiagramObjectDao.Upsert(transaction, partition, diagramObject, container); + return createSuccesful && this.UpsertContainment(transaction, partition, diagramObject); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DiagramObject diagramObject) + { + var results = new List(); + + foreach (var bounds in this.ResolveFromRequestCache(diagramObject.Bounds)) + { + results.Add(this.BoundsService.UpsertConcept(transaction, partition, bounds, diagramObject)); + } + + foreach (var diagramElement in this.ResolveFromRequestCache(diagramObject.DiagramElement)) + { + results.Add(this.DiagramElementService.UpsertConcept(transaction, partition, diagramElement, diagramObject)); + } + + foreach (var localStyle in this.ResolveFromRequestCache(diagramObject.LocalStyle)) + { + results.Add(this.LocalStyleService.UpsertConcept(transaction, partition, localStyle, diagramObject)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DiagramShapeService.cs b/CDP4WebServices.API/AutoGenServices/DiagramShapeService.cs index 7e394dbd..2ab288a0 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagramShapeService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagramShapeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -190,6 +190,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -259,6 +284,38 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", diagramShape.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagramShape = thing as DiagramShape; + if (diagramShape.IsSameOrDerivedClass()) + { + return this.DiagramObjectService.UpsertConcept(transaction, partition, diagramShape, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", diagramShape.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DiagramThingBaseService.cs b/CDP4WebServices.API/AutoGenServices/DiagramThingBaseService.cs index fcaec3ec..41ca296e 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagramThingBaseService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagramThingBaseService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -271,6 +296,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", diagramThingBase.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagramThingBase = thing as DiagramThingBase; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", diagramThingBase.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DiagrammingStyleService.cs b/CDP4WebServices.API/AutoGenServices/DiagrammingStyleService.cs index 4f09fb19..59e21fb5 100644 --- a/CDP4WebServices.API/AutoGenServices/DiagrammingStyleService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiagrammingStyleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", diagrammingStyle.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var diagrammingStyle = thing as DiagrammingStyle; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", diagrammingStyle.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DiscussionItemService.cs b/CDP4WebServices.API/AutoGenServices/DiscussionItemService.cs index cb183adc..e9212c3b 100644 --- a/CDP4WebServices.API/AutoGenServices/DiscussionItemService.cs +++ b/CDP4WebServices.API/AutoGenServices/DiscussionItemService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", discussionItem.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var discussionItem = thing as DiscussionItem; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", discussionItem.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/DomainFileStoreService.cs b/CDP4WebServices.API/AutoGenServices/DomainFileStoreService.cs index 5d51d159..e3e9975f 100644 --- a/CDP4WebServices.API/AutoGenServices/DomainFileStoreService.cs +++ b/CDP4WebServices.API/AutoGenServices/DomainFileStoreService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DomainFileStoreDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DomainFileStoreDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -267,6 +293,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, domainFileStore); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var domainFileStore = thing as DomainFileStore; + var createSuccesful = this.DomainFileStoreDao.Upsert(transaction, partition, domainFileStore, container); + return createSuccesful && this.UpsertContainment(transaction, partition, domainFileStore); + } + /// /// Get the requested data from the ORM layer. /// @@ -405,5 +460,38 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DomainFileStore domainFileStore) + { + var results = new List(); + + foreach (var file in this.ResolveFromRequestCache(domainFileStore.File)) + { + results.Add(this.FileService.UpsertConcept(transaction, partition, file, domainFileStore)); + } + + foreach (var folder in this.ResolveFromRequestCache(domainFileStore.Folder)) + { + results.Add(this.FolderService.UpsertConcept(transaction, partition, folder, domainFileStore)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseGroupService.cs b/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseGroupService.cs index cd82d7fa..efd4a99f 100644 --- a/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseGroupService.cs +++ b/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseGroupService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DomainOfExpertiseGroupDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DomainOfExpertiseGroupDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, domainOfExpertiseGroup); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var domainOfExpertiseGroup = thing as DomainOfExpertiseGroup; + var createSuccesful = this.DomainOfExpertiseGroupDao.Upsert(transaction, partition, domainOfExpertiseGroup, container); + return createSuccesful && this.UpsertContainment(transaction, partition, domainOfExpertiseGroup); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DomainOfExpertiseGroup domainOfExpertiseGroup) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(domainOfExpertiseGroup.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, domainOfExpertiseGroup)); + } + + foreach (var definition in this.ResolveFromRequestCache(domainOfExpertiseGroup.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, domainOfExpertiseGroup)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(domainOfExpertiseGroup.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, domainOfExpertiseGroup)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseService.cs b/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseService.cs index 5cad807a..1c6dd497 100644 --- a/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseService.cs +++ b/CDP4WebServices.API/AutoGenServices/DomainOfExpertiseService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.DomainOfExpertiseDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.DomainOfExpertiseDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, domainOfExpertise); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var domainOfExpertise = thing as DomainOfExpertise; + var createSuccesful = this.DomainOfExpertiseDao.Upsert(transaction, partition, domainOfExpertise, container); + return createSuccesful && this.UpsertContainment(transaction, partition, domainOfExpertise); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, DomainOfExpertise domainOfExpertise) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(domainOfExpertise.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, domainOfExpertise)); + } + + foreach (var definition in this.ResolveFromRequestCache(domainOfExpertise.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, domainOfExpertise)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(domainOfExpertise.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, domainOfExpertise)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ElementBaseService.cs b/CDP4WebServices.API/AutoGenServices/ElementBaseService.cs index 90be74f9..9845ff51 100644 --- a/CDP4WebServices.API/AutoGenServices/ElementBaseService.cs +++ b/CDP4WebServices.API/AutoGenServices/ElementBaseService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", elementBase.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var elementBase = thing as ElementBase; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", elementBase.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ElementDefinitionService.cs b/CDP4WebServices.API/AutoGenServices/ElementDefinitionService.cs index e3929445..05d91796 100644 --- a/CDP4WebServices.API/AutoGenServices/ElementDefinitionService.cs +++ b/CDP4WebServices.API/AutoGenServices/ElementDefinitionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -225,6 +225,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ElementDefinitionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ElementDefinitionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -287,6 +313,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, elementDefinition); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var elementDefinition = thing as ElementDefinition; + var createSuccesful = this.ElementDefinitionDao.Upsert(transaction, partition, elementDefinition, container); + return createSuccesful && this.UpsertContainment(transaction, partition, elementDefinition); + } + /// /// Get the requested data from the ORM layer. /// @@ -449,5 +504,58 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ElementDefinition elementDefinition) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(elementDefinition.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, elementDefinition)); + } + + foreach (var containedElement in this.ResolveFromRequestCache(elementDefinition.ContainedElement)) + { + results.Add(this.ContainedElementService.UpsertConcept(transaction, partition, containedElement, elementDefinition)); + } + + foreach (var definition in this.ResolveFromRequestCache(elementDefinition.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, elementDefinition)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(elementDefinition.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, elementDefinition)); + } + + foreach (var parameter in this.ResolveFromRequestCache(elementDefinition.Parameter)) + { + results.Add(this.ParameterService.UpsertConcept(transaction, partition, parameter, elementDefinition)); + } + + foreach (var parameterGroup in this.ResolveFromRequestCache(elementDefinition.ParameterGroup)) + { + results.Add(this.ParameterGroupService.UpsertConcept(transaction, partition, parameterGroup, elementDefinition)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ElementUsageService.cs b/CDP4WebServices.API/AutoGenServices/ElementUsageService.cs index 660b7548..a3608aac 100644 --- a/CDP4WebServices.API/AutoGenServices/ElementUsageService.cs +++ b/CDP4WebServices.API/AutoGenServices/ElementUsageService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ElementUsageDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ElementUsageDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, elementUsage); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var elementUsage = thing as ElementUsage; + var createSuccesful = this.ElementUsageDao.Upsert(transaction, partition, elementUsage, container); + return createSuccesful && this.UpsertContainment(transaction, partition, elementUsage); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ElementUsage elementUsage) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(elementUsage.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, elementUsage)); + } + + foreach (var definition in this.ResolveFromRequestCache(elementUsage.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, elementUsage)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(elementUsage.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, elementUsage)); + } + + foreach (var parameterOverride in this.ResolveFromRequestCache(elementUsage.ParameterOverride)) + { + results.Add(this.ParameterOverrideService.UpsertConcept(transaction, partition, parameterOverride, elementUsage)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/EmailAddressService.cs b/CDP4WebServices.API/AutoGenServices/EmailAddressService.cs index 22529964..72f68a36 100644 --- a/CDP4WebServices.API/AutoGenServices/EmailAddressService.cs +++ b/CDP4WebServices.API/AutoGenServices/EmailAddressService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.EmailAddressDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.EmailAddressDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.EmailAddressDao.Write(transaction, partition, emailAddress, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var emailAddress = thing as EmailAddress; + return this.EmailAddressDao.Upsert(transaction, partition, emailAddress, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/EngineeringModelDataAnnotationService.cs b/CDP4WebServices.API/AutoGenServices/EngineeringModelDataAnnotationService.cs index 9085e58f..a1c56d96 100644 --- a/CDP4WebServices.API/AutoGenServices/EngineeringModelDataAnnotationService.cs +++ b/CDP4WebServices.API/AutoGenServices/EngineeringModelDataAnnotationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", engineeringModelDataAnnotation.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var engineeringModelDataAnnotation = thing as EngineeringModelDataAnnotation; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", engineeringModelDataAnnotation.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/EngineeringModelDataDiscussionItemService.cs b/CDP4WebServices.API/AutoGenServices/EngineeringModelDataDiscussionItemService.cs index 81715085..e3bb1757 100644 --- a/CDP4WebServices.API/AutoGenServices/EngineeringModelDataDiscussionItemService.cs +++ b/CDP4WebServices.API/AutoGenServices/EngineeringModelDataDiscussionItemService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.EngineeringModelDataDiscussionItemDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.EngineeringModelDataDiscussionItemDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.EngineeringModelDataDiscussionItemDao.Write(transaction, partition, engineeringModelDataDiscussionItem, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var engineeringModelDataDiscussionItem = thing as EngineeringModelDataDiscussionItem; + return this.EngineeringModelDataDiscussionItemDao.Upsert(transaction, partition, engineeringModelDataDiscussionItem, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/EngineeringModelDataNoteService.cs b/CDP4WebServices.API/AutoGenServices/EngineeringModelDataNoteService.cs index 255800f0..d360ddad 100644 --- a/CDP4WebServices.API/AutoGenServices/EngineeringModelDataNoteService.cs +++ b/CDP4WebServices.API/AutoGenServices/EngineeringModelDataNoteService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.EngineeringModelDataNoteDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.EngineeringModelDataNoteDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -267,6 +293,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, engineeringModelDataNote); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var engineeringModelDataNote = thing as EngineeringModelDataNote; + var createSuccesful = this.EngineeringModelDataNoteDao.Upsert(transaction, partition, engineeringModelDataNote, container); + return createSuccesful && this.UpsertContainment(transaction, partition, engineeringModelDataNote); + } + /// /// Get the requested data from the ORM layer. /// @@ -405,5 +460,38 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, EngineeringModelDataNote engineeringModelDataNote) + { + var results = new List(); + + foreach (var discussion in this.ResolveFromRequestCache(engineeringModelDataNote.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, engineeringModelDataNote)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(engineeringModelDataNote.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, engineeringModelDataNote)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/EngineeringModelService.cs b/CDP4WebServices.API/AutoGenServices/EngineeringModelService.cs index 1329f09d..01130762 100644 --- a/CDP4WebServices.API/AutoGenServices/EngineeringModelService.cs +++ b/CDP4WebServices.API/AutoGenServices/EngineeringModelService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -244,6 +244,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.EngineeringModelDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.EngineeringModelDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -306,6 +332,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, engineeringModel); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var engineeringModel = thing as EngineeringModel; + var createSuccesful = this.EngineeringModelDao.Upsert(transaction, partition, engineeringModel, container); + return createSuccesful && this.UpsertContainment(transaction, partition, engineeringModel); + } + /// /// Get the requested data from the ORM layer. /// @@ -462,5 +517,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, EngineeringModel engineeringModel) + { + var results = new List(); + + foreach (var book in this.ResolveFromRequestCache(engineeringModel.Book)) + { + results.Add(this.BookService.UpsertConcept(transaction, partition, (Book)book.V, engineeringModel, book.K)); + } + + foreach (var commonFileStore in this.ResolveFromRequestCache(engineeringModel.CommonFileStore)) + { + results.Add(this.CommonFileStoreService.UpsertConcept(transaction, partition, commonFileStore, engineeringModel)); + } + + foreach (var genericNote in this.ResolveFromRequestCache(engineeringModel.GenericNote)) + { + results.Add(this.GenericNoteService.UpsertConcept(transaction, partition, genericNote, engineeringModel)); + } + + foreach (var logEntry in this.ResolveFromRequestCache(engineeringModel.LogEntry)) + { + results.Add(this.LogEntryService.UpsertConcept(transaction, partition, logEntry, engineeringModel)); + } + + foreach (var modellingAnnotation in this.ResolveFromRequestCache(engineeringModel.ModellingAnnotation)) + { + results.Add(this.ModellingAnnotationService.UpsertConcept(transaction, partition, modellingAnnotation, engineeringModel)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/EngineeringModelSetupService.cs b/CDP4WebServices.API/AutoGenServices/EngineeringModelSetupService.cs index b94ee462..97b5e39f 100644 --- a/CDP4WebServices.API/AutoGenServices/EngineeringModelSetupService.cs +++ b/CDP4WebServices.API/AutoGenServices/EngineeringModelSetupService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -230,6 +230,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.EngineeringModelSetupDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.EngineeringModelSetupDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -293,6 +319,36 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, engineeringModelSetup); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + this.TransactionManager.SetFullAccessState(true); + var engineeringModelSetup = thing as EngineeringModelSetup; + var createSuccesful = this.EngineeringModelSetupDao.Upsert(transaction, partition, engineeringModelSetup, container); + return createSuccesful && this.UpsertContainment(transaction, partition, engineeringModelSetup); + } + /// /// Get the requested data from the ORM layer. /// @@ -461,5 +517,63 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, EngineeringModelSetup engineeringModelSetup) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(engineeringModelSetup.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, engineeringModelSetup)); + } + + foreach (var definition in this.ResolveFromRequestCache(engineeringModelSetup.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, engineeringModelSetup)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(engineeringModelSetup.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, engineeringModelSetup)); + } + + foreach (var iterationSetup in this.ResolveFromRequestCache(engineeringModelSetup.IterationSetup)) + { + results.Add(this.IterationSetupService.UpsertConcept(transaction, partition, iterationSetup, engineeringModelSetup)); + } + + foreach (var organizationalParticipant in this.ResolveFromRequestCache(engineeringModelSetup.OrganizationalParticipant)) + { + results.Add(this.OrganizationalParticipantService.UpsertConcept(transaction, partition, organizationalParticipant, engineeringModelSetup)); + } + + foreach (var participant in this.ResolveFromRequestCache(engineeringModelSetup.Participant)) + { + results.Add(this.ParticipantService.UpsertConcept(transaction, partition, participant, engineeringModelSetup)); + } + + foreach (var requiredRdl in this.ResolveFromRequestCache(engineeringModelSetup.RequiredRdl)) + { + results.Add(this.RequiredRdlService.UpsertConcept(transaction, partition, requiredRdl, engineeringModelSetup)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/EnumerationParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/EnumerationParameterTypeService.cs index d46b5dce..58a97ccb 100644 --- a/CDP4WebServices.API/AutoGenServices/EnumerationParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/EnumerationParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.EnumerationParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.EnumerationParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, enumerationParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var enumerationParameterType = thing as EnumerationParameterType; + var createSuccesful = this.EnumerationParameterTypeDao.Upsert(transaction, partition, enumerationParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, enumerationParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, EnumerationParameterType enumerationParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(enumerationParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, enumerationParameterType)); + } + + foreach (var definition in this.ResolveFromRequestCache(enumerationParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, enumerationParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(enumerationParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, enumerationParameterType)); + } + + foreach (var valueDefinition in this.ResolveFromRequestCache(enumerationParameterType.ValueDefinition)) + { + results.Add(this.ValueDefinitionService.UpsertConcept(transaction, partition, (EnumerationValueDefinition)valueDefinition.V, enumerationParameterType, valueDefinition.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/EnumerationValueDefinitionService.cs b/CDP4WebServices.API/AutoGenServices/EnumerationValueDefinitionService.cs index 15c12263..37e90419 100644 --- a/CDP4WebServices.API/AutoGenServices/EnumerationValueDefinitionService.cs +++ b/CDP4WebServices.API/AutoGenServices/EnumerationValueDefinitionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.EnumerationValueDefinitionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.EnumerationValueDefinitionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, enumerationValueDefinition); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var enumerationValueDefinition = thing as EnumerationValueDefinition; + var createSuccesful = this.EnumerationValueDefinitionDao.Upsert(transaction, partition, enumerationValueDefinition, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, enumerationValueDefinition); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, EnumerationValueDefinition enumerationValueDefinition) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(enumerationValueDefinition.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, enumerationValueDefinition)); + } + + foreach (var definition in this.ResolveFromRequestCache(enumerationValueDefinition.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, enumerationValueDefinition)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(enumerationValueDefinition.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, enumerationValueDefinition)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ExclusiveOrExpressionService.cs b/CDP4WebServices.API/AutoGenServices/ExclusiveOrExpressionService.cs index 1d44939b..c4412b77 100644 --- a/CDP4WebServices.API/AutoGenServices/ExclusiveOrExpressionService.cs +++ b/CDP4WebServices.API/AutoGenServices/ExclusiveOrExpressionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ExclusiveOrExpressionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ExclusiveOrExpressionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ExclusiveOrExpressionDao.Write(transaction, partition, exclusiveOrExpression, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var exclusiveOrExpression = thing as ExclusiveOrExpression; + return this.ExclusiveOrExpressionDao.Upsert(transaction, partition, exclusiveOrExpression, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ExternalIdentifierMapService.cs b/CDP4WebServices.API/AutoGenServices/ExternalIdentifierMapService.cs index 7118e96b..c113eefc 100644 --- a/CDP4WebServices.API/AutoGenServices/ExternalIdentifierMapService.cs +++ b/CDP4WebServices.API/AutoGenServices/ExternalIdentifierMapService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ExternalIdentifierMapDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ExternalIdentifierMapDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, externalIdentifierMap); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var externalIdentifierMap = thing as ExternalIdentifierMap; + var createSuccesful = this.ExternalIdentifierMapDao.Upsert(transaction, partition, externalIdentifierMap, container); + return createSuccesful && this.UpsertContainment(transaction, partition, externalIdentifierMap); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ExternalIdentifierMap externalIdentifierMap) + { + var results = new List(); + + foreach (var correspondence in this.ResolveFromRequestCache(externalIdentifierMap.Correspondence)) + { + results.Add(this.CorrespondenceService.UpsertConcept(transaction, partition, correspondence, externalIdentifierMap)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/FileRevisionService.cs b/CDP4WebServices.API/AutoGenServices/FileRevisionService.cs index e4c8a7a9..77ac42a5 100644 --- a/CDP4WebServices.API/AutoGenServices/FileRevisionService.cs +++ b/CDP4WebServices.API/AutoGenServices/FileRevisionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.FileRevisionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.FileRevisionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.FileRevisionDao.Write(transaction, partition, fileRevision, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var fileRevision = thing as FileRevision; + return this.FileRevisionDao.Upsert(transaction, partition, fileRevision, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/FileService.cs b/CDP4WebServices.API/AutoGenServices/FileService.cs index 6ec90140..5ecfe502 100644 --- a/CDP4WebServices.API/AutoGenServices/FileService.cs +++ b/CDP4WebServices.API/AutoGenServices/FileService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.FileDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.FileDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, file); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var file = thing as File; + var createSuccesful = this.FileDao.Upsert(transaction, partition, file, container); + return createSuccesful && this.UpsertContainment(transaction, partition, file); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, File file) + { + var results = new List(); + + foreach (var fileRevision in this.ResolveFromRequestCache(file.FileRevision)) + { + results.Add(this.FileRevisionService.UpsertConcept(transaction, partition, fileRevision, file)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/FileStoreService.cs b/CDP4WebServices.API/AutoGenServices/FileStoreService.cs index 51a54dd9..626b0534 100644 --- a/CDP4WebServices.API/AutoGenServices/FileStoreService.cs +++ b/CDP4WebServices.API/AutoGenServices/FileStoreService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", fileStore.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var fileStore = thing as FileStore; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", fileStore.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/FileTypeService.cs b/CDP4WebServices.API/AutoGenServices/FileTypeService.cs index 5429293f..f98a7b56 100644 --- a/CDP4WebServices.API/AutoGenServices/FileTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/FileTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.FileTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.FileTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, fileType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var fileType = thing as FileType; + var createSuccesful = this.FileTypeDao.Upsert(transaction, partition, fileType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, fileType); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, FileType fileType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(fileType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, fileType)); + } + + foreach (var definition in this.ResolveFromRequestCache(fileType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, fileType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(fileType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, fileType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/FolderService.cs b/CDP4WebServices.API/AutoGenServices/FolderService.cs index 4bc4743a..a068d380 100644 --- a/CDP4WebServices.API/AutoGenServices/FolderService.cs +++ b/CDP4WebServices.API/AutoGenServices/FolderService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.FolderDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.FolderDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.FolderDao.Write(transaction, partition, folder, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var folder = thing as Folder; + return this.FolderDao.Upsert(transaction, partition, folder, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/GenericAnnotationService.cs b/CDP4WebServices.API/AutoGenServices/GenericAnnotationService.cs index 0aa923fc..69c5f9dc 100644 --- a/CDP4WebServices.API/AutoGenServices/GenericAnnotationService.cs +++ b/CDP4WebServices.API/AutoGenServices/GenericAnnotationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -271,6 +296,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", genericAnnotation.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var genericAnnotation = thing as GenericAnnotation; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", genericAnnotation.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/GlossaryService.cs b/CDP4WebServices.API/AutoGenServices/GlossaryService.cs index eacd5d3e..7a9be70b 100644 --- a/CDP4WebServices.API/AutoGenServices/GlossaryService.cs +++ b/CDP4WebServices.API/AutoGenServices/GlossaryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.GlossaryDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.GlossaryDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, glossary); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var glossary = thing as Glossary; + var createSuccesful = this.GlossaryDao.Upsert(transaction, partition, glossary, container); + return createSuccesful && this.UpsertContainment(transaction, partition, glossary); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Glossary glossary) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(glossary.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, glossary)); + } + + foreach (var definition in this.ResolveFromRequestCache(glossary.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, glossary)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(glossary.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, glossary)); + } + + foreach (var term in this.ResolveFromRequestCache(glossary.Term)) + { + results.Add(this.TermService.UpsertConcept(transaction, partition, term, glossary)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/GoalService.cs b/CDP4WebServices.API/AutoGenServices/GoalService.cs index 1cf5953e..1c5f227b 100644 --- a/CDP4WebServices.API/AutoGenServices/GoalService.cs +++ b/CDP4WebServices.API/AutoGenServices/GoalService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.GoalDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.GoalDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, goal); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var goal = thing as Goal; + var createSuccesful = this.GoalDao.Upsert(transaction, partition, goal, container); + return createSuccesful && this.UpsertContainment(transaction, partition, goal); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Goal goal) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(goal.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, goal)); + } + + foreach (var definition in this.ResolveFromRequestCache(goal.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, goal)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(goal.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, goal)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/HyperLinkService.cs b/CDP4WebServices.API/AutoGenServices/HyperLinkService.cs index 417b16ea..c8a24b3e 100644 --- a/CDP4WebServices.API/AutoGenServices/HyperLinkService.cs +++ b/CDP4WebServices.API/AutoGenServices/HyperLinkService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.HyperLinkDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.HyperLinkDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.HyperLinkDao.Write(transaction, partition, hyperLink, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var hyperLink = thing as HyperLink; + return this.HyperLinkDao.Upsert(transaction, partition, hyperLink, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/IPersistService.cs b/CDP4WebServices.API/AutoGenServices/IPersistService.cs index a492b728..af7a285d 100644 --- a/CDP4WebServices.API/AutoGenServices/IPersistService.cs +++ b/CDP4WebServices.API/AutoGenServices/IPersistService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -119,6 +119,30 @@ public interface IPersistService : IReadService /// bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1); + /// + /// Create the supplied DTO instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the DTO to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the create was successful. + /// + bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1); + /// /// Add the supplied value to the association property as indicated by the supplied property name. /// @@ -161,7 +185,29 @@ public interface IPersistService : IReadService /// True if the delete was successful. /// bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null); - + + /// + /// Delete the supplied DTO instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to remove. + /// + /// + /// The container instance of the DTO to be removed. + /// + /// + /// True if the delete was successful. + /// + bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null); + /// /// Remove the supplied value from the association property as indicated by the supplied property name. /// diff --git a/CDP4WebServices.API/AutoGenServices/IdCorrespondenceService.cs b/CDP4WebServices.API/AutoGenServices/IdCorrespondenceService.cs index 832f2294..f84740ab 100644 --- a/CDP4WebServices.API/AutoGenServices/IdCorrespondenceService.cs +++ b/CDP4WebServices.API/AutoGenServices/IdCorrespondenceService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.IdCorrespondenceDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.IdCorrespondenceDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.IdCorrespondenceDao.Write(transaction, partition, idCorrespondence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var idCorrespondence = thing as IdCorrespondence; + return this.IdCorrespondenceDao.Upsert(transaction, partition, idCorrespondence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/IndependentParameterTypeAssignmentService.cs b/CDP4WebServices.API/AutoGenServices/IndependentParameterTypeAssignmentService.cs index 40f461d2..4d0eb40c 100644 --- a/CDP4WebServices.API/AutoGenServices/IndependentParameterTypeAssignmentService.cs +++ b/CDP4WebServices.API/AutoGenServices/IndependentParameterTypeAssignmentService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.IndependentParameterTypeAssignmentDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.IndependentParameterTypeAssignmentDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.IndependentParameterTypeAssignmentDao.Write(transaction, partition, independentParameterTypeAssignment, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var independentParameterTypeAssignment = thing as IndependentParameterTypeAssignment; + return this.IndependentParameterTypeAssignmentDao.Upsert(transaction, partition, independentParameterTypeAssignment, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/IntervalScaleService.cs b/CDP4WebServices.API/AutoGenServices/IntervalScaleService.cs index ad327b76..32ff33bd 100644 --- a/CDP4WebServices.API/AutoGenServices/IntervalScaleService.cs +++ b/CDP4WebServices.API/AutoGenServices/IntervalScaleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.IntervalScaleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.IntervalScaleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -282,6 +308,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, intervalScale); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var intervalScale = thing as IntervalScale; + var createSuccesful = this.IntervalScaleDao.Upsert(transaction, partition, intervalScale, container); + return createSuccesful && this.UpsertContainment(transaction, partition, intervalScale); + } + /// /// Get the requested data from the ORM layer. /// @@ -438,5 +493,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, IntervalScale intervalScale) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(intervalScale.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, intervalScale)); + } + + foreach (var definition in this.ResolveFromRequestCache(intervalScale.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, intervalScale)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(intervalScale.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, intervalScale)); + } + + foreach (var mappingToReferenceScale in this.ResolveFromRequestCache(intervalScale.MappingToReferenceScale)) + { + results.Add(this.MappingToReferenceScaleService.UpsertConcept(transaction, partition, mappingToReferenceScale, intervalScale)); + } + + foreach (var valueDefinition in this.ResolveFromRequestCache(intervalScale.ValueDefinition)) + { + results.Add(this.ValueDefinitionService.UpsertConcept(transaction, partition, valueDefinition, intervalScale)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/IterationService.cs b/CDP4WebServices.API/AutoGenServices/IterationService.cs index 10992304..ea428c23 100644 --- a/CDP4WebServices.API/AutoGenServices/IterationService.cs +++ b/CDP4WebServices.API/AutoGenServices/IterationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -280,6 +280,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.IterationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.IterationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -342,6 +368,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, iteration); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var iteration = thing as Iteration; + var createSuccesful = this.IterationDao.Upsert(transaction, partition, iteration, container); + return createSuccesful && this.UpsertContainment(transaction, partition, iteration); + } + /// /// Get the requested data from the ORM layer. /// @@ -572,5 +627,114 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Iteration iteration) + { + var results = new List(); + var iterationPartition = partition.Replace("EngineeringModel", "Iteration"); + + foreach (var actualFiniteStateList in this.ResolveFromRequestCache(iteration.ActualFiniteStateList)) + { + results.Add(this.ActualFiniteStateListService.UpsertConcept(transaction, iterationPartition, actualFiniteStateList, iteration)); + } + + foreach (var diagramCanvas in this.ResolveFromRequestCache(iteration.DiagramCanvas)) + { + results.Add(this.DiagramCanvasService.UpsertConcept(transaction, iterationPartition, diagramCanvas, iteration)); + } + + foreach (var domainFileStore in this.ResolveFromRequestCache(iteration.DomainFileStore)) + { + results.Add(this.DomainFileStoreService.UpsertConcept(transaction, iterationPartition, domainFileStore, iteration)); + } + + foreach (var element in this.ResolveFromRequestCache(iteration.Element)) + { + results.Add(this.ElementService.UpsertConcept(transaction, iterationPartition, element, iteration)); + } + + foreach (var externalIdentifierMap in this.ResolveFromRequestCache(iteration.ExternalIdentifierMap)) + { + results.Add(this.ExternalIdentifierMapService.UpsertConcept(transaction, iterationPartition, externalIdentifierMap, iteration)); + } + + foreach (var goal in this.ResolveFromRequestCache(iteration.Goal)) + { + results.Add(this.GoalService.UpsertConcept(transaction, iterationPartition, goal, iteration)); + } + + foreach (var option in this.ResolveFromRequestCache(iteration.Option)) + { + results.Add(this.OptionService.UpsertConcept(transaction, iterationPartition, (Option)option.V, iteration, option.K)); + } + + foreach (var possibleFiniteStateList in this.ResolveFromRequestCache(iteration.PossibleFiniteStateList)) + { + results.Add(this.PossibleFiniteStateListService.UpsertConcept(transaction, iterationPartition, possibleFiniteStateList, iteration)); + } + + foreach (var publication in this.ResolveFromRequestCache(iteration.Publication)) + { + results.Add(this.PublicationService.UpsertConcept(transaction, iterationPartition, publication, iteration)); + } + + foreach (var relationship in this.ResolveFromRequestCache(iteration.Relationship)) + { + results.Add(this.RelationshipService.UpsertConcept(transaction, iterationPartition, relationship, iteration)); + } + + foreach (var requirementsSpecification in this.ResolveFromRequestCache(iteration.RequirementsSpecification)) + { + results.Add(this.RequirementsSpecificationService.UpsertConcept(transaction, iterationPartition, requirementsSpecification, iteration)); + } + + foreach (var ruleVerificationList in this.ResolveFromRequestCache(iteration.RuleVerificationList)) + { + results.Add(this.RuleVerificationListService.UpsertConcept(transaction, iterationPartition, ruleVerificationList, iteration)); + } + + foreach (var sharedDiagramStyle in this.ResolveFromRequestCache(iteration.SharedDiagramStyle)) + { + results.Add(this.SharedDiagramStyleService.UpsertConcept(transaction, iterationPartition, sharedDiagramStyle, iteration)); + } + + foreach (var stakeholder in this.ResolveFromRequestCache(iteration.Stakeholder)) + { + results.Add(this.StakeholderService.UpsertConcept(transaction, iterationPartition, stakeholder, iteration)); + } + + foreach (var stakeholderValue in this.ResolveFromRequestCache(iteration.StakeholderValue)) + { + results.Add(this.StakeholderValueService.UpsertConcept(transaction, iterationPartition, stakeholderValue, iteration)); + } + + foreach (var stakeholderValueMap in this.ResolveFromRequestCache(iteration.StakeholderValueMap)) + { + results.Add(this.StakeholderValueMapService.UpsertConcept(transaction, iterationPartition, stakeholderValueMap, iteration)); + } + + foreach (var valueGroup in this.ResolveFromRequestCache(iteration.ValueGroup)) + { + results.Add(this.ValueGroupService.UpsertConcept(transaction, iterationPartition, valueGroup, iteration)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/IterationSetupService.cs b/CDP4WebServices.API/AutoGenServices/IterationSetupService.cs index 26f1cb5e..ee433d91 100644 --- a/CDP4WebServices.API/AutoGenServices/IterationSetupService.cs +++ b/CDP4WebServices.API/AutoGenServices/IterationSetupService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.IterationSetupDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.IterationSetupDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.IterationSetupDao.Write(transaction, partition, iterationSetup, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var iterationSetup = thing as IterationSetup; + return this.IterationSetupDao.Upsert(transaction, partition, iterationSetup, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/LinearConversionUnitService.cs b/CDP4WebServices.API/AutoGenServices/LinearConversionUnitService.cs index f3501740..a79f1604 100644 --- a/CDP4WebServices.API/AutoGenServices/LinearConversionUnitService.cs +++ b/CDP4WebServices.API/AutoGenServices/LinearConversionUnitService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.LinearConversionUnitDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.LinearConversionUnitDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, linearConversionUnit); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var linearConversionUnit = thing as LinearConversionUnit; + var createSuccesful = this.LinearConversionUnitDao.Upsert(transaction, partition, linearConversionUnit, container); + return createSuccesful && this.UpsertContainment(transaction, partition, linearConversionUnit); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, LinearConversionUnit linearConversionUnit) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(linearConversionUnit.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, linearConversionUnit)); + } + + foreach (var definition in this.ResolveFromRequestCache(linearConversionUnit.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, linearConversionUnit)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(linearConversionUnit.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, linearConversionUnit)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/LogEntryChangelogItemService.cs b/CDP4WebServices.API/AutoGenServices/LogEntryChangelogItemService.cs index a1e68a17..876eb321 100644 --- a/CDP4WebServices.API/AutoGenServices/LogEntryChangelogItemService.cs +++ b/CDP4WebServices.API/AutoGenServices/LogEntryChangelogItemService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.LogEntryChangelogItemDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.LogEntryChangelogItemDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.LogEntryChangelogItemDao.Write(transaction, partition, logEntryChangelogItem, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var logEntryChangelogItem = thing as LogEntryChangelogItem; + return this.LogEntryChangelogItemDao.Upsert(transaction, partition, logEntryChangelogItem, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/LogarithmicScaleService.cs b/CDP4WebServices.API/AutoGenServices/LogarithmicScaleService.cs index 41580023..ef055345 100644 --- a/CDP4WebServices.API/AutoGenServices/LogarithmicScaleService.cs +++ b/CDP4WebServices.API/AutoGenServices/LogarithmicScaleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -225,6 +225,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.LogarithmicScaleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.LogarithmicScaleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -287,6 +313,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, logarithmicScale); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var logarithmicScale = thing as LogarithmicScale; + var createSuccesful = this.LogarithmicScaleDao.Upsert(transaction, partition, logarithmicScale, container); + return createSuccesful && this.UpsertContainment(transaction, partition, logarithmicScale); + } + /// /// Get the requested data from the ORM layer. /// @@ -449,5 +504,58 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, LogarithmicScale logarithmicScale) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(logarithmicScale.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, logarithmicScale)); + } + + foreach (var definition in this.ResolveFromRequestCache(logarithmicScale.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, logarithmicScale)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(logarithmicScale.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, logarithmicScale)); + } + + foreach (var mappingToReferenceScale in this.ResolveFromRequestCache(logarithmicScale.MappingToReferenceScale)) + { + results.Add(this.MappingToReferenceScaleService.UpsertConcept(transaction, partition, mappingToReferenceScale, logarithmicScale)); + } + + foreach (var referenceQuantityValue in this.ResolveFromRequestCache(logarithmicScale.ReferenceQuantityValue)) + { + results.Add(this.ReferenceQuantityValueService.UpsertConcept(transaction, partition, referenceQuantityValue, logarithmicScale)); + } + + foreach (var valueDefinition in this.ResolveFromRequestCache(logarithmicScale.ValueDefinition)) + { + results.Add(this.ValueDefinitionService.UpsertConcept(transaction, partition, valueDefinition, logarithmicScale)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/MappingToReferenceScaleService.cs b/CDP4WebServices.API/AutoGenServices/MappingToReferenceScaleService.cs index e8417d50..273417db 100644 --- a/CDP4WebServices.API/AutoGenServices/MappingToReferenceScaleService.cs +++ b/CDP4WebServices.API/AutoGenServices/MappingToReferenceScaleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.MappingToReferenceScaleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.MappingToReferenceScaleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.MappingToReferenceScaleDao.Write(transaction, partition, mappingToReferenceScale, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var mappingToReferenceScale = thing as MappingToReferenceScale; + return this.MappingToReferenceScaleDao.Upsert(transaction, partition, mappingToReferenceScale, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/MeasurementScaleService.cs b/CDP4WebServices.API/AutoGenServices/MeasurementScaleService.cs index cd8b82b9..b1694bdf 100644 --- a/CDP4WebServices.API/AutoGenServices/MeasurementScaleService.cs +++ b/CDP4WebServices.API/AutoGenServices/MeasurementScaleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -304,6 +329,53 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", measurementScale.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var measurementScale = thing as MeasurementScale; + if (measurementScale.IsSameOrDerivedClass()) + { + return this.IntervalScaleService.UpsertConcept(transaction, partition, measurementScale, container); + } + + if (measurementScale.IsSameOrDerivedClass()) + { + return this.LogarithmicScaleService.UpsertConcept(transaction, partition, measurementScale, container); + } + + if (measurementScale.IsSameOrDerivedClass()) + { + return this.OrdinalScaleService.UpsertConcept(transaction, partition, measurementScale, container); + } + + if (measurementScale.IsSameOrDerivedClass()) + { + return this.RatioScaleService.UpsertConcept(transaction, partition, measurementScale, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", measurementScale.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/MeasurementUnitService.cs b/CDP4WebServices.API/AutoGenServices/MeasurementUnitService.cs index a32f05fb..13416f58 100644 --- a/CDP4WebServices.API/AutoGenServices/MeasurementUnitService.cs +++ b/CDP4WebServices.API/AutoGenServices/MeasurementUnitService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -289,6 +314,48 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", measurementUnit.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var measurementUnit = thing as MeasurementUnit; + if (measurementUnit.IsSameOrDerivedClass()) + { + return this.ConversionBasedUnitService.UpsertConcept(transaction, partition, measurementUnit, container); + } + + if (measurementUnit.IsSameOrDerivedClass()) + { + return this.DerivedUnitService.UpsertConcept(transaction, partition, measurementUnit, container); + } + + if (measurementUnit.IsSameOrDerivedClass()) + { + return this.SimpleUnitService.UpsertConcept(transaction, partition, measurementUnit, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", measurementUnit.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ModelLogEntryService.cs b/CDP4WebServices.API/AutoGenServices/ModelLogEntryService.cs index c158c827..35c62dfc 100644 --- a/CDP4WebServices.API/AutoGenServices/ModelLogEntryService.cs +++ b/CDP4WebServices.API/AutoGenServices/ModelLogEntryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ModelLogEntryDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ModelLogEntryDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, modelLogEntry); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var modelLogEntry = thing as ModelLogEntry; + var createSuccesful = this.ModelLogEntryDao.Upsert(transaction, partition, modelLogEntry, container); + return createSuccesful && this.UpsertContainment(transaction, partition, modelLogEntry); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ModelLogEntry modelLogEntry) + { + var results = new List(); + + foreach (var logEntryChangelogItem in this.ResolveFromRequestCache(modelLogEntry.LogEntryChangelogItem)) + { + results.Add(this.LogEntryChangelogItemService.UpsertConcept(transaction, partition, logEntryChangelogItem, modelLogEntry)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ModelReferenceDataLibraryService.cs b/CDP4WebServices.API/AutoGenServices/ModelReferenceDataLibraryService.cs index 2a644653..70e0a195 100644 --- a/CDP4WebServices.API/AutoGenServices/ModelReferenceDataLibraryService.cs +++ b/CDP4WebServices.API/AutoGenServices/ModelReferenceDataLibraryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -260,6 +260,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ModelReferenceDataLibraryDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ModelReferenceDataLibraryDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -322,6 +348,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, modelReferenceDataLibrary); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var modelReferenceDataLibrary = thing as ModelReferenceDataLibrary; + var createSuccesful = this.ModelReferenceDataLibraryDao.Upsert(transaction, partition, modelReferenceDataLibrary, container); + return createSuccesful && this.UpsertContainment(transaction, partition, modelReferenceDataLibrary); + } + /// /// Get the requested data from the ORM layer. /// @@ -532,5 +587,93 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ModelReferenceDataLibrary modelReferenceDataLibrary) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(modelReferenceDataLibrary.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, modelReferenceDataLibrary)); + } + + foreach (var constant in this.ResolveFromRequestCache(modelReferenceDataLibrary.Constant)) + { + results.Add(this.ConstantService.UpsertConcept(transaction, partition, constant, modelReferenceDataLibrary)); + } + + foreach (var definedCategory in this.ResolveFromRequestCache(modelReferenceDataLibrary.DefinedCategory)) + { + results.Add(this.DefinedCategoryService.UpsertConcept(transaction, partition, definedCategory, modelReferenceDataLibrary)); + } + + foreach (var definition in this.ResolveFromRequestCache(modelReferenceDataLibrary.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, modelReferenceDataLibrary)); + } + + foreach (var fileType in this.ResolveFromRequestCache(modelReferenceDataLibrary.FileType)) + { + results.Add(this.FileTypeService.UpsertConcept(transaction, partition, fileType, modelReferenceDataLibrary)); + } + + foreach (var glossary in this.ResolveFromRequestCache(modelReferenceDataLibrary.Glossary)) + { + results.Add(this.GlossaryService.UpsertConcept(transaction, partition, glossary, modelReferenceDataLibrary)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(modelReferenceDataLibrary.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, modelReferenceDataLibrary)); + } + + foreach (var parameterType in this.ResolveFromRequestCache(modelReferenceDataLibrary.ParameterType)) + { + results.Add(this.ParameterTypeService.UpsertConcept(transaction, partition, parameterType, modelReferenceDataLibrary)); + } + + foreach (var referenceSource in this.ResolveFromRequestCache(modelReferenceDataLibrary.ReferenceSource)) + { + results.Add(this.ReferenceSourceService.UpsertConcept(transaction, partition, referenceSource, modelReferenceDataLibrary)); + } + + foreach (var rule in this.ResolveFromRequestCache(modelReferenceDataLibrary.Rule)) + { + results.Add(this.RuleService.UpsertConcept(transaction, partition, rule, modelReferenceDataLibrary)); + } + + foreach (var scale in this.ResolveFromRequestCache(modelReferenceDataLibrary.Scale)) + { + results.Add(this.ScaleService.UpsertConcept(transaction, partition, scale, modelReferenceDataLibrary)); + } + + foreach (var unit in this.ResolveFromRequestCache(modelReferenceDataLibrary.Unit)) + { + results.Add(this.UnitService.UpsertConcept(transaction, partition, unit, modelReferenceDataLibrary)); + } + + foreach (var unitPrefix in this.ResolveFromRequestCache(modelReferenceDataLibrary.UnitPrefix)) + { + results.Add(this.UnitPrefixService.UpsertConcept(transaction, partition, unitPrefix, modelReferenceDataLibrary)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ModellingAnnotationItemService.cs b/CDP4WebServices.API/AutoGenServices/ModellingAnnotationItemService.cs index 3d55ced0..393ce1b8 100644 --- a/CDP4WebServices.API/AutoGenServices/ModellingAnnotationItemService.cs +++ b/CDP4WebServices.API/AutoGenServices/ModellingAnnotationItemService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -319,6 +344,58 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", modellingAnnotationItem.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var modellingAnnotationItem = thing as ModellingAnnotationItem; + if (modellingAnnotationItem.IsSameOrDerivedClass()) + { + return this.ActionItemService.UpsertConcept(transaction, partition, modellingAnnotationItem, container); + } + + if (modellingAnnotationItem.IsSameOrDerivedClass()) + { + return this.ChangeProposalService.UpsertConcept(transaction, partition, modellingAnnotationItem, container); + } + + if (modellingAnnotationItem.IsSameOrDerivedClass()) + { + return this.ContractChangeNoticeService.UpsertConcept(transaction, partition, modellingAnnotationItem, container); + } + + if (modellingAnnotationItem.IsSameOrDerivedClass()) + { + return this.ContractDeviationService.UpsertConcept(transaction, partition, modellingAnnotationItem, container); + } + + if (modellingAnnotationItem.IsSameOrDerivedClass()) + { + return this.ReviewItemDiscrepancyService.UpsertConcept(transaction, partition, modellingAnnotationItem, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", modellingAnnotationItem.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ModellingThingReferenceService.cs b/CDP4WebServices.API/AutoGenServices/ModellingThingReferenceService.cs index c2fa53e0..614374fa 100644 --- a/CDP4WebServices.API/AutoGenServices/ModellingThingReferenceService.cs +++ b/CDP4WebServices.API/AutoGenServices/ModellingThingReferenceService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ModellingThingReferenceDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ModellingThingReferenceDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ModellingThingReferenceDao.Write(transaction, partition, modellingThingReference, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var modellingThingReference = thing as ModellingThingReference; + return this.ModellingThingReferenceDao.Upsert(transaction, partition, modellingThingReference, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/MultiRelationshipRuleService.cs b/CDP4WebServices.API/AutoGenServices/MultiRelationshipRuleService.cs index afa324ba..ddd3cde4 100644 --- a/CDP4WebServices.API/AutoGenServices/MultiRelationshipRuleService.cs +++ b/CDP4WebServices.API/AutoGenServices/MultiRelationshipRuleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.MultiRelationshipRuleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.MultiRelationshipRuleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, multiRelationshipRule); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var multiRelationshipRule = thing as MultiRelationshipRule; + var createSuccesful = this.MultiRelationshipRuleDao.Upsert(transaction, partition, multiRelationshipRule, container); + return createSuccesful && this.UpsertContainment(transaction, partition, multiRelationshipRule); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, MultiRelationshipRule multiRelationshipRule) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(multiRelationshipRule.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, multiRelationshipRule)); + } + + foreach (var definition in this.ResolveFromRequestCache(multiRelationshipRule.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, multiRelationshipRule)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(multiRelationshipRule.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, multiRelationshipRule)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/MultiRelationshipService.cs b/CDP4WebServices.API/AutoGenServices/MultiRelationshipService.cs index 6c659172..bc588e3c 100644 --- a/CDP4WebServices.API/AutoGenServices/MultiRelationshipService.cs +++ b/CDP4WebServices.API/AutoGenServices/MultiRelationshipService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.MultiRelationshipDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.MultiRelationshipDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, multiRelationship); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var multiRelationship = thing as MultiRelationship; + var createSuccesful = this.MultiRelationshipDao.Upsert(transaction, partition, multiRelationship, container); + return createSuccesful && this.UpsertContainment(transaction, partition, multiRelationship); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, MultiRelationship multiRelationship) + { + var results = new List(); + + foreach (var parameterValue in this.ResolveFromRequestCache(multiRelationship.ParameterValue)) + { + results.Add(this.ParameterValueService.UpsertConcept(transaction, partition, parameterValue, multiRelationship)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/NaturalLanguageService.cs b/CDP4WebServices.API/AutoGenServices/NaturalLanguageService.cs index 009f805a..4e932057 100644 --- a/CDP4WebServices.API/AutoGenServices/NaturalLanguageService.cs +++ b/CDP4WebServices.API/AutoGenServices/NaturalLanguageService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.NaturalLanguageDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.NaturalLanguageDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.NaturalLanguageDao.Write(transaction, partition, naturalLanguage, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var naturalLanguage = thing as NaturalLanguage; + return this.NaturalLanguageDao.Upsert(transaction, partition, naturalLanguage, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/NestedElementService.cs b/CDP4WebServices.API/AutoGenServices/NestedElementService.cs index 977150ac..8edd2ccb 100644 --- a/CDP4WebServices.API/AutoGenServices/NestedElementService.cs +++ b/CDP4WebServices.API/AutoGenServices/NestedElementService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.NestedElementDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.NestedElementDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, nestedElement); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var nestedElement = thing as NestedElement; + var createSuccesful = this.NestedElementDao.Upsert(transaction, partition, nestedElement, container); + return createSuccesful && this.UpsertContainment(transaction, partition, nestedElement); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, NestedElement nestedElement) + { + var results = new List(); + + foreach (var nestedParameter in this.ResolveFromRequestCache(nestedElement.NestedParameter)) + { + results.Add(this.NestedParameterService.UpsertConcept(transaction, partition, nestedParameter, nestedElement)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/NestedParameterService.cs b/CDP4WebServices.API/AutoGenServices/NestedParameterService.cs index 2595db21..7cef9398 100644 --- a/CDP4WebServices.API/AutoGenServices/NestedParameterService.cs +++ b/CDP4WebServices.API/AutoGenServices/NestedParameterService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.NestedParameterDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.NestedParameterDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.NestedParameterDao.Write(transaction, partition, nestedParameter, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var nestedParameter = thing as NestedParameter; + return this.NestedParameterDao.Upsert(transaction, partition, nestedParameter, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/NotExpressionService.cs b/CDP4WebServices.API/AutoGenServices/NotExpressionService.cs index a136e3ed..6595286b 100644 --- a/CDP4WebServices.API/AutoGenServices/NotExpressionService.cs +++ b/CDP4WebServices.API/AutoGenServices/NotExpressionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.NotExpressionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.NotExpressionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.NotExpressionDao.Write(transaction, partition, notExpression, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var notExpression = thing as NotExpression; + return this.NotExpressionDao.Upsert(transaction, partition, notExpression, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/NoteService.cs b/CDP4WebServices.API/AutoGenServices/NoteService.cs index 5000f212..f2d9c99e 100644 --- a/CDP4WebServices.API/AutoGenServices/NoteService.cs +++ b/CDP4WebServices.API/AutoGenServices/NoteService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -274,6 +299,43 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", note.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var note = thing as Note; + if (note.IsSameOrDerivedClass()) + { + return this.BinaryNoteService.UpsertConcept(transaction, partition, note, container, sequence); + } + + if (note.IsSameOrDerivedClass()) + { + return this.TextualNoteService.UpsertConcept(transaction, partition, note, container, sequence); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", note.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/OptionService.cs b/CDP4WebServices.API/AutoGenServices/OptionService.cs index 4c3b8757..61f4d237 100644 --- a/CDP4WebServices.API/AutoGenServices/OptionService.cs +++ b/CDP4WebServices.API/AutoGenServices/OptionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.OptionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.OptionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, option); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var option = thing as Option; + var createSuccesful = this.OptionDao.Upsert(transaction, partition, option, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, option); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Option option) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(option.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, option)); + } + + foreach (var definition in this.ResolveFromRequestCache(option.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, option)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(option.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, option)); + } + + foreach (var nestedElement in this.ResolveFromRequestCache(option.NestedElement)) + { + results.Add(this.NestedElementService.UpsertConcept(transaction, partition, nestedElement, option)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/OrExpressionService.cs b/CDP4WebServices.API/AutoGenServices/OrExpressionService.cs index 972bf807..9ff2923a 100644 --- a/CDP4WebServices.API/AutoGenServices/OrExpressionService.cs +++ b/CDP4WebServices.API/AutoGenServices/OrExpressionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.OrExpressionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.OrExpressionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.OrExpressionDao.Write(transaction, partition, orExpression, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var orExpression = thing as OrExpression; + return this.OrExpressionDao.Upsert(transaction, partition, orExpression, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/OrdinalScaleService.cs b/CDP4WebServices.API/AutoGenServices/OrdinalScaleService.cs index 83662199..c178a47f 100644 --- a/CDP4WebServices.API/AutoGenServices/OrdinalScaleService.cs +++ b/CDP4WebServices.API/AutoGenServices/OrdinalScaleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.OrdinalScaleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.OrdinalScaleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -282,6 +308,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, ordinalScale); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var ordinalScale = thing as OrdinalScale; + var createSuccesful = this.OrdinalScaleDao.Upsert(transaction, partition, ordinalScale, container); + return createSuccesful && this.UpsertContainment(transaction, partition, ordinalScale); + } + /// /// Get the requested data from the ORM layer. /// @@ -438,5 +493,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, OrdinalScale ordinalScale) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(ordinalScale.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, ordinalScale)); + } + + foreach (var definition in this.ResolveFromRequestCache(ordinalScale.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, ordinalScale)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(ordinalScale.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, ordinalScale)); + } + + foreach (var mappingToReferenceScale in this.ResolveFromRequestCache(ordinalScale.MappingToReferenceScale)) + { + results.Add(this.MappingToReferenceScaleService.UpsertConcept(transaction, partition, mappingToReferenceScale, ordinalScale)); + } + + foreach (var valueDefinition in this.ResolveFromRequestCache(ordinalScale.ValueDefinition)) + { + results.Add(this.ValueDefinitionService.UpsertConcept(transaction, partition, valueDefinition, ordinalScale)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/OrganizationService.cs b/CDP4WebServices.API/AutoGenServices/OrganizationService.cs index 90ea125a..ab6fad78 100644 --- a/CDP4WebServices.API/AutoGenServices/OrganizationService.cs +++ b/CDP4WebServices.API/AutoGenServices/OrganizationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.OrganizationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.OrganizationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.OrganizationDao.Write(transaction, partition, organization, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var organization = thing as Organization; + return this.OrganizationDao.Upsert(transaction, partition, organization, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/OrganizationalParticipantService.cs b/CDP4WebServices.API/AutoGenServices/OrganizationalParticipantService.cs index f6c08c18..8ba6310e 100644 --- a/CDP4WebServices.API/AutoGenServices/OrganizationalParticipantService.cs +++ b/CDP4WebServices.API/AutoGenServices/OrganizationalParticipantService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.OrganizationalParticipantDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.OrganizationalParticipantDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.OrganizationalParticipantDao.Write(transaction, partition, organizationalParticipant, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var organizationalParticipant = thing as OrganizationalParticipant; + return this.OrganizationalParticipantDao.Upsert(transaction, partition, organizationalParticipant, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/OwnedStyleService.cs b/CDP4WebServices.API/AutoGenServices/OwnedStyleService.cs index 6527858d..e2bf2d84 100644 --- a/CDP4WebServices.API/AutoGenServices/OwnedStyleService.cs +++ b/CDP4WebServices.API/AutoGenServices/OwnedStyleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.OwnedStyleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.OwnedStyleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, ownedStyle); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var ownedStyle = thing as OwnedStyle; + var createSuccesful = this.OwnedStyleDao.Upsert(transaction, partition, ownedStyle, container); + return createSuccesful && this.UpsertContainment(transaction, partition, ownedStyle); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, OwnedStyle ownedStyle) + { + var results = new List(); + + foreach (var usedColor in this.ResolveFromRequestCache(ownedStyle.UsedColor)) + { + results.Add(this.UsedColorService.UpsertConcept(transaction, partition, usedColor, ownedStyle)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/PageService.cs b/CDP4WebServices.API/AutoGenServices/PageService.cs index 333cf9d5..db582441 100644 --- a/CDP4WebServices.API/AutoGenServices/PageService.cs +++ b/CDP4WebServices.API/AutoGenServices/PageService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PageDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PageDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, page); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var page = thing as Page; + var createSuccesful = this.PageDao.Upsert(transaction, partition, page, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, page); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Page page) + { + var results = new List(); + + foreach (var note in this.ResolveFromRequestCache(page.Note)) + { + results.Add(this.NoteService.UpsertConcept(transaction, partition, (Note)note.V, page, note.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ParameterBaseService.cs b/CDP4WebServices.API/AutoGenServices/ParameterBaseService.cs index 03f0956d..f092116b 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterBaseService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterBaseService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterBase.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterBase = thing as ParameterBase; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterBase.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterGroupService.cs b/CDP4WebServices.API/AutoGenServices/ParameterGroupService.cs index f5ee5a01..eff0bbc6 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterGroupService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterGroupService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterGroupDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterGroupDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterGroupDao.Write(transaction, partition, parameterGroup, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterGroup = thing as ParameterGroup; + return this.ParameterGroupDao.Upsert(transaction, partition, parameterGroup, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterOrOverrideBaseService.cs b/CDP4WebServices.API/AutoGenServices/ParameterOrOverrideBaseService.cs index 776ec434..830d63ef 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterOrOverrideBaseService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterOrOverrideBaseService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterOrOverrideBase.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterOrOverrideBase = thing as ParameterOrOverrideBase; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterOrOverrideBase.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterOverrideService.cs b/CDP4WebServices.API/AutoGenServices/ParameterOverrideService.cs index eecc1d86..22a94cfe 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterOverrideService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterOverrideService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterOverrideDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterOverrideDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -267,6 +293,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, parameterOverride); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterOverride = thing as ParameterOverride; + var createSuccesful = this.ParameterOverrideDao.Upsert(transaction, partition, parameterOverride, container); + return createSuccesful && this.UpsertContainment(transaction, partition, parameterOverride); + } + /// /// Get the requested data from the ORM layer. /// @@ -405,5 +460,38 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ParameterOverride parameterOverride) + { + var results = new List(); + + foreach (var parameterSubscription in this.ResolveFromRequestCache(parameterOverride.ParameterSubscription)) + { + results.Add(this.ParameterSubscriptionService.UpsertConcept(transaction, partition, parameterSubscription, parameterOverride)); + } + + foreach (var valueSet in this.ResolveFromRequestCache(parameterOverride.ValueSet)) + { + results.Add(this.ValueSetService.UpsertConcept(transaction, partition, valueSet, parameterOverride)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ParameterOverrideValueSetService.cs b/CDP4WebServices.API/AutoGenServices/ParameterOverrideValueSetService.cs index 27c8b60f..eb046aca 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterOverrideValueSetService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterOverrideValueSetService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterOverrideValueSetDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterOverrideValueSetDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterOverrideValueSetDao.Write(transaction, partition, parameterOverrideValueSet, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterOverrideValueSet = thing as ParameterOverrideValueSet; + return this.ParameterOverrideValueSetDao.Upsert(transaction, partition, parameterOverrideValueSet, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterService.cs b/CDP4WebServices.API/AutoGenServices/ParameterService.cs index 727f0288..757f5519 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -267,6 +293,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, parameter); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameter = thing as Parameter; + var createSuccesful = this.ParameterDao.Upsert(transaction, partition, parameter, container); + return createSuccesful && this.UpsertContainment(transaction, partition, parameter); + } + /// /// Get the requested data from the ORM layer. /// @@ -405,5 +460,38 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Parameter parameter) + { + var results = new List(); + + foreach (var parameterSubscription in this.ResolveFromRequestCache(parameter.ParameterSubscription)) + { + results.Add(this.ParameterSubscriptionService.UpsertConcept(transaction, partition, parameterSubscription, parameter)); + } + + foreach (var valueSet in this.ResolveFromRequestCache(parameter.ValueSet)) + { + results.Add(this.ValueSetService.UpsertConcept(transaction, partition, valueSet, parameter)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionService.cs b/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionService.cs index 47faf5f1..0ded9e12 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterSubscriptionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterSubscriptionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, parameterSubscription); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterSubscription = thing as ParameterSubscription; + var createSuccesful = this.ParameterSubscriptionDao.Upsert(transaction, partition, parameterSubscription, container); + return createSuccesful && this.UpsertContainment(transaction, partition, parameterSubscription); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ParameterSubscription parameterSubscription) + { + var results = new List(); + + foreach (var valueSet in this.ResolveFromRequestCache(parameterSubscription.ValueSet)) + { + results.Add(this.ValueSetService.UpsertConcept(transaction, partition, valueSet, parameterSubscription)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionValueSetService.cs b/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionValueSetService.cs index a9b22e7e..27f48976 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionValueSetService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterSubscriptionValueSetService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterSubscriptionValueSetDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterSubscriptionValueSetDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterSubscriptionValueSetDao.Write(transaction, partition, parameterSubscriptionValueSet, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterSubscriptionValueSet = thing as ParameterSubscriptionValueSet; + return this.ParameterSubscriptionValueSetDao.Upsert(transaction, partition, parameterSubscriptionValueSet, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterTypeComponentService.cs b/CDP4WebServices.API/AutoGenServices/ParameterTypeComponentService.cs index 68a939f3..3c40ce17 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterTypeComponentService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterTypeComponentService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterTypeComponentDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterTypeComponentDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterTypeComponentDao.Write(transaction, partition, parameterTypeComponent, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterTypeComponent = thing as ParameterTypeComponent; + return this.ParameterTypeComponentDao.Upsert(transaction, partition, parameterTypeComponent, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/ParameterTypeService.cs index a24a39b4..a8d1722e 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -289,6 +314,48 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", parameterType.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterType = thing as ParameterType; + if (parameterType.IsSameOrDerivedClass()) + { + return this.CompoundParameterTypeService.UpsertConcept(transaction, partition, parameterType, container); + } + + if (parameterType.IsSameOrDerivedClass()) + { + return this.SampledFunctionParameterTypeService.UpsertConcept(transaction, partition, parameterType, container); + } + + if (parameterType.IsSameOrDerivedClass()) + { + return this.ScalarParameterTypeService.UpsertConcept(transaction, partition, parameterType, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", parameterType.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterValueService.cs b/CDP4WebServices.API/AutoGenServices/ParameterValueService.cs index 4b9ac87b..fad31e30 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterValueService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterValueService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterValue.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterValue = thing as ParameterValue; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterValue.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterValueSetBaseService.cs b/CDP4WebServices.API/AutoGenServices/ParameterValueSetBaseService.cs index 560b87d6..ea8e944d 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterValueSetBaseService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterValueSetBaseService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterValueSetBase.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterValueSetBase = thing as ParameterValueSetBase; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", parameterValueSetBase.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterValueSetService.cs b/CDP4WebServices.API/AutoGenServices/ParameterValueSetService.cs index 1bef16c2..da0912df 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterValueSetService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterValueSetService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterValueSetDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterValueSetDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterValueSetDao.Write(transaction, partition, parameterValueSet, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterValueSet = thing as ParameterValueSet; + return this.ParameterValueSetDao.Upsert(transaction, partition, parameterValueSet, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParameterizedCategoryRuleService.cs b/CDP4WebServices.API/AutoGenServices/ParameterizedCategoryRuleService.cs index b39b4fce..03737ab2 100644 --- a/CDP4WebServices.API/AutoGenServices/ParameterizedCategoryRuleService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParameterizedCategoryRuleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParameterizedCategoryRuleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParameterizedCategoryRuleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, parameterizedCategoryRule); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parameterizedCategoryRule = thing as ParameterizedCategoryRule; + var createSuccesful = this.ParameterizedCategoryRuleDao.Upsert(transaction, partition, parameterizedCategoryRule, container); + return createSuccesful && this.UpsertContainment(transaction, partition, parameterizedCategoryRule); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ParameterizedCategoryRule parameterizedCategoryRule) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(parameterizedCategoryRule.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, parameterizedCategoryRule)); + } + + foreach (var definition in this.ResolveFromRequestCache(parameterizedCategoryRule.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, parameterizedCategoryRule)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(parameterizedCategoryRule.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, parameterizedCategoryRule)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ParametricConstraintService.cs b/CDP4WebServices.API/AutoGenServices/ParametricConstraintService.cs index 072f8edf..b4bbb33c 100644 --- a/CDP4WebServices.API/AutoGenServices/ParametricConstraintService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParametricConstraintService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParametricConstraintDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParametricConstraintDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, parametricConstraint); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var parametricConstraint = thing as ParametricConstraint; + var createSuccesful = this.ParametricConstraintDao.Upsert(transaction, partition, parametricConstraint, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, parametricConstraint); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ParametricConstraint parametricConstraint) + { + var results = new List(); + + foreach (var expression in this.ResolveFromRequestCache(parametricConstraint.Expression)) + { + results.Add(this.ExpressionService.UpsertConcept(transaction, partition, expression, parametricConstraint)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ParticipantPermissionService.cs b/CDP4WebServices.API/AutoGenServices/ParticipantPermissionService.cs index 8c1c1838..8266c03a 100644 --- a/CDP4WebServices.API/AutoGenServices/ParticipantPermissionService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParticipantPermissionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParticipantPermissionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParticipantPermissionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParticipantPermissionDao.Write(transaction, partition, participantPermission, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var participantPermission = thing as ParticipantPermission; + return this.ParticipantPermissionDao.Upsert(transaction, partition, participantPermission, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ParticipantRoleService.cs b/CDP4WebServices.API/AutoGenServices/ParticipantRoleService.cs index 870646d1..b3543920 100644 --- a/CDP4WebServices.API/AutoGenServices/ParticipantRoleService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParticipantRoleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParticipantRoleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParticipantRoleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, participantRole); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var participantRole = thing as ParticipantRole; + var createSuccesful = this.ParticipantRoleDao.Upsert(transaction, partition, participantRole, container); + return createSuccesful && this.UpsertContainment(transaction, partition, participantRole); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ParticipantRole participantRole) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(participantRole.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, participantRole)); + } + + foreach (var definition in this.ResolveFromRequestCache(participantRole.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, participantRole)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(participantRole.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, participantRole)); + } + + foreach (var participantPermission in this.ResolveFromRequestCache(participantRole.ParticipantPermission)) + { + results.Add(this.ParticipantPermissionService.UpsertConcept(transaction, partition, participantPermission, participantRole)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ParticipantService.cs b/CDP4WebServices.API/AutoGenServices/ParticipantService.cs index 03fcda5a..040fc885 100644 --- a/CDP4WebServices.API/AutoGenServices/ParticipantService.cs +++ b/CDP4WebServices.API/AutoGenServices/ParticipantService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParticipantDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ParticipantDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ParticipantDao.Write(transaction, partition, participant, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var participant = thing as Participant; + return this.ParticipantDao.Upsert(transaction, partition, participant, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/PersonPermissionService.cs b/CDP4WebServices.API/AutoGenServices/PersonPermissionService.cs index 1e1503ac..42140b0a 100644 --- a/CDP4WebServices.API/AutoGenServices/PersonPermissionService.cs +++ b/CDP4WebServices.API/AutoGenServices/PersonPermissionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PersonPermissionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PersonPermissionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.PersonPermissionDao.Write(transaction, partition, personPermission, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var personPermission = thing as PersonPermission; + return this.PersonPermissionDao.Upsert(transaction, partition, personPermission, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/PersonRoleService.cs b/CDP4WebServices.API/AutoGenServices/PersonRoleService.cs index 363a61ae..01e45bd6 100644 --- a/CDP4WebServices.API/AutoGenServices/PersonRoleService.cs +++ b/CDP4WebServices.API/AutoGenServices/PersonRoleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PersonRoleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PersonRoleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, personRole); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var personRole = thing as PersonRole; + var createSuccesful = this.PersonRoleDao.Upsert(transaction, partition, personRole, container); + return createSuccesful && this.UpsertContainment(transaction, partition, personRole); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, PersonRole personRole) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(personRole.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, personRole)); + } + + foreach (var definition in this.ResolveFromRequestCache(personRole.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, personRole)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(personRole.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, personRole)); + } + + foreach (var personPermission in this.ResolveFromRequestCache(personRole.PersonPermission)) + { + results.Add(this.PersonPermissionService.UpsertConcept(transaction, partition, personPermission, personRole)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/PersonService.cs b/CDP4WebServices.API/AutoGenServices/PersonService.cs index 97828d59..aac784cd 100644 --- a/CDP4WebServices.API/AutoGenServices/PersonService.cs +++ b/CDP4WebServices.API/AutoGenServices/PersonService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PersonDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PersonDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, person); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var person = thing as Person; + var createSuccesful = this.PersonDao.Upsert(transaction, partition, person, container); + return createSuccesful && this.UpsertContainment(transaction, partition, person); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Person person) + { + var results = new List(); + + foreach (var emailAddress in this.ResolveFromRequestCache(person.EmailAddress)) + { + results.Add(this.EmailAddressService.UpsertConcept(transaction, partition, emailAddress, person)); + } + + foreach (var telephoneNumber in this.ResolveFromRequestCache(person.TelephoneNumber)) + { + results.Add(this.TelephoneNumberService.UpsertConcept(transaction, partition, telephoneNumber, person)); + } + + foreach (var userPreference in this.ResolveFromRequestCache(person.UserPreference)) + { + results.Add(this.UserPreferenceService.UpsertConcept(transaction, partition, userPreference, person)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/PointService.cs b/CDP4WebServices.API/AutoGenServices/PointService.cs index 1b046891..3984b39e 100644 --- a/CDP4WebServices.API/AutoGenServices/PointService.cs +++ b/CDP4WebServices.API/AutoGenServices/PointService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PointDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PointDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.PointDao.Write(transaction, partition, point, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var point = thing as Point; + return this.PointDao.Upsert(transaction, partition, point, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateListService.cs b/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateListService.cs index f5622d5e..2278f88d 100644 --- a/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateListService.cs +++ b/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateListService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PossibleFiniteStateListDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PossibleFiniteStateListDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, possibleFiniteStateList); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var possibleFiniteStateList = thing as PossibleFiniteStateList; + var createSuccesful = this.PossibleFiniteStateListDao.Upsert(transaction, partition, possibleFiniteStateList, container); + return createSuccesful && this.UpsertContainment(transaction, partition, possibleFiniteStateList); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, PossibleFiniteStateList possibleFiniteStateList) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(possibleFiniteStateList.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, possibleFiniteStateList)); + } + + foreach (var definition in this.ResolveFromRequestCache(possibleFiniteStateList.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, possibleFiniteStateList)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(possibleFiniteStateList.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, possibleFiniteStateList)); + } + + foreach (var possibleState in this.ResolveFromRequestCache(possibleFiniteStateList.PossibleState)) + { + results.Add(this.PossibleStateService.UpsertConcept(transaction, partition, (PossibleFiniteState)possibleState.V, possibleFiniteStateList, possibleState.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateService.cs b/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateService.cs index 5b09ca9b..a4f47377 100644 --- a/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateService.cs +++ b/CDP4WebServices.API/AutoGenServices/PossibleFiniteStateService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PossibleFiniteStateDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PossibleFiniteStateDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, possibleFiniteState); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var possibleFiniteState = thing as PossibleFiniteState; + var createSuccesful = this.PossibleFiniteStateDao.Upsert(transaction, partition, possibleFiniteState, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, possibleFiniteState); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, PossibleFiniteState possibleFiniteState) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(possibleFiniteState.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, possibleFiniteState)); + } + + foreach (var definition in this.ResolveFromRequestCache(possibleFiniteState.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, possibleFiniteState)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(possibleFiniteState.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, possibleFiniteState)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/PrefixedUnitService.cs b/CDP4WebServices.API/AutoGenServices/PrefixedUnitService.cs index 891d29c8..c7786005 100644 --- a/CDP4WebServices.API/AutoGenServices/PrefixedUnitService.cs +++ b/CDP4WebServices.API/AutoGenServices/PrefixedUnitService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PrefixedUnitDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PrefixedUnitDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, prefixedUnit); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var prefixedUnit = thing as PrefixedUnit; + var createSuccesful = this.PrefixedUnitDao.Upsert(transaction, partition, prefixedUnit, container); + return createSuccesful && this.UpsertContainment(transaction, partition, prefixedUnit); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, PrefixedUnit prefixedUnit) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(prefixedUnit.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, prefixedUnit)); + } + + foreach (var definition in this.ResolveFromRequestCache(prefixedUnit.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, prefixedUnit)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(prefixedUnit.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, prefixedUnit)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/PublicationService.cs b/CDP4WebServices.API/AutoGenServices/PublicationService.cs index 0f451cfc..c30c306b 100644 --- a/CDP4WebServices.API/AutoGenServices/PublicationService.cs +++ b/CDP4WebServices.API/AutoGenServices/PublicationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.PublicationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.PublicationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.PublicationDao.Write(transaction, partition, publication, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var publication = thing as Publication; + return this.PublicationDao.Upsert(transaction, partition, publication, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/QuantityKindFactorService.cs b/CDP4WebServices.API/AutoGenServices/QuantityKindFactorService.cs index 548f0134..f03bff94 100644 --- a/CDP4WebServices.API/AutoGenServices/QuantityKindFactorService.cs +++ b/CDP4WebServices.API/AutoGenServices/QuantityKindFactorService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.QuantityKindFactorDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.QuantityKindFactorDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.QuantityKindFactorDao.Write(transaction, partition, quantityKindFactor, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var quantityKindFactor = thing as QuantityKindFactor; + return this.QuantityKindFactorDao.Upsert(transaction, partition, quantityKindFactor, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/QuantityKindService.cs b/CDP4WebServices.API/AutoGenServices/QuantityKindService.cs index d2293a75..d2b7c5de 100644 --- a/CDP4WebServices.API/AutoGenServices/QuantityKindService.cs +++ b/CDP4WebServices.API/AutoGenServices/QuantityKindService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -289,6 +314,48 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", quantityKind.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var quantityKind = thing as QuantityKind; + if (quantityKind.IsSameOrDerivedClass()) + { + return this.DerivedQuantityKindService.UpsertConcept(transaction, partition, quantityKind, container); + } + + if (quantityKind.IsSameOrDerivedClass()) + { + return this.SimpleQuantityKindService.UpsertConcept(transaction, partition, quantityKind, container); + } + + if (quantityKind.IsSameOrDerivedClass()) + { + return this.SpecializedQuantityKindService.UpsertConcept(transaction, partition, quantityKind, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", quantityKind.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RatioScaleService.cs b/CDP4WebServices.API/AutoGenServices/RatioScaleService.cs index 117a8b7b..415418fe 100644 --- a/CDP4WebServices.API/AutoGenServices/RatioScaleService.cs +++ b/CDP4WebServices.API/AutoGenServices/RatioScaleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -225,6 +225,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RatioScaleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RatioScaleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -296,6 +322,40 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, ratioScale); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var ratioScale = thing as RatioScale; + if (ratioScale.IsSameOrDerivedClass()) + { + return this.CyclicRatioScaleService.UpsertConcept(transaction, partition, ratioScale, container); + } + + var createSuccesful = this.RatioScaleDao.Upsert(transaction, partition, ratioScale, container); + return createSuccesful && this.UpsertContainment(transaction, partition, ratioScale); + } + /// /// Get the requested data from the ORM layer. /// @@ -457,5 +517,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, RatioScale ratioScale) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(ratioScale.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, ratioScale)); + } + + foreach (var definition in this.ResolveFromRequestCache(ratioScale.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, ratioScale)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(ratioScale.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, ratioScale)); + } + + foreach (var mappingToReferenceScale in this.ResolveFromRequestCache(ratioScale.MappingToReferenceScale)) + { + results.Add(this.MappingToReferenceScaleService.UpsertConcept(transaction, partition, mappingToReferenceScale, ratioScale)); + } + + foreach (var valueDefinition in this.ResolveFromRequestCache(ratioScale.ValueDefinition)) + { + results.Add(this.ValueDefinitionService.UpsertConcept(transaction, partition, valueDefinition, ratioScale)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ReferenceDataLibraryService.cs b/CDP4WebServices.API/AutoGenServices/ReferenceDataLibraryService.cs index 92671fe0..744ce6c5 100644 --- a/CDP4WebServices.API/AutoGenServices/ReferenceDataLibraryService.cs +++ b/CDP4WebServices.API/AutoGenServices/ReferenceDataLibraryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", referenceDataLibrary.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var referenceDataLibrary = thing as ReferenceDataLibrary; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", referenceDataLibrary.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ReferenceSourceService.cs b/CDP4WebServices.API/AutoGenServices/ReferenceSourceService.cs index dc2c071d..2c0d7471 100644 --- a/CDP4WebServices.API/AutoGenServices/ReferenceSourceService.cs +++ b/CDP4WebServices.API/AutoGenServices/ReferenceSourceService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ReferenceSourceDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ReferenceSourceDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, referenceSource); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var referenceSource = thing as ReferenceSource; + var createSuccesful = this.ReferenceSourceDao.Upsert(transaction, partition, referenceSource, container); + return createSuccesful && this.UpsertContainment(transaction, partition, referenceSource); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ReferenceSource referenceSource) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(referenceSource.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, referenceSource)); + } + + foreach (var definition in this.ResolveFromRequestCache(referenceSource.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, referenceSource)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(referenceSource.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, referenceSource)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ReferencerRuleService.cs b/CDP4WebServices.API/AutoGenServices/ReferencerRuleService.cs index afa4b629..6a058fcc 100644 --- a/CDP4WebServices.API/AutoGenServices/ReferencerRuleService.cs +++ b/CDP4WebServices.API/AutoGenServices/ReferencerRuleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ReferencerRuleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ReferencerRuleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, referencerRule); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var referencerRule = thing as ReferencerRule; + var createSuccesful = this.ReferencerRuleDao.Upsert(transaction, partition, referencerRule, container); + return createSuccesful && this.UpsertContainment(transaction, partition, referencerRule); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ReferencerRule referencerRule) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(referencerRule.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, referencerRule)); + } + + foreach (var definition in this.ResolveFromRequestCache(referencerRule.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, referencerRule)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(referencerRule.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, referencerRule)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/RelationalExpressionService.cs b/CDP4WebServices.API/AutoGenServices/RelationalExpressionService.cs index 1a349cbf..55a1b343 100644 --- a/CDP4WebServices.API/AutoGenServices/RelationalExpressionService.cs +++ b/CDP4WebServices.API/AutoGenServices/RelationalExpressionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RelationalExpressionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RelationalExpressionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.RelationalExpressionDao.Write(transaction, partition, relationalExpression, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var relationalExpression = thing as RelationalExpression; + return this.RelationalExpressionDao.Upsert(transaction, partition, relationalExpression, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RelationshipParameterValueService.cs b/CDP4WebServices.API/AutoGenServices/RelationshipParameterValueService.cs index 61302b76..a9505757 100644 --- a/CDP4WebServices.API/AutoGenServices/RelationshipParameterValueService.cs +++ b/CDP4WebServices.API/AutoGenServices/RelationshipParameterValueService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RelationshipParameterValueDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RelationshipParameterValueDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.RelationshipParameterValueDao.Write(transaction, partition, relationshipParameterValue, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var relationshipParameterValue = thing as RelationshipParameterValue; + return this.RelationshipParameterValueDao.Upsert(transaction, partition, relationshipParameterValue, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RelationshipService.cs b/CDP4WebServices.API/AutoGenServices/RelationshipService.cs index 60b2189b..52c66028 100644 --- a/CDP4WebServices.API/AutoGenServices/RelationshipService.cs +++ b/CDP4WebServices.API/AutoGenServices/RelationshipService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -274,6 +299,43 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", relationship.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var relationship = thing as Relationship; + if (relationship.IsSameOrDerivedClass()) + { + return this.BinaryRelationshipService.UpsertConcept(transaction, partition, relationship, container); + } + + if (relationship.IsSameOrDerivedClass()) + { + return this.MultiRelationshipService.UpsertConcept(transaction, partition, relationship, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", relationship.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RequestForDeviationService.cs b/CDP4WebServices.API/AutoGenServices/RequestForDeviationService.cs index 569e9a7d..933dd8b5 100644 --- a/CDP4WebServices.API/AutoGenServices/RequestForDeviationService.cs +++ b/CDP4WebServices.API/AutoGenServices/RequestForDeviationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RequestForDeviationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RequestForDeviationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, requestForDeviation); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var requestForDeviation = thing as RequestForDeviation; + var createSuccesful = this.RequestForDeviationDao.Upsert(transaction, partition, requestForDeviation, container); + return createSuccesful && this.UpsertContainment(transaction, partition, requestForDeviation); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, RequestForDeviation requestForDeviation) + { + var results = new List(); + + foreach (var approvedBy in this.ResolveFromRequestCache(requestForDeviation.ApprovedBy)) + { + results.Add(this.ApprovedByService.UpsertConcept(transaction, partition, approvedBy, requestForDeviation)); + } + + foreach (var discussion in this.ResolveFromRequestCache(requestForDeviation.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, requestForDeviation)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(requestForDeviation.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, requestForDeviation)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/RequestForWaiverService.cs b/CDP4WebServices.API/AutoGenServices/RequestForWaiverService.cs index 2efad63b..76214f05 100644 --- a/CDP4WebServices.API/AutoGenServices/RequestForWaiverService.cs +++ b/CDP4WebServices.API/AutoGenServices/RequestForWaiverService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RequestForWaiverDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RequestForWaiverDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, requestForWaiver); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var requestForWaiver = thing as RequestForWaiver; + var createSuccesful = this.RequestForWaiverDao.Upsert(transaction, partition, requestForWaiver, container); + return createSuccesful && this.UpsertContainment(transaction, partition, requestForWaiver); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, RequestForWaiver requestForWaiver) + { + var results = new List(); + + foreach (var approvedBy in this.ResolveFromRequestCache(requestForWaiver.ApprovedBy)) + { + results.Add(this.ApprovedByService.UpsertConcept(transaction, partition, approvedBy, requestForWaiver)); + } + + foreach (var discussion in this.ResolveFromRequestCache(requestForWaiver.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, requestForWaiver)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(requestForWaiver.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, requestForWaiver)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/RequirementService.cs b/CDP4WebServices.API/AutoGenServices/RequirementService.cs index 4793fa0f..c4c2a975 100644 --- a/CDP4WebServices.API/AutoGenServices/RequirementService.cs +++ b/CDP4WebServices.API/AutoGenServices/RequirementService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RequirementDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RequirementDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -282,6 +308,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, requirement); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var requirement = thing as Requirement; + var createSuccesful = this.RequirementDao.Upsert(transaction, partition, requirement, container); + return createSuccesful && this.UpsertContainment(transaction, partition, requirement); + } + /// /// Get the requested data from the ORM layer. /// @@ -438,5 +493,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Requirement requirement) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(requirement.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, requirement)); + } + + foreach (var definition in this.ResolveFromRequestCache(requirement.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, requirement)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(requirement.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, requirement)); + } + + foreach (var parameterValue in this.ResolveFromRequestCache(requirement.ParameterValue)) + { + results.Add(this.ParameterValueService.UpsertConcept(transaction, partition, parameterValue, requirement)); + } + + foreach (var parametricConstraint in this.ResolveFromRequestCache(requirement.ParametricConstraint)) + { + results.Add(this.ParametricConstraintService.UpsertConcept(transaction, partition, (ParametricConstraint)parametricConstraint.V, requirement, parametricConstraint.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/RequirementsContainerParameterValueService.cs b/CDP4WebServices.API/AutoGenServices/RequirementsContainerParameterValueService.cs index b72451db..78ffa4b4 100644 --- a/CDP4WebServices.API/AutoGenServices/RequirementsContainerParameterValueService.cs +++ b/CDP4WebServices.API/AutoGenServices/RequirementsContainerParameterValueService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RequirementsContainerParameterValueDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RequirementsContainerParameterValueDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.RequirementsContainerParameterValueDao.Write(transaction, partition, requirementsContainerParameterValue, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var requirementsContainerParameterValue = thing as RequirementsContainerParameterValue; + return this.RequirementsContainerParameterValueDao.Upsert(transaction, partition, requirementsContainerParameterValue, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RequirementsContainerService.cs b/CDP4WebServices.API/AutoGenServices/RequirementsContainerService.cs index de861c77..dbc5b1bb 100644 --- a/CDP4WebServices.API/AutoGenServices/RequirementsContainerService.cs +++ b/CDP4WebServices.API/AutoGenServices/RequirementsContainerService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", requirementsContainer.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var requirementsContainer = thing as RequirementsContainer; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", requirementsContainer.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RequirementsGroupService.cs b/CDP4WebServices.API/AutoGenServices/RequirementsGroupService.cs index 9c86d898..1da61eb5 100644 --- a/CDP4WebServices.API/AutoGenServices/RequirementsGroupService.cs +++ b/CDP4WebServices.API/AutoGenServices/RequirementsGroupService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RequirementsGroupDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RequirementsGroupDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -282,6 +308,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, requirementsGroup); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var requirementsGroup = thing as RequirementsGroup; + var createSuccesful = this.RequirementsGroupDao.Upsert(transaction, partition, requirementsGroup, container); + return createSuccesful && this.UpsertContainment(transaction, partition, requirementsGroup); + } + /// /// Get the requested data from the ORM layer. /// @@ -438,5 +493,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, RequirementsGroup requirementsGroup) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(requirementsGroup.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, requirementsGroup)); + } + + foreach (var definition in this.ResolveFromRequestCache(requirementsGroup.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, requirementsGroup)); + } + + foreach (var group in this.ResolveFromRequestCache(requirementsGroup.Group)) + { + results.Add(this.GroupService.UpsertConcept(transaction, partition, group, requirementsGroup)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(requirementsGroup.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, requirementsGroup)); + } + + foreach (var parameterValue in this.ResolveFromRequestCache(requirementsGroup.ParameterValue)) + { + results.Add(this.ParameterValueService.UpsertConcept(transaction, partition, parameterValue, requirementsGroup)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/RequirementsSpecificationService.cs b/CDP4WebServices.API/AutoGenServices/RequirementsSpecificationService.cs index 60e42d6a..1b795c25 100644 --- a/CDP4WebServices.API/AutoGenServices/RequirementsSpecificationService.cs +++ b/CDP4WebServices.API/AutoGenServices/RequirementsSpecificationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -225,6 +225,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RequirementsSpecificationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RequirementsSpecificationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -287,6 +313,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, requirementsSpecification); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var requirementsSpecification = thing as RequirementsSpecification; + var createSuccesful = this.RequirementsSpecificationDao.Upsert(transaction, partition, requirementsSpecification, container); + return createSuccesful && this.UpsertContainment(transaction, partition, requirementsSpecification); + } + /// /// Get the requested data from the ORM layer. /// @@ -449,5 +504,58 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, RequirementsSpecification requirementsSpecification) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(requirementsSpecification.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, requirementsSpecification)); + } + + foreach (var definition in this.ResolveFromRequestCache(requirementsSpecification.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, requirementsSpecification)); + } + + foreach (var group in this.ResolveFromRequestCache(requirementsSpecification.Group)) + { + results.Add(this.GroupService.UpsertConcept(transaction, partition, group, requirementsSpecification)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(requirementsSpecification.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, requirementsSpecification)); + } + + foreach (var parameterValue in this.ResolveFromRequestCache(requirementsSpecification.ParameterValue)) + { + results.Add(this.ParameterValueService.UpsertConcept(transaction, partition, parameterValue, requirementsSpecification)); + } + + foreach (var requirement in this.ResolveFromRequestCache(requirementsSpecification.Requirement)) + { + results.Add(this.RequirementService.UpsertConcept(transaction, partition, requirement, requirementsSpecification)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ReviewItemDiscrepancyService.cs b/CDP4WebServices.API/AutoGenServices/ReviewItemDiscrepancyService.cs index bb6fed47..a3349d65 100644 --- a/CDP4WebServices.API/AutoGenServices/ReviewItemDiscrepancyService.cs +++ b/CDP4WebServices.API/AutoGenServices/ReviewItemDiscrepancyService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ReviewItemDiscrepancyDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ReviewItemDiscrepancyDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, reviewItemDiscrepancy); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var reviewItemDiscrepancy = thing as ReviewItemDiscrepancy; + var createSuccesful = this.ReviewItemDiscrepancyDao.Upsert(transaction, partition, reviewItemDiscrepancy, container); + return createSuccesful && this.UpsertContainment(transaction, partition, reviewItemDiscrepancy); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ReviewItemDiscrepancy reviewItemDiscrepancy) + { + var results = new List(); + + foreach (var approvedBy in this.ResolveFromRequestCache(reviewItemDiscrepancy.ApprovedBy)) + { + results.Add(this.ApprovedByService.UpsertConcept(transaction, partition, approvedBy, reviewItemDiscrepancy)); + } + + foreach (var discussion in this.ResolveFromRequestCache(reviewItemDiscrepancy.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, reviewItemDiscrepancy)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(reviewItemDiscrepancy.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, reviewItemDiscrepancy)); + } + + foreach (var solution in this.ResolveFromRequestCache(reviewItemDiscrepancy.Solution)) + { + results.Add(this.SolutionService.UpsertConcept(transaction, partition, solution, reviewItemDiscrepancy)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/RuleService.cs b/CDP4WebServices.API/AutoGenServices/RuleService.cs index 7644f49a..174b60a2 100644 --- a/CDP4WebServices.API/AutoGenServices/RuleService.cs +++ b/CDP4WebServices.API/AutoGenServices/RuleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -319,6 +344,58 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", rule.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var rule = thing as Rule; + if (rule.IsSameOrDerivedClass()) + { + return this.BinaryRelationshipRuleService.UpsertConcept(transaction, partition, rule, container); + } + + if (rule.IsSameOrDerivedClass()) + { + return this.DecompositionRuleService.UpsertConcept(transaction, partition, rule, container); + } + + if (rule.IsSameOrDerivedClass()) + { + return this.MultiRelationshipRuleService.UpsertConcept(transaction, partition, rule, container); + } + + if (rule.IsSameOrDerivedClass()) + { + return this.ParameterizedCategoryRuleService.UpsertConcept(transaction, partition, rule, container); + } + + if (rule.IsSameOrDerivedClass()) + { + return this.ReferencerRuleService.UpsertConcept(transaction, partition, rule, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", rule.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RuleVerificationListService.cs b/CDP4WebServices.API/AutoGenServices/RuleVerificationListService.cs index 72c3f40d..c51c3d48 100644 --- a/CDP4WebServices.API/AutoGenServices/RuleVerificationListService.cs +++ b/CDP4WebServices.API/AutoGenServices/RuleVerificationListService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RuleVerificationListDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RuleVerificationListDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, ruleVerificationList); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var ruleVerificationList = thing as RuleVerificationList; + var createSuccesful = this.RuleVerificationListDao.Upsert(transaction, partition, ruleVerificationList, container); + return createSuccesful && this.UpsertContainment(transaction, partition, ruleVerificationList); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, RuleVerificationList ruleVerificationList) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(ruleVerificationList.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, ruleVerificationList)); + } + + foreach (var definition in this.ResolveFromRequestCache(ruleVerificationList.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, ruleVerificationList)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(ruleVerificationList.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, ruleVerificationList)); + } + + foreach (var ruleVerification in this.ResolveFromRequestCache(ruleVerificationList.RuleVerification)) + { + results.Add(this.RuleVerificationService.UpsertConcept(transaction, partition, (RuleVerification)ruleVerification.V, ruleVerificationList, ruleVerification.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/RuleVerificationService.cs b/CDP4WebServices.API/AutoGenServices/RuleVerificationService.cs index 35757557..6cb20682 100644 --- a/CDP4WebServices.API/AutoGenServices/RuleVerificationService.cs +++ b/CDP4WebServices.API/AutoGenServices/RuleVerificationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -274,6 +299,43 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", ruleVerification.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var ruleVerification = thing as RuleVerification; + if (ruleVerification.IsSameOrDerivedClass()) + { + return this.BuiltInRuleVerificationService.UpsertConcept(transaction, partition, ruleVerification, container, sequence); + } + + if (ruleVerification.IsSameOrDerivedClass()) + { + return this.UserRuleVerificationService.UpsertConcept(transaction, partition, ruleVerification, container, sequence); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", ruleVerification.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/RuleViolationService.cs b/CDP4WebServices.API/AutoGenServices/RuleViolationService.cs index 6fea479c..4fa97039 100644 --- a/CDP4WebServices.API/AutoGenServices/RuleViolationService.cs +++ b/CDP4WebServices.API/AutoGenServices/RuleViolationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.RuleViolationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.RuleViolationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.RuleViolationDao.Write(transaction, partition, ruleViolation, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var ruleViolation = thing as RuleViolation; + return this.RuleViolationDao.Upsert(transaction, partition, ruleViolation, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/SampledFunctionParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/SampledFunctionParameterTypeService.cs index 1853afa5..1ab66c80 100644 --- a/CDP4WebServices.API/AutoGenServices/SampledFunctionParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/SampledFunctionParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SampledFunctionParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SampledFunctionParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -282,6 +308,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, sampledFunctionParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var sampledFunctionParameterType = thing as SampledFunctionParameterType; + var createSuccesful = this.SampledFunctionParameterTypeDao.Upsert(transaction, partition, sampledFunctionParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, sampledFunctionParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -438,5 +493,53 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SampledFunctionParameterType sampledFunctionParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(sampledFunctionParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, sampledFunctionParameterType)); + } + + foreach (var definition in this.ResolveFromRequestCache(sampledFunctionParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, sampledFunctionParameterType)); + } + + foreach (var dependentParameterType in this.ResolveFromRequestCache(sampledFunctionParameterType.DependentParameterType)) + { + results.Add(this.DependentParameterTypeService.UpsertConcept(transaction, partition, (DependentParameterTypeAssignment)dependentParameterType.V, sampledFunctionParameterType, dependentParameterType.K)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(sampledFunctionParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, sampledFunctionParameterType)); + } + + foreach (var independentParameterType in this.ResolveFromRequestCache(sampledFunctionParameterType.IndependentParameterType)) + { + results.Add(this.IndependentParameterTypeService.UpsertConcept(transaction, partition, (IndependentParameterTypeAssignment)independentParameterType.V, sampledFunctionParameterType, independentParameterType.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ScalarParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/ScalarParameterTypeService.cs index 33f306a5..db2cddeb 100644 --- a/CDP4WebServices.API/AutoGenServices/ScalarParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/ScalarParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -220,6 +220,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -349,6 +374,68 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", scalarParameterType.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var scalarParameterType = thing as ScalarParameterType; + if (scalarParameterType.IsSameOrDerivedClass()) + { + return this.BooleanParameterTypeService.UpsertConcept(transaction, partition, scalarParameterType, container); + } + + if (scalarParameterType.IsSameOrDerivedClass()) + { + return this.DateParameterTypeService.UpsertConcept(transaction, partition, scalarParameterType, container); + } + + if (scalarParameterType.IsSameOrDerivedClass()) + { + return this.DateTimeParameterTypeService.UpsertConcept(transaction, partition, scalarParameterType, container); + } + + if (scalarParameterType.IsSameOrDerivedClass()) + { + return this.EnumerationParameterTypeService.UpsertConcept(transaction, partition, scalarParameterType, container); + } + + if (scalarParameterType.IsSameOrDerivedClass()) + { + return this.QuantityKindService.UpsertConcept(transaction, partition, scalarParameterType, container); + } + + if (scalarParameterType.IsSameOrDerivedClass()) + { + return this.TextParameterTypeService.UpsertConcept(transaction, partition, scalarParameterType, container); + } + + if (scalarParameterType.IsSameOrDerivedClass()) + { + return this.TimeOfDayParameterTypeService.UpsertConcept(transaction, partition, scalarParameterType, container); + } + throw new NotSupportedException(string.Format("The supplied DTO type: {0} is not a supported type", scalarParameterType.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ScaleReferenceQuantityValueService.cs b/CDP4WebServices.API/AutoGenServices/ScaleReferenceQuantityValueService.cs index e4403fdf..177bea76 100644 --- a/CDP4WebServices.API/AutoGenServices/ScaleReferenceQuantityValueService.cs +++ b/CDP4WebServices.API/AutoGenServices/ScaleReferenceQuantityValueService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ScaleReferenceQuantityValueDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ScaleReferenceQuantityValueDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.ScaleReferenceQuantityValueDao.Write(transaction, partition, scaleReferenceQuantityValue, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var scaleReferenceQuantityValue = thing as ScaleReferenceQuantityValue; + return this.ScaleReferenceQuantityValueDao.Upsert(transaction, partition, scaleReferenceQuantityValue, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ScaleValueDefinitionService.cs b/CDP4WebServices.API/AutoGenServices/ScaleValueDefinitionService.cs index 7571ee47..2368186e 100644 --- a/CDP4WebServices.API/AutoGenServices/ScaleValueDefinitionService.cs +++ b/CDP4WebServices.API/AutoGenServices/ScaleValueDefinitionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ScaleValueDefinitionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ScaleValueDefinitionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, scaleValueDefinition); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var scaleValueDefinition = thing as ScaleValueDefinition; + var createSuccesful = this.ScaleValueDefinitionDao.Upsert(transaction, partition, scaleValueDefinition, container); + return createSuccesful && this.UpsertContainment(transaction, partition, scaleValueDefinition); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ScaleValueDefinition scaleValueDefinition) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(scaleValueDefinition.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, scaleValueDefinition)); + } + + foreach (var definition in this.ResolveFromRequestCache(scaleValueDefinition.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, scaleValueDefinition)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(scaleValueDefinition.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, scaleValueDefinition)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SectionService.cs b/CDP4WebServices.API/AutoGenServices/SectionService.cs index 9f4cf24d..db792c4c 100644 --- a/CDP4WebServices.API/AutoGenServices/SectionService.cs +++ b/CDP4WebServices.API/AutoGenServices/SectionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SectionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SectionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, section); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var section = thing as Section; + var createSuccesful = this.SectionDao.Upsert(transaction, partition, section, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, section); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Section section) + { + var results = new List(); + + foreach (var page in this.ResolveFromRequestCache(section.Page)) + { + results.Add(this.PageService.UpsertConcept(transaction, partition, (Page)page.V, section, page.K)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SharedStyleService.cs b/CDP4WebServices.API/AutoGenServices/SharedStyleService.cs index 2466afb8..12c848a5 100644 --- a/CDP4WebServices.API/AutoGenServices/SharedStyleService.cs +++ b/CDP4WebServices.API/AutoGenServices/SharedStyleService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SharedStyleDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SharedStyleDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, sharedStyle); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var sharedStyle = thing as SharedStyle; + var createSuccesful = this.SharedStyleDao.Upsert(transaction, partition, sharedStyle, container); + return createSuccesful && this.UpsertContainment(transaction, partition, sharedStyle); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SharedStyle sharedStyle) + { + var results = new List(); + + foreach (var usedColor in this.ResolveFromRequestCache(sharedStyle.UsedColor)) + { + results.Add(this.UsedColorService.UpsertConcept(transaction, partition, usedColor, sharedStyle)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SimpleParameterValueService.cs b/CDP4WebServices.API/AutoGenServices/SimpleParameterValueService.cs index a83cf845..58201306 100644 --- a/CDP4WebServices.API/AutoGenServices/SimpleParameterValueService.cs +++ b/CDP4WebServices.API/AutoGenServices/SimpleParameterValueService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SimpleParameterValueDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SimpleParameterValueDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.SimpleParameterValueDao.Write(transaction, partition, simpleParameterValue, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var simpleParameterValue = thing as SimpleParameterValue; + return this.SimpleParameterValueDao.Upsert(transaction, partition, simpleParameterValue, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/SimpleParameterizableThingService.cs b/CDP4WebServices.API/AutoGenServices/SimpleParameterizableThingService.cs index ab24640e..f04bac8d 100644 --- a/CDP4WebServices.API/AutoGenServices/SimpleParameterizableThingService.cs +++ b/CDP4WebServices.API/AutoGenServices/SimpleParameterizableThingService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -190,6 +190,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -251,6 +276,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", simpleParameterizableThing.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var simpleParameterizableThing = thing as SimpleParameterizableThing; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", simpleParameterizableThing.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/SimpleQuantityKindService.cs b/CDP4WebServices.API/AutoGenServices/SimpleQuantityKindService.cs index 895c4d05..999f60d1 100644 --- a/CDP4WebServices.API/AutoGenServices/SimpleQuantityKindService.cs +++ b/CDP4WebServices.API/AutoGenServices/SimpleQuantityKindService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SimpleQuantityKindDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SimpleQuantityKindDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, simpleQuantityKind); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var simpleQuantityKind = thing as SimpleQuantityKind; + var createSuccesful = this.SimpleQuantityKindDao.Upsert(transaction, partition, simpleQuantityKind, container); + return createSuccesful && this.UpsertContainment(transaction, partition, simpleQuantityKind); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SimpleQuantityKind simpleQuantityKind) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(simpleQuantityKind.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, simpleQuantityKind)); + } + + foreach (var definition in this.ResolveFromRequestCache(simpleQuantityKind.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, simpleQuantityKind)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(simpleQuantityKind.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, simpleQuantityKind)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SimpleUnitService.cs b/CDP4WebServices.API/AutoGenServices/SimpleUnitService.cs index c9e0d81d..4811b276 100644 --- a/CDP4WebServices.API/AutoGenServices/SimpleUnitService.cs +++ b/CDP4WebServices.API/AutoGenServices/SimpleUnitService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SimpleUnitDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SimpleUnitDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, simpleUnit); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var simpleUnit = thing as SimpleUnit; + var createSuccesful = this.SimpleUnitDao.Upsert(transaction, partition, simpleUnit, container); + return createSuccesful && this.UpsertContainment(transaction, partition, simpleUnit); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SimpleUnit simpleUnit) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(simpleUnit.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, simpleUnit)); + } + + foreach (var definition in this.ResolveFromRequestCache(simpleUnit.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, simpleUnit)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(simpleUnit.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, simpleUnit)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataAnnotationService.cs b/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataAnnotationService.cs index 6df54e24..70a73d71 100644 --- a/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataAnnotationService.cs +++ b/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataAnnotationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -205,6 +205,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteDirectoryDataAnnotationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SiteDirectoryDataAnnotationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -267,6 +293,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, siteDirectoryDataAnnotation); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var siteDirectoryDataAnnotation = thing as SiteDirectoryDataAnnotation; + var createSuccesful = this.SiteDirectoryDataAnnotationDao.Upsert(transaction, partition, siteDirectoryDataAnnotation, container); + return createSuccesful && this.UpsertContainment(transaction, partition, siteDirectoryDataAnnotation); + } + /// /// Get the requested data from the ORM layer. /// @@ -405,5 +460,38 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SiteDirectoryDataAnnotation siteDirectoryDataAnnotation) + { + var results = new List(); + + foreach (var discussion in this.ResolveFromRequestCache(siteDirectoryDataAnnotation.Discussion)) + { + results.Add(this.DiscussionService.UpsertConcept(transaction, partition, discussion, siteDirectoryDataAnnotation)); + } + + foreach (var relatedThing in this.ResolveFromRequestCache(siteDirectoryDataAnnotation.RelatedThing)) + { + results.Add(this.RelatedThingService.UpsertConcept(transaction, partition, relatedThing, siteDirectoryDataAnnotation)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataDiscussionItemService.cs b/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataDiscussionItemService.cs index 035137e6..48e5f997 100644 --- a/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataDiscussionItemService.cs +++ b/CDP4WebServices.API/AutoGenServices/SiteDirectoryDataDiscussionItemService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteDirectoryDataDiscussionItemDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SiteDirectoryDataDiscussionItemDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteDirectoryDataDiscussionItemDao.Write(transaction, partition, siteDirectoryDataDiscussionItem, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var siteDirectoryDataDiscussionItem = thing as SiteDirectoryDataDiscussionItem; + return this.SiteDirectoryDataDiscussionItemDao.Upsert(transaction, partition, siteDirectoryDataDiscussionItem, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/SiteDirectoryService.cs b/CDP4WebServices.API/AutoGenServices/SiteDirectoryService.cs index 161686c8..ad761b85 100644 --- a/CDP4WebServices.API/AutoGenServices/SiteDirectoryService.cs +++ b/CDP4WebServices.API/AutoGenServices/SiteDirectoryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -274,6 +274,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteDirectoryDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SiteDirectoryDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -336,6 +362,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, siteDirectory); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var siteDirectory = thing as SiteDirectory; + var createSuccesful = this.SiteDirectoryDao.Upsert(transaction, partition, siteDirectory, container); + return createSuccesful && this.UpsertContainment(transaction, partition, siteDirectory); + } + /// /// Get the requested data from the ORM layer. /// @@ -528,5 +583,83 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SiteDirectory siteDirectory) + { + var results = new List(); + + foreach (var annotation in this.ResolveFromRequestCache(siteDirectory.Annotation)) + { + results.Add(this.AnnotationService.UpsertConcept(transaction, partition, annotation, siteDirectory)); + } + + foreach (var domain in this.ResolveFromRequestCache(siteDirectory.Domain)) + { + results.Add(this.DomainService.UpsertConcept(transaction, partition, domain, siteDirectory)); + } + + foreach (var domainGroup in this.ResolveFromRequestCache(siteDirectory.DomainGroup)) + { + results.Add(this.DomainGroupService.UpsertConcept(transaction, partition, domainGroup, siteDirectory)); + } + + foreach (var logEntry in this.ResolveFromRequestCache(siteDirectory.LogEntry)) + { + results.Add(this.LogEntryService.UpsertConcept(transaction, partition, logEntry, siteDirectory)); + } + + foreach (var model in this.ResolveFromRequestCache(siteDirectory.Model)) + { + results.Add(this.ModelService.UpsertConcept(transaction, partition, model, siteDirectory)); + } + + foreach (var naturalLanguage in this.ResolveFromRequestCache(siteDirectory.NaturalLanguage)) + { + results.Add(this.NaturalLanguageService.UpsertConcept(transaction, partition, naturalLanguage, siteDirectory)); + } + + foreach (var organization in this.ResolveFromRequestCache(siteDirectory.Organization)) + { + results.Add(this.OrganizationService.UpsertConcept(transaction, partition, organization, siteDirectory)); + } + + foreach (var participantRole in this.ResolveFromRequestCache(siteDirectory.ParticipantRole)) + { + results.Add(this.ParticipantRoleService.UpsertConcept(transaction, partition, participantRole, siteDirectory)); + } + + foreach (var person in this.ResolveFromRequestCache(siteDirectory.Person)) + { + results.Add(this.PersonService.UpsertConcept(transaction, partition, person, siteDirectory)); + } + + foreach (var personRole in this.ResolveFromRequestCache(siteDirectory.PersonRole)) + { + results.Add(this.PersonRoleService.UpsertConcept(transaction, partition, personRole, siteDirectory)); + } + + foreach (var siteReferenceDataLibrary in this.ResolveFromRequestCache(siteDirectory.SiteReferenceDataLibrary)) + { + results.Add(this.SiteReferenceDataLibraryService.UpsertConcept(transaction, partition, siteReferenceDataLibrary, siteDirectory)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SiteDirectoryThingReferenceService.cs b/CDP4WebServices.API/AutoGenServices/SiteDirectoryThingReferenceService.cs index 4b92ee28..20f96d31 100644 --- a/CDP4WebServices.API/AutoGenServices/SiteDirectoryThingReferenceService.cs +++ b/CDP4WebServices.API/AutoGenServices/SiteDirectoryThingReferenceService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteDirectoryThingReferenceDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SiteDirectoryThingReferenceDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteDirectoryThingReferenceDao.Write(transaction, partition, siteDirectoryThingReference, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var siteDirectoryThingReference = thing as SiteDirectoryThingReference; + return this.SiteDirectoryThingReferenceDao.Upsert(transaction, partition, siteDirectoryThingReference, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/SiteLogEntryService.cs b/CDP4WebServices.API/AutoGenServices/SiteLogEntryService.cs index a587f243..d353ff22 100644 --- a/CDP4WebServices.API/AutoGenServices/SiteLogEntryService.cs +++ b/CDP4WebServices.API/AutoGenServices/SiteLogEntryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteLogEntryDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SiteLogEntryDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, siteLogEntry); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var siteLogEntry = thing as SiteLogEntry; + var createSuccesful = this.SiteLogEntryDao.Upsert(transaction, partition, siteLogEntry, container); + return createSuccesful && this.UpsertContainment(transaction, partition, siteLogEntry); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SiteLogEntry siteLogEntry) + { + var results = new List(); + + foreach (var logEntryChangelogItem in this.ResolveFromRequestCache(siteLogEntry.LogEntryChangelogItem)) + { + results.Add(this.LogEntryChangelogItemService.UpsertConcept(transaction, partition, logEntryChangelogItem, siteLogEntry)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SiteReferenceDataLibraryService.cs b/CDP4WebServices.API/AutoGenServices/SiteReferenceDataLibraryService.cs index 580b858f..d944eb8b 100644 --- a/CDP4WebServices.API/AutoGenServices/SiteReferenceDataLibraryService.cs +++ b/CDP4WebServices.API/AutoGenServices/SiteReferenceDataLibraryService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -260,6 +260,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SiteReferenceDataLibraryDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SiteReferenceDataLibraryDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -322,6 +348,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, siteReferenceDataLibrary); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var siteReferenceDataLibrary = thing as SiteReferenceDataLibrary; + var createSuccesful = this.SiteReferenceDataLibraryDao.Upsert(transaction, partition, siteReferenceDataLibrary, container); + return createSuccesful && this.UpsertContainment(transaction, partition, siteReferenceDataLibrary); + } + /// /// Get the requested data from the ORM layer. /// @@ -532,5 +587,93 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SiteReferenceDataLibrary siteReferenceDataLibrary) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(siteReferenceDataLibrary.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, siteReferenceDataLibrary)); + } + + foreach (var constant in this.ResolveFromRequestCache(siteReferenceDataLibrary.Constant)) + { + results.Add(this.ConstantService.UpsertConcept(transaction, partition, constant, siteReferenceDataLibrary)); + } + + foreach (var definedCategory in this.ResolveFromRequestCache(siteReferenceDataLibrary.DefinedCategory)) + { + results.Add(this.DefinedCategoryService.UpsertConcept(transaction, partition, definedCategory, siteReferenceDataLibrary)); + } + + foreach (var definition in this.ResolveFromRequestCache(siteReferenceDataLibrary.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, siteReferenceDataLibrary)); + } + + foreach (var fileType in this.ResolveFromRequestCache(siteReferenceDataLibrary.FileType)) + { + results.Add(this.FileTypeService.UpsertConcept(transaction, partition, fileType, siteReferenceDataLibrary)); + } + + foreach (var glossary in this.ResolveFromRequestCache(siteReferenceDataLibrary.Glossary)) + { + results.Add(this.GlossaryService.UpsertConcept(transaction, partition, glossary, siteReferenceDataLibrary)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(siteReferenceDataLibrary.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, siteReferenceDataLibrary)); + } + + foreach (var parameterType in this.ResolveFromRequestCache(siteReferenceDataLibrary.ParameterType)) + { + results.Add(this.ParameterTypeService.UpsertConcept(transaction, partition, parameterType, siteReferenceDataLibrary)); + } + + foreach (var referenceSource in this.ResolveFromRequestCache(siteReferenceDataLibrary.ReferenceSource)) + { + results.Add(this.ReferenceSourceService.UpsertConcept(transaction, partition, referenceSource, siteReferenceDataLibrary)); + } + + foreach (var rule in this.ResolveFromRequestCache(siteReferenceDataLibrary.Rule)) + { + results.Add(this.RuleService.UpsertConcept(transaction, partition, rule, siteReferenceDataLibrary)); + } + + foreach (var scale in this.ResolveFromRequestCache(siteReferenceDataLibrary.Scale)) + { + results.Add(this.ScaleService.UpsertConcept(transaction, partition, scale, siteReferenceDataLibrary)); + } + + foreach (var unit in this.ResolveFromRequestCache(siteReferenceDataLibrary.Unit)) + { + results.Add(this.UnitService.UpsertConcept(transaction, partition, unit, siteReferenceDataLibrary)); + } + + foreach (var unitPrefix in this.ResolveFromRequestCache(siteReferenceDataLibrary.UnitPrefix)) + { + results.Add(this.UnitPrefixService.UpsertConcept(transaction, partition, unitPrefix, siteReferenceDataLibrary)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/SolutionService.cs b/CDP4WebServices.API/AutoGenServices/SolutionService.cs index e47bb741..966c1bd6 100644 --- a/CDP4WebServices.API/AutoGenServices/SolutionService.cs +++ b/CDP4WebServices.API/AutoGenServices/SolutionService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SolutionDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SolutionDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.SolutionDao.Write(transaction, partition, solution, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var solution = thing as Solution; + return this.SolutionDao.Upsert(transaction, partition, solution, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/SpecializedQuantityKindService.cs b/CDP4WebServices.API/AutoGenServices/SpecializedQuantityKindService.cs index b434f662..bc6558b1 100644 --- a/CDP4WebServices.API/AutoGenServices/SpecializedQuantityKindService.cs +++ b/CDP4WebServices.API/AutoGenServices/SpecializedQuantityKindService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.SpecializedQuantityKindDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.SpecializedQuantityKindDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, specializedQuantityKind); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var specializedQuantityKind = thing as SpecializedQuantityKind; + var createSuccesful = this.SpecializedQuantityKindDao.Upsert(transaction, partition, specializedQuantityKind, container); + return createSuccesful && this.UpsertContainment(transaction, partition, specializedQuantityKind); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SpecializedQuantityKind specializedQuantityKind) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(specializedQuantityKind.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, specializedQuantityKind)); + } + + foreach (var definition in this.ResolveFromRequestCache(specializedQuantityKind.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, specializedQuantityKind)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(specializedQuantityKind.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, specializedQuantityKind)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapService.cs b/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapService.cs index 4ec95e52..3d70a291 100644 --- a/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapService.cs +++ b/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -215,6 +215,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.StakeHolderValueMapDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.StakeHolderValueMapDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -277,6 +303,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, stakeHolderValueMap); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var stakeHolderValueMap = thing as StakeHolderValueMap; + var createSuccesful = this.StakeHolderValueMapDao.Upsert(transaction, partition, stakeHolderValueMap, container); + return createSuccesful && this.UpsertContainment(transaction, partition, stakeHolderValueMap); + } + /// /// Get the requested data from the ORM layer. /// @@ -427,5 +482,48 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, StakeHolderValueMap stakeHolderValueMap) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(stakeHolderValueMap.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, stakeHolderValueMap)); + } + + foreach (var definition in this.ResolveFromRequestCache(stakeHolderValueMap.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, stakeHolderValueMap)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(stakeHolderValueMap.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, stakeHolderValueMap)); + } + + foreach (var settings in this.ResolveFromRequestCache(stakeHolderValueMap.Settings)) + { + results.Add(this.SettingsService.UpsertConcept(transaction, partition, settings, stakeHolderValueMap)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapSettingsService.cs b/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapSettingsService.cs index 4cfa3669..688fd9a2 100644 --- a/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapSettingsService.cs +++ b/CDP4WebServices.API/AutoGenServices/StakeHolderValueMapSettingsService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.StakeHolderValueMapSettingsDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.StakeHolderValueMapSettingsDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.StakeHolderValueMapSettingsDao.Write(transaction, partition, stakeHolderValueMapSettings, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var stakeHolderValueMapSettings = thing as StakeHolderValueMapSettings; + return this.StakeHolderValueMapSettingsDao.Upsert(transaction, partition, stakeHolderValueMapSettings, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/StakeholderService.cs b/CDP4WebServices.API/AutoGenServices/StakeholderService.cs index 2db60cf5..c030ba54 100644 --- a/CDP4WebServices.API/AutoGenServices/StakeholderService.cs +++ b/CDP4WebServices.API/AutoGenServices/StakeholderService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.StakeholderDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.StakeholderDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, stakeholder); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var stakeholder = thing as Stakeholder; + var createSuccesful = this.StakeholderDao.Upsert(transaction, partition, stakeholder, container); + return createSuccesful && this.UpsertContainment(transaction, partition, stakeholder); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Stakeholder stakeholder) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(stakeholder.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, stakeholder)); + } + + foreach (var definition in this.ResolveFromRequestCache(stakeholder.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, stakeholder)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(stakeholder.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, stakeholder)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/StakeholderValueService.cs b/CDP4WebServices.API/AutoGenServices/StakeholderValueService.cs index 0aef07ff..d6eb8c03 100644 --- a/CDP4WebServices.API/AutoGenServices/StakeholderValueService.cs +++ b/CDP4WebServices.API/AutoGenServices/StakeholderValueService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.StakeholderValueDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.StakeholderValueDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, stakeholderValue); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var stakeholderValue = thing as StakeholderValue; + var createSuccesful = this.StakeholderValueDao.Upsert(transaction, partition, stakeholderValue, container); + return createSuccesful && this.UpsertContainment(transaction, partition, stakeholderValue); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, StakeholderValue stakeholderValue) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(stakeholderValue.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, stakeholderValue)); + } + + foreach (var definition in this.ResolveFromRequestCache(stakeholderValue.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, stakeholderValue)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(stakeholderValue.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, stakeholderValue)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/TelephoneNumberService.cs b/CDP4WebServices.API/AutoGenServices/TelephoneNumberService.cs index bc6b76b8..8cef326d 100644 --- a/CDP4WebServices.API/AutoGenServices/TelephoneNumberService.cs +++ b/CDP4WebServices.API/AutoGenServices/TelephoneNumberService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.TelephoneNumberDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.TelephoneNumberDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.TelephoneNumberDao.Write(transaction, partition, telephoneNumber, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var telephoneNumber = thing as TelephoneNumber; + return this.TelephoneNumberDao.Upsert(transaction, partition, telephoneNumber, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/TermService.cs b/CDP4WebServices.API/AutoGenServices/TermService.cs index 415a5e13..2662b237 100644 --- a/CDP4WebServices.API/AutoGenServices/TermService.cs +++ b/CDP4WebServices.API/AutoGenServices/TermService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.TermDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.TermDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, term); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var term = thing as Term; + var createSuccesful = this.TermDao.Upsert(transaction, partition, term, container); + return createSuccesful && this.UpsertContainment(transaction, partition, term); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, Term term) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(term.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, term)); + } + + foreach (var definition in this.ResolveFromRequestCache(term.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, term)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(term.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, term)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/TextParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/TextParameterTypeService.cs index 36150210..d91dbe80 100644 --- a/CDP4WebServices.API/AutoGenServices/TextParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/TextParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.TextParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.TextParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, textParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var textParameterType = thing as TextParameterType; + var createSuccesful = this.TextParameterTypeDao.Upsert(transaction, partition, textParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, textParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, TextParameterType textParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(textParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, textParameterType)); + } + + foreach (var definition in this.ResolveFromRequestCache(textParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, textParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(textParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, textParameterType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/TextualNoteService.cs b/CDP4WebServices.API/AutoGenServices/TextualNoteService.cs index 1caf04b8..027c64c0 100644 --- a/CDP4WebServices.API/AutoGenServices/TextualNoteService.cs +++ b/CDP4WebServices.API/AutoGenServices/TextualNoteService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.TextualNoteDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.TextualNoteDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.TextualNoteDao.Write(transaction, partition, textualNote, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var textualNote = thing as TextualNote; + return this.TextualNoteDao.Upsert(transaction, partition, textualNote, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ThingReferenceService.cs b/CDP4WebServices.API/AutoGenServices/ThingReferenceService.cs index 9b65ddd3..3371a5df 100644 --- a/CDP4WebServices.API/AutoGenServices/ThingReferenceService.cs +++ b/CDP4WebServices.API/AutoGenServices/ThingReferenceService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", thingReference.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var thingReference = thing as ThingReference; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", thingReference.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/ThingService.cs b/CDP4WebServices.API/AutoGenServices/ThingService.cs index 5da1d669..22fa84cb 100644 --- a/CDP4WebServices.API/AutoGenServices/ThingService.cs +++ b/CDP4WebServices.API/AutoGenServices/ThingService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -475,6 +475,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -524,6 +549,33 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", thing.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", thing.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/TimeOfDayParameterTypeService.cs b/CDP4WebServices.API/AutoGenServices/TimeOfDayParameterTypeService.cs index 8e009a72..8f38af95 100644 --- a/CDP4WebServices.API/AutoGenServices/TimeOfDayParameterTypeService.cs +++ b/CDP4WebServices.API/AutoGenServices/TimeOfDayParameterTypeService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.TimeOfDayParameterTypeDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.TimeOfDayParameterTypeDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, timeOfDayParameterType); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var timeOfDayParameterType = thing as TimeOfDayParameterType; + var createSuccesful = this.TimeOfDayParameterTypeDao.Upsert(transaction, partition, timeOfDayParameterType, container); + return createSuccesful && this.UpsertContainment(transaction, partition, timeOfDayParameterType); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, TimeOfDayParameterType timeOfDayParameterType) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(timeOfDayParameterType.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, timeOfDayParameterType)); + } + + foreach (var definition in this.ResolveFromRequestCache(timeOfDayParameterType.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, timeOfDayParameterType)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(timeOfDayParameterType.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, timeOfDayParameterType)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/TopContainerService.cs b/CDP4WebServices.API/AutoGenServices/TopContainerService.cs index 792c4c62..d553f0da 100644 --- a/CDP4WebServices.API/AutoGenServices/TopContainerService.cs +++ b/CDP4WebServices.API/AutoGenServices/TopContainerService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,31 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + throw new NotSupportedException(); + } + /// /// Update the supplied instance. /// @@ -256,6 +281,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", topContainer.GetType().Name)); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var topContainer = thing as TopContainer; + throw new NotSupportedException(string.Format("The abstract DTO type: {0} cannot be created.", topContainer.GetType().Name)); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/UnitFactorService.cs b/CDP4WebServices.API/AutoGenServices/UnitFactorService.cs index 65dd5f6d..7ce05b89 100644 --- a/CDP4WebServices.API/AutoGenServices/UnitFactorService.cs +++ b/CDP4WebServices.API/AutoGenServices/UnitFactorService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.UnitFactorDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.UnitFactorDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.UnitFactorDao.Write(transaction, partition, unitFactor, sequence, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var unitFactor = thing as UnitFactor; + return this.UnitFactorDao.Upsert(transaction, partition, unitFactor, sequence, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/UnitPrefixService.cs b/CDP4WebServices.API/AutoGenServices/UnitPrefixService.cs index 2b916a00..65f848fc 100644 --- a/CDP4WebServices.API/AutoGenServices/UnitPrefixService.cs +++ b/CDP4WebServices.API/AutoGenServices/UnitPrefixService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.UnitPrefixDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.UnitPrefixDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, unitPrefix); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var unitPrefix = thing as UnitPrefix; + var createSuccesful = this.UnitPrefixDao.Upsert(transaction, partition, unitPrefix, container); + return createSuccesful && this.UpsertContainment(transaction, partition, unitPrefix); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, UnitPrefix unitPrefix) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(unitPrefix.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, unitPrefix)); + } + + foreach (var definition in this.ResolveFromRequestCache(unitPrefix.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, unitPrefix)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(unitPrefix.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, unitPrefix)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/UserPreferenceService.cs b/CDP4WebServices.API/AutoGenServices/UserPreferenceService.cs index 0d2a53ea..c37a4079 100644 --- a/CDP4WebServices.API/AutoGenServices/UserPreferenceService.cs +++ b/CDP4WebServices.API/AutoGenServices/UserPreferenceService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -195,6 +195,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.UserPreferenceDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.UserPreferenceDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -256,6 +282,34 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return this.UserPreferenceDao.Write(transaction, partition, userPreference, container); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var userPreference = thing as UserPreference; + return this.UserPreferenceDao.Upsert(transaction, partition, userPreference, container); + } + /// /// Get the requested data from the ORM layer. /// diff --git a/CDP4WebServices.API/AutoGenServices/UserRuleVerificationService.cs b/CDP4WebServices.API/AutoGenServices/UserRuleVerificationService.cs index e72c23cf..220012dc 100644 --- a/CDP4WebServices.API/AutoGenServices/UserRuleVerificationService.cs +++ b/CDP4WebServices.API/AutoGenServices/UserRuleVerificationService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -200,6 +200,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.UserRuleVerificationDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.UserRuleVerificationDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -262,6 +288,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, userRuleVerification); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var userRuleVerification = thing as UserRuleVerification; + var createSuccesful = this.UserRuleVerificationDao.Upsert(transaction, partition, userRuleVerification, sequence, container); + return createSuccesful && this.UpsertContainment(transaction, partition, userRuleVerification); + } + /// /// Get the requested data from the ORM layer. /// @@ -394,5 +449,33 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, UserRuleVerification userRuleVerification) + { + var results = new List(); + + foreach (var violation in this.ResolveFromRequestCache(userRuleVerification.Violation)) + { + results.Add(this.ViolationService.UpsertConcept(transaction, partition, violation, userRuleVerification)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/AutoGenServices/ValueGroupService.cs b/CDP4WebServices.API/AutoGenServices/ValueGroupService.cs index eb7cd3c2..7720c593 100644 --- a/CDP4WebServices.API/AutoGenServices/ValueGroupService.cs +++ b/CDP4WebServices.API/AutoGenServices/ValueGroupService.cs @@ -1,19 +1,19 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2021 RHEA System S.A. // -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski // -// This file is part of CDP4 Web Services Community Edition. -// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// This file is part of COMET Web Services Community Edition. +// The COMET Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. // This is an auto-generated class. Any manual changes to this file will be overwritten! // -// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or +// The COMET Web Services Community Edition is free software; you can redistribute it and/or // modify it under the terms of the GNU Affero General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // -// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, +// The COMET Web Services Community Edition is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. @@ -210,6 +210,32 @@ public bool DeleteConcept(NpgsqlTransaction transaction, string partition, Thing return this.ValueGroupDao.Delete(transaction, partition, thing.Iid); } + /// + /// Delete the supplied instance. + /// A "Raw" Delete means that the delete is performed without calling before-, or after actions, or other side effects. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) from where the requested resource will be removed. + /// + /// + /// The to delete. + /// + /// + /// The container instance of the to be removed. + /// + /// + /// True if the removal was successful. + /// + public bool RawDeleteConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container = null) + { + + return this.ValueGroupDao.RawDelete(transaction, partition, thing.Iid); + } + /// /// Update the supplied instance. /// @@ -272,6 +298,35 @@ public bool CreateConcept(NpgsqlTransaction transaction, string partition, Thing return createSuccesful && this.CreateContainment(transaction, partition, valueGroup); } + /// + /// Persist the supplied instance. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The to create. + /// + /// + /// The container instance of the to be persisted. + /// + /// + /// The order sequence used to persist this instance. Default is not used (-1). + /// + /// + /// True if the persistence was successful. + /// + public bool UpsertConcept(NpgsqlTransaction transaction, string partition, Thing thing, Thing container, long sequence = -1) + { + var valueGroup = thing as ValueGroup; + var createSuccesful = this.ValueGroupDao.Upsert(transaction, partition, valueGroup, container); + return createSuccesful && this.UpsertContainment(transaction, partition, valueGroup); + } + /// /// Get the requested data from the ORM layer. /// @@ -416,5 +471,43 @@ private bool CreateContainment(NpgsqlTransaction transaction, string partition, return results.All(x => x); } + + /// + /// Persist the containment tree to the ORM layer. Update if it already exists. + /// This is typically used during the import of existing data to the Database. + /// + /// + /// The current to the database. + /// + /// + /// The database partition (schema) where the requested resource will be stored. + /// + /// + /// The instance to persist. + /// + /// + /// True if the persistence was successful. + /// + private bool UpsertContainment(NpgsqlTransaction transaction, string partition, ValueGroup valueGroup) + { + var results = new List(); + + foreach (var alias in this.ResolveFromRequestCache(valueGroup.Alias)) + { + results.Add(this.AliasService.UpsertConcept(transaction, partition, alias, valueGroup)); + } + + foreach (var definition in this.ResolveFromRequestCache(valueGroup.Definition)) + { + results.Add(this.DefinitionService.UpsertConcept(transaction, partition, definition, valueGroup)); + } + + foreach (var hyperLink in this.ResolveFromRequestCache(valueGroup.HyperLink)) + { + results.Add(this.HyperLinkService.UpsertConcept(transaction, partition, hyperLink, valueGroup)); + } + + return results.All(x => x); + } } } diff --git a/CDP4WebServices.API/Configuration/BacktierConfig.cs b/CDP4WebServices.API/Configuration/BacktierConfig.cs index 04af2901..e407c781 100644 --- a/CDP4WebServices.API/Configuration/BacktierConfig.cs +++ b/CDP4WebServices.API/Configuration/BacktierConfig.cs @@ -27,6 +27,7 @@ public BacktierConfig() this.StatementTimeout = 120; this.LogSqlCommands = false; this.IsDbSeedEnabled = false; + this.IsDbImportEnabled = false; this.IsDbRestoreEnabled = false; } @@ -83,6 +84,11 @@ public BacktierConfig() /// public bool IsDbSeedEnabled { get; set; } + /// + /// Gets or sets a value indicating whether database import is enabled. + /// + public bool IsDbImportEnabled { get; set; } + /// /// Gets or sets a value indicating whether database restore is enabled. /// diff --git a/CDP4WebServices.API/Modules/10-25/ExchangeFileImportyApi.cs b/CDP4WebServices.API/Modules/10-25/ExchangeFileImportyApi.cs index 723c69d9..c41856c4 100644 --- a/CDP4WebServices.API/Modules/10-25/ExchangeFileImportyApi.cs +++ b/CDP4WebServices.API/Modules/10-25/ExchangeFileImportyApi.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2017-2020 RHEA System S.A. +// Copyright (c) 2017-2021 RHEA System S.A. // // -------------------------------------------------------------------------------------------------------------------- @@ -19,6 +19,7 @@ namespace CDP4WebServices.API.Modules using CDP4Common.Helpers; using CDP4Orm.Dao; + using CDP4Orm.Dao.Revision; using CDP4Orm.MigrationEngine; using CDP4WebService.Authentication; @@ -76,6 +77,11 @@ public class ExchangeFileImportyApi : NancyModule /// public IRevisionService RevisionService { get; set; } + /// + /// Gets or sets the revision dao. + /// + public IRevisionDao RevisionDao { get; set; } + /// /// Gets or sets the cache service. /// @@ -204,6 +210,9 @@ public ExchangeFileImportyApi() // Seed the data store from the provided (uploaded) exchange file this.Post["/Data/Exchange", true] = async (x, ct) => await this.SeedDataStore(); + // Import the data store from the provided (uploaded) exchange file + this.Post["/Data/Import", true] = async (x, ct) => await this.ImportDataStore(); + // Restore the data store to the data snapshot created from the inital seed this.Post["/Data/Restore"] = x => this.RestoreDatastore(); } @@ -248,6 +257,82 @@ internal Response RestoreDatastore() } } + /// + /// Asynchronously import the data store. + /// + /// + /// The . + /// + internal async Task ImportDataStore() + { + if (!AppConfig.Current.Backtier.IsDbImportEnabled) + { + Logger.Info( + "Data store import API invoked but it was disabled from configuration, cancel further processing..."); + + var notAcceptableResponse = new Response().WithStatusCode(HttpStatusCode.NotAcceptable); + this.HeaderInfoProvider.RegisterResponseHeaders(notAcceptableResponse); + return notAcceptableResponse; + } + + Logger.Info("Starting data store importing"); + + var exchangeFileRequest = this.Bind(); + + // make sure there is only one file + if (exchangeFileRequest.File == null) + { + var badRequestResponse = new Response().WithStatusCode(HttpStatusCode.BadRequest); + this.HeaderInfoProvider.RegisterResponseHeaders(badRequestResponse); + return badRequestResponse; + } + + // stream the file to disk + var filePath = await this.LocalFileStorage.StreamFileToDisk(exchangeFileRequest.File.Value); + + // drop existing data stores + this.DropDataStoreAndPrepareNew(); + + // handle exchange processing + if (!this.UpsertModelData(filePath, exchangeFileRequest.Password)) + { + var errorResponse = new NotAcceptableResponse(); + this.HeaderInfoProvider.RegisterResponseHeaders(errorResponse); + return errorResponse; + } + + // Remove the exchange file after processing (saving space) + try + { + this.LocalFileStorage.RemoveFileFromDisk(filePath); + } + catch (Exception ex) + { + // swallow exception but log it + Logger.Error(ex, "Unable to remove file"); + } + + try + { + // reset the credential cache as the underlying datastore was reset + this.WebServiceAuthentication.ResetCredentialCache(); + + var response = new Response().WithStatusCode(HttpStatusCode.OK); + this.HeaderInfoProvider.RegisterResponseHeaders(response); + + Logger.Info("Finished the data store import"); + return response; + } + catch (Exception ex) + { + Logger.Error(ex, "Unable to import the datastore"); + var errorResponse = new Response().WithStatusCode(HttpStatusCode.InternalServerError); + this.HeaderInfoProvider.RegisterResponseHeaders(errorResponse); + return errorResponse; + } + + } + /// /// Asynchronously seed the data store. /// @@ -305,12 +390,8 @@ internal async Task SeedDataStore() try { - // Create a jsonb for each entry in the database - this.CreateRevisionHistoryForEachEntry(); - // database was succesfully seeded - this.DataStoreController - .CloneDataStore(); // create a clone of the data store for future restore support + this.DataStoreController.CloneDataStore(); // create a clone of the data store for future restore support // reset the credential cache as the underlying datastore was reset this.WebServiceAuthentication.ResetCredentialCache(); @@ -353,6 +434,7 @@ private bool InsertModelData(string fileName, string password = null, bool seed try { var sw = new Stopwatch(); + if (seed) { // clear database schemas if seeding @@ -390,6 +472,7 @@ private bool InsertModelData(string fileName, string password = null, bool seed } var topContainer = items.SingleOrDefault(x => x.IsSameOrDerivedClass()) as TopContainer; + if (topContainer == null) { Logger.Error("No Topcontainer item encountered"); @@ -410,19 +493,251 @@ private bool InsertModelData(string fileName, string password = null, bool seed } // apply migration on new SiteDirectory partition - this.MigrationService.ApplyMigrations(transaction, typeof(SiteDirectory).Name, false); + this.MigrationService.ApplyMigrations(transaction, nameof(SiteDirectory), false); var result = false; + if (topContainer.GetType().Name == "SiteDirectory") { // make sure single iterationsetups are set to unfrozen before persitence this.FixSingleIterationSetups(items); + var siteDirectoryService = this.ServiceProvider.MapToPersitableService("SiteDirectory"); result = siteDirectoryService.Insert(transaction, "SiteDirectory", topContainer); } + var engineeringModelSetups = items.OfType().ToList(); + + if (result) + { + this.RequestUtils.QueryParameters = new QueryParameters(); + + // Get users credentials from migration.json file + var migrationCredentials = this.ExchangeFileProcessor.ReadMigrationJsonFromFile(fileName, password).ToList(); + + foreach (var person in items.OfType()) + { + var credential = migrationCredentials.FirstOrDefault(mc => mc.Iid == person.Iid); + + if (credential != null) + { + this.PersonService.UpdateCredentials(transaction, "SiteDirectory", person, credential); + } + } + + // Add missing Person permissions + this.CreateMissingPersonPermissions(transaction); + + var engineeringModelService = this.ServiceProvider.MapToPersitableService("EngineeringModel"); + var iterationService = this.ServiceProvider.MapToPersitableService("Iteration"); + + foreach (var engineeringModelSetup in engineeringModelSetups) + { + // cleanup before handling TopContainer + this.RequestUtils.Cache.Clear(); + + // get referenced engineeringmodel data + var engineeringModelItems = this.ExchangeFileProcessor + .ReadEngineeringModelFromfile(fileName, password, engineeringModelSetup).ToList(); + + // should return one engineeringmodel topcontainer + var engineeringModel = engineeringModelItems.OfType().Single(); + + if (engineeringModel == null) + { + result = false; + break; + } + + var dataPartition = CDP4Orm.Dao.Utils.GetEngineeringModelSchemaName(engineeringModel.Iid); + this.RequestUtils.Cache = new List(engineeringModelItems); + + if (!engineeringModelService.Insert(transaction, dataPartition, engineeringModel)) + { + result = false; + break; + } + + // Add missing Participant permissions + this.CreateMissingParticipantPermissions(transaction); + + // extract any referenced file data to disk if not already present + this.PersistFileBinaryData(fileName, password); + + var iterationSetups = items.OfType() + .Where(x => engineeringModelSetup.IterationSetup.Contains(x.Iid)) + .ToList(); + + // get current maximum iterationNumber and increase by one for the next value + var maxIterationNumber = iterationSetups.Select(x => x.IterationNumber).Max() + IterationNumberSequenceInitialization; + + // reset the start number of iterationNumber sequence + this.EngineeringModelDao.ResetIterationNumberSequenceStartNumber( + transaction, + dataPartition, + maxIterationNumber); + + // Import only first iteration of the model + var iterationSetup = iterationSetups.OrderBy(x => x.IterationNumber).FirstOrDefault(); + + this.RequestUtils.Cache.Clear(); + + var iterationItems = this.ExchangeFileProcessor + .ReadModelIterationFromFile(fileName, password, iterationSetup).ToList(); + + this.RequestUtils.Cache = new List(iterationItems); + + // should return one iteration + // for the every model EngineeringModel schema ends with the same ID as Iteration schema + if (!(iterationItems.SingleOrDefault(x => x.ClassKind == ClassKind.Iteration) is Iteration iteration) + || !iterationService.CreateConcept( + transaction, + dataPartition, + iteration, + engineeringModel)) + { + break; + } + + // extract any referenced file data to disk if not already present + this.PersistFileBinaryData(fileName, password); + } + } + + transaction.Commit(); + sw.Stop(); + Logger.Info("Finished seeding the data store in {0} [ms]", sw.ElapsedMilliseconds); + + var actorId = Guid.Empty; + + this.CreateRevisionHistoryForSiteDirectory(ref actorId); + + foreach (var engineeringModelSetup in engineeringModelSetups) + { + // Create revision history for each EngineeringModel + this.CreateRevisionHistoryForEngineeringModel(actorId, EngineeringModelSetupSideEffect.FirstRevision, engineeringModelSetup.EngineeringModelIid); + } + + return result; + } + catch (Exception ex) + { + if (transaction != null && !transaction.IsCompleted) + { + transaction.Rollback(); + } + + Logger.Error(ex, "Error occured during data store seeding"); + + return false; + } + finally + { + // clean log (will happen at end of request as well due to IOC lifetime + this.TransactionManager.CommandLogger.ClearLog(); + + transaction?.Dispose(); + + if (connection != null) + { + connection.Close(); + connection.Dispose(); + } + } + } + + /// + /// Import data and use Upsert flow to add/update data. Return the data as serialized JSON + /// + /// + /// The exchange file name. + /// + /// + /// The optional archive password as supplied by the request + /// + /// + /// True if successful + /// + private bool UpsertModelData(string fileName, string password = null) + { + NpgsqlConnection connection = null; + NpgsqlTransaction transaction = null; + + try + { + var sw = new Stopwatch(); + + // clear database schemas if seeding + Logger.Info("Start clearing the current data store"); + transaction = this.TransactionManager.SetupTransaction(ref connection, null); + this.TransactionManager.SetFullAccessState(true); + this.ClearDatabaseSchemas(transaction); + transaction.Commit(); + + // Flushes the type cache and reload the types for this connection + connection.ReloadTypes(); + + sw.Start(); + Logger.Info("Start importing the data"); + + // use new transaction to for inserting the data + transaction = this.TransactionManager.SetupTransaction(ref connection, null); + this.TransactionManager.SetFullAccessState(true); + + // important, make sure to defer the constraints + var command = new NpgsqlCommand("SET CONSTRAINTS ALL DEFERRED;", transaction.Connection, transaction); + command.ExecuteAndLogNonQuery(this.TransactionManager.CommandLogger); + + // make sure to only log insert changes, no subsequent trigger updates for exchange import + this.TransactionManager.SetAuditLoggingState(transaction, true); + + // get sitedirectory data + var items = this.ExchangeFileProcessor.ReadSiteDirectoryFromfile(fileName, password).ToList(); + + // assign default password to all imported persons. + foreach (var person in items.OfType()) + { + person.Password = AppConfig.Current.Defaults.PersonPassword; + } + + var topContainer = items.SingleOrDefault(x => x.IsSameOrDerivedClass()) as TopContainer; + + if (topContainer == null) + { + Logger.Error("No Topcontainer item encountered"); + throw new NoNullAllowedException("Topcontainer item needs to be present in the dataset"); + } + + this.RequestUtils.Cache = new List(items); + + // setup Site Directory schema + using (var siteDirCommand = new NpgsqlCommand()) + { + Logger.Info("Start Site Directory structure"); + siteDirCommand.ReadSqlFromResource("CDP4Orm.AutoGenStructure.SiteDirectoryDefinition.sql"); + + siteDirCommand.Connection = transaction.Connection; + siteDirCommand.Transaction = transaction; + siteDirCommand.ExecuteAndLogNonQuery(this.TransactionManager.CommandLogger); + } + + // apply migration on new SiteDirectory partition + this.MigrationService.ApplyMigrations(transaction, nameof(SiteDirectory), false); + + var result = false; + + if (topContainer.GetType().Name == "SiteDirectory") + { + // make sure single iterationsetups are set to unfrozen before persitence + this.FixSingleIterationSetups(items); + + var siteDirectoryService = this.ServiceProvider.MapToPersitableService("SiteDirectory"); + + result = siteDirectoryService.Insert(transaction, "SiteDirectory", topContainer); + } + if (result) { this.RequestUtils.QueryParameters = new QueryParameters(); @@ -433,6 +748,7 @@ private bool InsertModelData(string fileName, string password = null, bool seed foreach (var person in items.OfType()) { var credential = migrationCredentials.FirstOrDefault(mc => mc.Iid == person.Iid); + if (credential != null) { this.PersonService.UpdateCredentials(transaction, "SiteDirectory", person, credential); @@ -445,12 +761,18 @@ private bool InsertModelData(string fileName, string password = null, bool seed var engineeringModelSetups = items.OfType() .ToList(); + var engineeringModelService = this.ServiceProvider.MapToPersitableService("EngineeringModel"); + var iterationService = this.ServiceProvider.MapToPersitableService("Iteration"); + var createRevisionForSiteDirectory = true; + var actorId = Guid.Empty; foreach (var engineeringModelSetup in engineeringModelSetups) { + var revisionNumber = EngineeringModelSetupSideEffect.FirstRevision; + // cleanup before handling TopContainer this.RequestUtils.Cache.Clear(); @@ -460,6 +782,7 @@ private bool InsertModelData(string fileName, string password = null, bool seed // should return one engineeringmodel topcontainer var engineeringModel = engineeringModelItems.OfType().Single(); + if (engineeringModel == null) { result = false; @@ -467,6 +790,9 @@ private bool InsertModelData(string fileName, string password = null, bool seed } var dataPartition = CDP4Orm.Dao.Utils.GetEngineeringModelSchemaName(engineeringModel.Iid); + + var iterationPartition = CDP4Orm.Dao.Utils.GetEngineeringModelIterationSchemaName(engineeringModel.Iid); + this.RequestUtils.Cache = new List(engineeringModelItems); if (!engineeringModelService.Insert(transaction, dataPartition, engineeringModel)) @@ -486,7 +812,7 @@ private bool InsertModelData(string fileName, string password = null, bool seed x => engineeringModelSetup.IterationSetup.Contains(x.Iid)).ToList(); // get current maximum iterationNumber and increase by one for the next value - int maxIterationNumber = iterationSetups.Select(x => x.IterationNumber).Max() + IterationNumberSequenceInitialization; + var maxIterationNumber = iterationSetups.Select(x => x.IterationNumber).Max() + IterationNumberSequenceInitialization; // reset the start number of iterationNumber sequence this.EngineeringModelDao.ResetIterationNumberSequenceStartNumber( @@ -495,27 +821,80 @@ private bool InsertModelData(string fileName, string password = null, bool seed maxIterationNumber); var iterationInsertResult = true; - foreach (var iterationSetup in iterationSetups) + List previousIterationItems = null; + + foreach (var iterationSetup in iterationSetups.OrderBy(x => x.IterationNumber)) { this.RequestUtils.Cache.Clear(); + var iterationItems = this.ExchangeFileProcessor .ReadModelIterationFromFile(fileName, password, iterationSetup).ToList(); - // FixRevisionNumber(iterationItems); this.RequestUtils.Cache = new List(iterationItems); // should return one iteration + // for the every model EngineeringModel schema ends with the same ID as Iteration schema var iteration = iterationItems.SingleOrDefault(x => x.ClassKind == ClassKind.Iteration) as Iteration; - if (iteration == null || !iterationService.CreateConcept( - transaction, - dataPartition, - iteration, - engineeringModel)) + + iterationInsertResult = false; + + if (iteration == null) { - iterationInsertResult = false; break; } + + if (iterationService.UpsertConcept( + transaction, + dataPartition, + iteration, + engineeringModel)) + { + iterationInsertResult = true; + + if (previousIterationItems != null) + { + // Compute differences between iterations + var thingsToBeDeleted = previousIterationItems + .Where(thing => thing.ClassKind != ClassKind.Iteration && + !iterationItems.Select(id => id.Iid).Contains(thing.Iid)).ToList(); + + // Remove differences between iterations + foreach (var thing in thingsToBeDeleted) + { + var service = this.ServiceProvider.MapToPersitableService(thing.ClassKind.ToString()); + service.RawDeleteConcept(transaction, iterationPartition, thing); + } + } + + transaction.Commit(); + + if (createRevisionForSiteDirectory) + { + // Create revision history only once for SiteDirectory + this.CreateRevisionHistoryForSiteDirectory(ref actorId); + createRevisionForSiteDirectory = false; + } + + // Create revision history for each EngineeringModel + this.CreateRevisionHistoryForEngineeringModel(actorId, revisionNumber, engineeringModelSetup.EngineeringModelIid); + + // use new transaction to for inserting the data + transaction = this.TransactionManager.SetupTransaction(ref connection, null); + this.TransactionManager.SetFullAccessState(true); + + // important, make sure to defer the constraints + var constraintcommand = new NpgsqlCommand("SET CONSTRAINTS ALL DEFERRED;", transaction.Connection, transaction); + constraintcommand.ExecuteAndLogNonQuery(this.TransactionManager.CommandLogger); + + // make sure to only log insert changes, no subsequent trigger updates for exchange import + this.TransactionManager.SetAuditLoggingState(transaction, true); + + // revision number goes up for the next Iteration + revisionNumber += 1; + } + + previousIterationItems = iterationItems; } if (!iterationInsertResult) @@ -530,8 +909,9 @@ private bool InsertModelData(string fileName, string password = null, bool seed } transaction.Commit(); + sw.Stop(); - Logger.Info("Finished seeding the data store in {0} [ms]", sw.ElapsedMilliseconds); + Logger.Info("Finished importing the data store in {0} [ms]", sw.ElapsedMilliseconds); return result; } @@ -542,7 +922,7 @@ private bool InsertModelData(string fileName, string password = null, bool seed transaction.Rollback(); } - Logger.Error(ex, "Error occured during data store seeding"); + Logger.Error(ex, "Error occured during data store import"); return false; } @@ -711,9 +1091,12 @@ private void DropDataStoreAndPrepareNew() } /// - /// Create revision history for each entry in the database. + /// Create revision history for SiteDirectory and retrieve first person Id /// - private void CreateRevisionHistoryForEachEntry() + /// + /// First person Id + /// + private void CreateRevisionHistoryForSiteDirectory(ref Guid personId) { NpgsqlConnection connection = null; NpgsqlTransaction transaction = null; @@ -727,43 +1110,62 @@ private void CreateRevisionHistoryForEachEntry() this.TransactionManager.SetFullAccessState(true); // Get first person Id (so that actor isnt guid.empty), it is hard to determine who it should be. - var actor = this.PersonService.GetShallow(transaction, TopContainer, null, new RequestSecurityContext {ContainerReadAllowed = true}).OfType().FirstOrDefault(); - var actorId = actor != null ? actor.Iid : Guid.Empty; + var person = this.PersonService.GetShallow(transaction, TopContainer, null, new RequestSecurityContext { ContainerReadAllowed = true }).OfType().FirstOrDefault(); + personId = person != null ? person.Iid : Guid.Empty; // Save revision history for SiteDirectory's entries - this.RevisionService.SaveRevisions(transaction, TopContainer, actorId, EngineeringModelSetupSideEffect.FirstRevision); + this.RevisionService.SaveRevisions(transaction, TopContainer, personId, EngineeringModelSetupSideEffect.FirstRevision); - var siteDirectory = this.SiteDirectoryService.Get( - transaction, - TopContainer, - null, - new RequestSecurityContext { ContainerReadAllowed = true }).OfType().ToList(); + transaction.Commit(); + } + catch (NpgsqlException ex) + { + transaction?.Rollback(); + Logger.Error(ex, "Error occured during revision history creation"); + } + catch (Exception ex) + { + transaction?.Rollback(); + Logger.Error(ex, "Error occured during revision history creation"); + } + finally + { + transaction?.Dispose(); + connection?.Dispose(); + } + } - var engineeringModelSetups = this.EngineeringModelSetupService.GetShallow( - transaction, - TopContainer, - siteDirectory[0].Model, - new RequestSecurityContext { ContainerReadAllowed = true }).OfType() - .ToList(); + /// + /// Create revision history for each EngineeringModel in the database. + /// + /// + /// The revision number we want to create revision records for + /// + /// + /// First person Id + /// + /// + /// Engineering model Id + /// + private void CreateRevisionHistoryForEngineeringModel(Guid personId, int revisionNumber, Guid engineeringModelIid) + { + NpgsqlConnection connection = null; + NpgsqlTransaction transaction = null; - // commit revision history - transaction.Commit(); + this.RequestUtils.QueryParameters = new QueryParameters(); - // Get all EngineeringModelSetups and create a revision history for each EngineeringModel - foreach (var engineeringModelSetup in engineeringModelSetups) - { - transaction = this.TransactionManager.SetupTransaction(ref connection, null); - this.TransactionManager.SetFullAccessState(true); + try + { + transaction = this.TransactionManager.SetupTransaction(ref connection, null); + this.TransactionManager.SetFullAccessState(true); - var partition = - this.RequestUtils.GetEngineeringModelPartitionString(engineeringModelSetup.EngineeringModelIid); + var partition = this.RequestUtils.GetEngineeringModelPartitionString(engineeringModelIid); - // Save revision history for EngineeringModel's entries - this.RevisionService.SaveRevisions(transaction, partition, actorId, EngineeringModelSetupSideEffect.FirstRevision); + // Save revision history for EngineeringModel's entries + this.RevisionService.SaveRevisions(transaction, partition, personId, revisionNumber); - // commit revision history - transaction.Commit(); - } + // commit revision history + transaction.Commit(); } catch (NpgsqlException ex) { diff --git a/CDP4WebServices.API/Services/Supplemental/IterationService.cs b/CDP4WebServices.API/Services/Supplemental/IterationService.cs index bb3f3feb..a05c3d86 100644 --- a/CDP4WebServices.API/Services/Supplemental/IterationService.cs +++ b/CDP4WebServices.API/Services/Supplemental/IterationService.cs @@ -11,8 +11,8 @@ namespace CDP4WebServices.API.Services using System.Diagnostics; using System.Linq; using System.Runtime.Remoting; + using System.Security; using Authorization; - using CDP4Common.CommonData; using CDP4Common.DTO; using Helpers; using NLog; diff --git a/CDP4WebServices.API/config_debug.json b/CDP4WebServices.API/config_debug.json index da65927d..f463e009 100644 --- a/CDP4WebServices.API/config_debug.json +++ b/CDP4WebServices.API/config_debug.json @@ -16,7 +16,8 @@ "DatabaseManage": "cdp4manage", "StatementTimeout": 180, "LogSqlCommands": false, - "IsDbSeedEnabled": true, + "IsDbImportEnabled": false, + "IsDbSeedEnabled": false, "IsDbRestoreEnabled": false }, "EmailService": { diff --git a/CDP4WebServices.API/config_test.json b/CDP4WebServices.API/config_test.json index d43e70be..09186664 100644 --- a/CDP4WebServices.API/config_test.json +++ b/CDP4WebServices.API/config_test.json @@ -16,6 +16,7 @@ "DatabaseManage": "cdp4manage", "StatementTimeout": 120, "LogSqlCommands": false, + "IsDbImportEnabled": false, "IsDbSeedEnabled": true, "IsDbRestoreEnabled": true },