/// <summary> /// Update the containment order as indicated by the supplied orderedItem. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="orderedItem"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the contained item was successfully reordered. /// </returns> public override bool ReorderContainment(NpgsqlTransaction transaction, string partition, CDP4Common.Types.OrderedItem orderedItem) { var isReordered = base.ReorderContainment(transaction, partition, orderedItem); using (var command = new NpgsqlCommand()) { var sqlBuilder = new System.Text.StringBuilder(); sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Section\"", partition); sqlBuilder.AppendFormat(" SET (\"Sequence\")"); sqlBuilder.AppendFormat(" = (:reorderSequence)"); sqlBuilder.AppendFormat(" WHERE \"Iid\" = :iid"); sqlBuilder.AppendFormat(" AND \"Sequence\" = :sequence;"); command.Parameters.Add("iid", NpgsqlDbType.Uuid).Value = (Guid)orderedItem.V; command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = orderedItem.K; command.Parameters.Add("reorderSequence", NpgsqlDbType.Bigint).Value = orderedItem.M; command.CommandText = sqlBuilder.ToString(); command.Connection = transaction.Connection; command.Transaction = transaction; return(isReordered && this.ExecuteAndLogCommand(command) > 0); } }
/// <summary> /// Update the containment order as indicated by the supplied orderedItem. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="orderedItem"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the contained item was successfully reordered. /// </returns> public bool ReorderContainment(NpgsqlTransaction transaction, string partition, CDP4Common.Types.OrderedItem orderedItem) { return(this.PageDao.ReorderContainment(transaction, partition, orderedItem)); }
/// <summary> /// Reorder the supplied value collection of the association link table indicated by the supplied property name. /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="propertyName"> /// The association property name that will be reordered. /// </param> /// <param name="iid"> /// The <see cref="SiteDirectoryDataDiscussionItem"/> id that is the source for the reordered link table record. /// </param> /// <param name="orderUpdate"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the link was created. /// </returns> public bool ReorderCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, CDP4Common.Types.OrderedItem orderUpdate) { return(this.SiteDirectoryDataDiscussionItemDao.ReorderCollectionProperty(transaction, partition, propertyName, iid, orderUpdate)); }
/// <summary> /// Update the containment order as indicated by the supplied orderedItem. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="orderedItem"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the contained item was successfully reordered. /// </returns> public bool ReorderContainment(NpgsqlTransaction transaction, string partition, CDP4Common.Types.OrderedItem orderedItem) { return(this.EnumerationValueDefinitionDao.ReorderContainment(transaction, partition, orderedItem)); }
/// <summary> /// Reorder the supplied value collection of the association link table indicated by the supplied property name. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="propertyName"> /// The association property name that will be reordered. /// </param> /// <param name="iid"> /// The <see cref="DiagrammingStyle"/> id that is the source for the reordered link table record. /// </param> /// <param name="orderUpdate"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the link was created. /// </returns> public bool ReorderCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, CDP4Common.Types.OrderedItem orderUpdate) { throw new NotSupportedException(); }
/// <summary> /// Reorder an item in an association link table. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be reordered. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.Definition"/> id that will be the source for reordered link table record. /// </param> /// <param name="example"> /// The value for which a link table record wil be reordered. /// </param> /// <returns> /// True if the value link was successfully reordered. /// </returns> public bool ReorderExample(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem example) { using (var command = new NpgsqlCommand()) { var sqlBuilder = new System.Text.StringBuilder(); sqlBuilder.AppendFormat("UPDATE \"{0}\".\"Definition_Example\"", partition); sqlBuilder.AppendFormat(" SET (\"Sequence\")"); sqlBuilder.Append(" = (:reorderSequence);"); sqlBuilder.Append(" WHERE \"Definition\" = :definition"); sqlBuilder.Append(" AND \"Example\" = :example"); sqlBuilder.Append(" AND \"Sequence\" = :sequence;"); command.Parameters.Add("definition", NpgsqlDbType.Uuid).Value = iid; command.Parameters.Add("example", NpgsqlDbType.Text).Value = example.V; command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = example.K; command.Parameters.Add("reorderSequence", NpgsqlDbType.Bigint).Value = example.M; command.CommandText = sqlBuilder.ToString(); command.Connection = transaction.Connection; command.Transaction = transaction; return(this.ExecuteAndLogCommand(command) > 0); } }
/// <summary> /// Delete an association record in the link table. /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be deleted. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.ReferenceDataLibrary"/> id that is the source for each link table record. /// </param> /// <param name="baseQuantityKind"> /// A value for which a link table record wil be deleted. /// </param> /// <returns> /// True if the value link was successfully removed. /// </returns> public bool DeleteBaseQuantityKind(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem baseQuantityKind) { using (var command = new NpgsqlCommand()) { var sqlBuilder = new System.Text.StringBuilder(); sqlBuilder.AppendFormat("DELETE FROM \"{0}\".\"ReferenceDataLibrary_BaseQuantityKind\"", partition); sqlBuilder.Append(" WHERE \"ReferenceDataLibrary\" = :referenceDataLibrary"); sqlBuilder.Append(" AND \"BaseQuantityKind\" = :baseQuantityKind"); sqlBuilder.Append(" AND \"Sequence\" = :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); } }
/// <summary> /// Delete an association record in the link table. /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be deleted. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.ActualFiniteStateList"/> id that is the source for each link table record. /// </param> /// <param name="possibleFiniteStateList"> /// A value for which a link table record wil be deleted. /// </param> /// <returns> /// True if the value link was successfully removed. /// </returns> public bool DeletePossibleFiniteStateList(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem possibleFiniteStateList) { using (var command = new NpgsqlCommand()) { var sqlBuilder = new System.Text.StringBuilder(); sqlBuilder.AppendFormat("DELETE FROM \"{0}\".\"ActualFiniteStateList_PossibleFiniteStateList\"", partition); sqlBuilder.Append(" WHERE \"ActualFiniteStateList\" = :actualFiniteStateList"); sqlBuilder.Append(" AND \"PossibleFiniteStateList\" = :possibleFiniteStateList"); sqlBuilder.Append(" AND \"Sequence\" = :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); } }
/// <summary> /// 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. /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be stored. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.ReferenceDataLibrary"/> id that will be the source for each link table record. /// </param> /// <param name="baseQuantityKind"> /// The value for which a link table record wil be created. /// </param> /// <returns> /// True if the value link was successfully created. /// </returns> 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); } }
/// <summary> /// Delete an association record in the link table. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be deleted. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.FileRevision"/> id that is the source for each link table record. /// </param> /// <param name="fileType"> /// A value for which a link table record wil be deleted. /// </param> /// <returns> /// True if the value link was successfully removed. /// </returns> public bool DeleteFileType(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem fileType) { using (var command = new NpgsqlCommand()) { var sqlBuilder = new System.Text.StringBuilder(); sqlBuilder.AppendFormat("DELETE FROM \"{0}\".\"FileRevision_FileType\"", partition); sqlBuilder.Append(" WHERE \"FileRevision\" = :fileRevision"); sqlBuilder.Append(" AND \"FileType\" = :fileType"); sqlBuilder.Append(" AND \"Sequence\" = :sequence;"); command.Parameters.Add("fileRevision", NpgsqlDbType.Uuid).Value = iid; command.Parameters.Add("fileType", NpgsqlDbType.Uuid).Value = fileType.V; 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); } }
/// <summary> /// 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. /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be stored. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.ActualFiniteStateList"/> id that will be the source for each link table record. /// </param> /// <param name="possibleFiniteStateList"> /// The value for which a link table record wil be created. /// </param> /// <returns> /// True if the value link was successfully created. /// </returns> 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); } }
/// <summary> /// Reorder the supplied value collection of the association link table indicated by the supplied property name. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="propertyName"> /// The association property name that will be reordered. /// </param> /// <param name="iid"> /// The <see cref="ParameterSubscriptionValueSet"/> id that is the source for the reordered link table record. /// </param> /// <param name="orderUpdate"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the link was created. /// </returns> public bool ReorderCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, CDP4Common.Types.OrderedItem orderUpdate) { return(this.ParameterSubscriptionValueSetDao.ReorderCollectionProperty(transaction, partition, propertyName, iid, orderUpdate)); }
/// <summary> /// Reorder an item in an association link table. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be reordered. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.ArrayParameterType"/> id that will be the source for reordered link table record. /// </param> /// <param name="dimension"> /// The value for which a link table record wil be reordered. /// </param> /// <returns> /// True if the value link was successfully reordered. /// </returns> public bool ReorderDimension(NpgsqlTransaction transaction, string partition, Guid iid, CDP4Common.Types.OrderedItem dimension) { using (var command = new NpgsqlCommand()) { var sqlBuilder = new System.Text.StringBuilder(); sqlBuilder.AppendFormat("UPDATE \"{0}\".\"ArrayParameterType_Dimension\"", partition); sqlBuilder.AppendFormat(" SET (\"Sequence\")"); sqlBuilder.Append(" = (:reorderSequence);"); sqlBuilder.Append(" WHERE \"ArrayParameterType\" = :arrayParameterType"); sqlBuilder.Append(" AND \"Dimension\" = :dimension"); sqlBuilder.Append(" AND \"Sequence\" = :sequence;"); command.Parameters.Add("arrayParameterType", NpgsqlDbType.Uuid).Value = iid; command.Parameters.Add("dimension", NpgsqlDbType.Integer).Value = dimension.V; command.Parameters.Add("sequence", NpgsqlDbType.Bigint).Value = dimension.K; command.Parameters.Add("reorderSequence", NpgsqlDbType.Bigint).Value = dimension.M; command.CommandText = sqlBuilder.ToString(); command.Connection = transaction.Connection; command.Transaction = transaction; return(this.ExecuteAndLogCommand(command) > 0); } }
/// <summary> /// Reorder the supplied value collection of the association link table indicated by the supplied property name. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="propertyName"> /// The association property name that will be reordered. /// </param> /// <param name="iid"> /// The <see cref="RequirementsContainerParameterValue"/> id that is the source for the reordered link table record. /// </param> /// <param name="orderUpdate"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the link was created. /// </returns> public bool ReorderCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, CDP4Common.Types.OrderedItem orderUpdate) { return(this.RequirementsContainerParameterValueDao.ReorderCollectionProperty(transaction, partition, propertyName, iid, orderUpdate)); }
/// <summary> /// Update the containment order as indicated by the supplied orderedItem. /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="orderedItem"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the contained item was successfully reordered. /// </returns> public bool ReorderContainment(NpgsqlTransaction transaction, string partition, CDP4Common.Types.OrderedItem orderedItem) { throw new NotSupportedException(); }
/// <summary> /// Reorder the supplied value collection of the association link table indicated by the supplied property name /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="propertyName"> /// The association property name that will be reordered. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.ReferenceDataLibrary"/> id that is the source for the reordered link table record. /// </param> /// <param name="orderUpdate"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the value link was successfully reordered. /// </returns> public override bool ReorderCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, CDP4Common.Types.OrderedItem orderUpdate) { var isReordered = base.ReorderCollectionProperty(transaction, partition, propertyName, iid, orderUpdate); switch (propertyName) { case "BaseQuantityKind": { isReordered = this.ReorderBaseQuantityKind(transaction, partition, iid, orderUpdate); break; } default: { break; } } return(isReordered); }
/// <summary> /// Reorder the supplied value collection of the association link table indicated by the supplied property name. /// </summary> /// <param name="transaction"> /// The current <see cref="NpgsqlTransaction"/> to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource order will be updated. /// </param> /// <param name="propertyName"> /// The association property name that will be reordered. /// </param> /// <param name="iid"> /// The <see cref="Organization"/> id that is the source for the reordered link table record. /// </param> /// <param name="orderUpdate"> /// The order update information containing the new order key. /// </param> /// <returns> /// True if the link was created. /// </returns> public bool ReorderCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, CDP4Common.Types.OrderedItem orderUpdate) { return(this.OrganizationDao.ReorderCollectionProperty(transaction, partition, propertyName, iid, orderUpdate)); }
/// <summary> /// Insert a new association record in the link table. /// </summary> /// <param name="transaction"> /// The current transaction to the database. /// </param> /// <param name="partition"> /// The database partition (schema) where the requested resource will be stored. /// </param> /// <param name="iid"> /// The <see cref="CDP4Common.DTO.Definition"/> id that will be the source for each link table record. /// </param> /// <param name="example"> /// The value for which a link table record wil be created. /// </param> /// <returns> /// True if the value link was successfully created. /// </returns> public bool AddExample(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);"); command.Parameters.Add("definition", NpgsqlDbType.Uuid).Value = iid; command.Parameters.Add("example", NpgsqlDbType.Text).Value = 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); } }