/// **************************************************************** /// public Delete /// ---------------------------------------------------------------- /// <summary> /// </summary> /// **************************************************************** /// public override void Delete() { Debug.Enter(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_businessEntity_delete"); sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID); sp.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@contextID", SqlDbType.UniqueIdentifier); sp.Parameters.SetString("@PUID", Context.User.ID); sp.Parameters.SetGuidFromString("@businessKey", BusinessKey); sp.Parameters.SetGuid("@contextID", Context.ContextID); sp.ExecuteNonQuery(); // // Save the change log entry. // if (Context.LogChangeRecords) { ChangeRecord changeRecord = new ChangeRecord(); changeRecord.Payload = new ChangeRecordDelete(EntityType.BusinessEntity, BusinessKey); changeRecord.Log(); } Debug.Leave(); }
/// **************************************************************** /// public Save /// ---------------------------------------------------------------- /// <summary> /// Stores the bindingTemplate details into the database, as a /// child of the service specified by the key. /// </summary> /// **************************************************************** /// public override void Save() { Validate(); InnerSave(this.ServiceKey); // // Save the change log entry. // if (Context.LogChangeRecords) { ChangeRecord changeRecord = new ChangeRecord(); changeRecord.Payload = new ChangeRecordNewData(this); changeRecord.Log(); } }
public void Delete(CompletionStatusType status) { Debug.Enter(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_publisher_assertion_delete"); sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID); sp.Parameters.Add("@fromKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@toKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@keyName", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyName); sp.Parameters.Add("@keyValue", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyValue); sp.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@flag", SqlDbType.Int, ParameterDirection.InputOutput); sp.Parameters.SetString("@PUID", Context.User.ID); sp.Parameters.SetGuidFromString("@fromKey", FromKey); sp.Parameters.SetGuidFromString("@toKey", ToKey); sp.Parameters.SetString("@keyName", KeyedReference.KeyName); sp.Parameters.SetString("@keyValue", KeyedReference.KeyValue); sp.Parameters.SetGuidFromKey("@tModelKey", KeyedReference.TModelKey); if (CompletionStatusType.Uninitialized == status) { sp.Parameters.SetNull("@flag"); } else { sp.Parameters.SetInt("@flag", (int)status); } try { sp.ExecuteNonQuery(); int flag = sp.Parameters.GetInt("@flag"); if (Context.LogChangeRecords) { ChangeRecord changeRecord = new ChangeRecord(); changeRecord.Payload = new ChangeRecordDeleteAssertion(this, (CompletionStatusType)flag); changeRecord.Log(); } } catch (SqlException sqlException) { // // As per IN 60, we have to silently ignore assertions that reference keys to businesses that no longer // exist, or assertions that don't exist at all. // int exceptionNumber = sqlException.Number - UDDI.Constants.ErrorTypeSQLOffset; if ((exceptionNumber == ( int )ErrorType.E_invalidKeyPassed || exceptionNumber == ( int )ErrorType.E_assertionNotFound) && Context.ContextType == ContextType.Replication) { // // Set our exception source // Context.ExceptionSource = ExceptionSource.PublisherAssertion; } else { Context.ExceptionSource = ExceptionSource.Other; } // // Re-throw the exception so replication can properly log it. // throw sqlException; } Debug.Leave(); }
/// ********************************************************************** /// public Save /// ---------------------------------------------------------------------- /// <summary> /// </summary> /// ********************************************************************** /// public override void Save() { Debug.Enter(); // // Validate the business entity. // Validate(); // // Check to see if a business key was specified. If not, this is a new // record and a business key will have to be generated. // if (Utility.StringEmpty(BusinessKey)) { BusinessKey = Guid.NewGuid().ToString(); } // // Save the entity to the database. // SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_businessEntity_save"); sp.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID); sp.Parameters.Add("@generic", SqlDbType.VarChar, UDDI.Constants.Lengths.generic); sp.Parameters.Add("@contextID", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@lastChange", SqlDbType.BigInt); sp.Parameters.Add("@authorizedName", SqlDbType.NVarChar, UDDI.Constants.Lengths.AuthorizedName, ParameterDirection.InputOutput); sp.Parameters.Add("@operatorName", SqlDbType.NVarChar, UDDI.Constants.Lengths.Operator, ParameterDirection.InputOutput); sp.Parameters.SetGuidFromString("@businessKey", BusinessKey); sp.Parameters.SetString("@PUID", Context.User.ID); sp.Parameters.SetString("@generic", Constants.Version); sp.Parameters.SetGuid("@contextID", Context.ContextID); sp.Parameters.SetLong("@lastChange", DateTime.UtcNow.Ticks); sp.Parameters.SetString("@authorizedName", AuthorizedName); sp.Parameters.SetString("@operatorName", this.Operator); // // We won't set the operatorName since this will be derived from the PUID // sp.ExecuteNonQuery(); AuthorizedName = sp.Parameters.GetString("@authorizedName"); Operator = sp.Parameters.GetString("@operatorName"); // // Save all the contained objects. // DiscoveryUrls.Save(BusinessKey); if (Operator == Config.GetString("Operator")) { // // Only add the default discovery Url to this business // If it was published at this site. // DiscoveryUrls.AddDefaultDiscoveryUrl(BusinessKey); } Names.Save(BusinessKey, EntityType.BusinessEntity); Descriptions.Save(BusinessKey, EntityType.BusinessEntity); Contacts.Save(BusinessKey); BusinessServices.Save(BusinessKey); IdentifierBag.Save(BusinessKey, EntityType.BusinessEntity, KeyedReferenceType.IdentifierBag); CategoryBag.Save(BusinessKey, EntityType.BusinessEntity, KeyedReferenceType.CategoryBag); // // Save the change log entry for replication // if (Context.LogChangeRecords) { // // If we used a V1 API message, make sure to add in language codes for the names. We will // then take these names out after we save the change record. // if (1 == Context.ApiVersionMajor) { foreach (Name name in Names) { name.IsoLangCode = Context.User.IsoLangCode; } } ChangeRecord changeRecord = new ChangeRecord(); changeRecord.Payload = new ChangeRecordNewData(this); changeRecord.Log(); // // Take out language names if we are using V1. // if (1 == Context.ApiVersionMajor) { foreach (Name name in Names) { name.IsoLangCode = null; } } } Debug.Leave(); }