Ejemplo n.º 1
0
        public ChangeRecordPublisherAssertion(PublisherAssertion assertion, CompletionStatusType status)
        {
            Assertion = assertion;

            FromBusinessCheck = (0x02 == ((int)status & 0x02));
            ToBusinessCheck   = (0x01 == ((int)status & 0x01));
        }
Ejemplo n.º 2
0
 public AssertionStatusItem(CompletionStatusType completionStatus, string fromKey, string toKey, KeyedReference keyedReference, KeysOwned keysOwned)
 {
     this.CompletionStatus = completionStatus;
     this.FromKey          = fromKey;
     this.ToKey            = toKey;
     this.KeyedReference   = keyedReference;
     this.KeysOwned        = keysOwned;
 }
Ejemplo n.º 3
0
        public void Get(CompletionStatusType completionStatus)
        {
            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_publisher_assertionStatus_get");

            sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID);
            sp.Parameters.SetString("@PUID", Context.User.ID);

            if (CompletionStatusType.Uninitialized != completionStatus)
            {
                //
                // If the completion status was not specified get all
                // of the assertions by not specifying a completionStatus value
                // in the stored procedure.
                //
                sp.Parameters.Add("@completionStatus", SqlDbType.Int);
                sp.Parameters.SetInt("@completionStatus", (int)completionStatus);
            }

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    KeyedReference keyedReference = new KeyedReference(
                        reader.GetString("keyName"),
                        reader.GetString("keyValue"),
                        reader.GetKeyFromGuid("tModelKey"));

                    CompletionStatusType status =
                        (CompletionStatusType)reader.GetInt("flag");

                    string fromKey = reader.GetGuidString("fromKey");
                    string toKey   = reader.GetGuidString("toKey");

                    int ownerFlag = reader.GetInt("ownerFlag");

                    KeysOwned keysOwned = new KeysOwned();

                    if (0x02 == (ownerFlag & 0x02))
                    {
                        keysOwned.FromKey = fromKey;
                    }

                    if (0x01 == (ownerFlag & 0x01))
                    {
                        keysOwned.ToKey = toKey;
                    }

                    this.Add(
                        new AssertionStatusItem(
                            status,
                            fromKey,
                            toKey,
                            keyedReference,
                            keysOwned));
                }
            }
            finally
            {
                reader.Close();
            }
        }
Ejemplo n.º 4
0
 public void Get(CompletionStatusType completionStatus)
 {
     AssertionStatusItems.Get(completionStatus);
 }
Ejemplo n.º 5
0
        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();
        }