Пример #1
0
        /// ****************************************************************
        ///   public InnerSave
        ///	----------------------------------------------------------------
        ///	  <summary>
        ///		Stores the bindingTemplate details into the database.
        ///	  </summary>
        /// ****************************************************************
        ///
        internal void InnerSave(string serviceKey)
        {
            if (0 == ServiceKey.Length)
            {
                ServiceKey = serviceKey;
            }
            else
            {
                Debug.Verify(0 == String.Compare(ServiceKey, serviceKey, true), "UDDI_ERROR_INVALIDKEYPASSED_BINDINGPROJECTION", ErrorType.E_invalidKeyPassed);
            }

            if (Utility.StringEmpty(BindingKey))
            {
                //
                // This is an insert so, generate a bindingkey
                //
                BindingKey = Guid.NewGuid().ToString();
            }

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_bindingTemplate_save");

            sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID);
            sp.Parameters.Add("@bindingKey", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@serviceKey", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@generic", SqlDbType.VarChar, UDDI.Constants.Lengths.generic);
            sp.Parameters.Add("@URLTypeID", SqlDbType.TinyInt);
            sp.Parameters.Add("@accessPoint", SqlDbType.NVarChar, UDDI.Constants.Lengths.AccessPoint);
            sp.Parameters.Add("@hostingRedirector", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@contextID", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@lastChange", SqlDbType.BigInt);

            sp.Parameters.SetString("@PUID", Context.User.ID);
            sp.Parameters.SetGuidFromString("@bindingKey", BindingKey);
            sp.Parameters.SetGuidFromString("@serviceKey", ServiceKey);
            sp.Parameters.SetString("@generic", Constants.Version);
            sp.Parameters.SetGuid("@contextID", Context.ContextID);

            if (null != AccessPoint)
            {
                sp.Parameters.SetShort("@URLTypeID", (short)AccessPoint.URLType);
                sp.Parameters.SetString("@accessPoint", AccessPoint.Value);
            }

            if (null != HostingRedirector)
            {
                sp.Parameters.SetGuidFromString("@hostingRedirector", HostingRedirector.BindingKey);
            }

            sp.Parameters.SetLong("@lastChange", DateTime.UtcNow.Ticks);
            sp.ExecuteNonQuery();

            //
            // Save all contained objects.
            //
            Descriptions.Save(BindingKey, EntityType.BindingTemplate);
            TModelInstanceInfos.Save(BindingKey);
        }
Пример #2
0
        /// ****************************************************************
        ///   internal Validate
        ///	----------------------------------------------------------------
        ///	  <summary>
        ///	  </summary>
        /// ****************************************************************
        ///
        internal void Validate()
        {
            //
            // Check to make sure that either the hosting redirector or the accessPoint were specified
            //
            if (Utility.StringEmpty(AccessPoint.Value) && Utility.StringEmpty(HostingRedirector.BindingKey))
            {
                throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_BINDING_APVALUEMISSING");
            }

            //
            // Check for a circular reference
            //
            if (0 == String.Compare(BindingKey, HostingRedirector.BindingKey, true))
            {
                throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_BINDING_HRSELFREFERENCE");
            }

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_bindingTemplate_validate");

            sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID);
            sp.Parameters.Add("@bindingKey", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@serviceKey", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@hostingRedirector", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@flag", SqlDbType.Int);

            sp.Parameters.SetString("@PUID", Context.User.ID);
            sp.Parameters.SetGuidFromString("@bindingKey", BindingKey);
            sp.Parameters.SetGuidFromString("@serviceKey", ServiceKey);
            sp.Parameters.SetGuidFromString("@hostingRedirector", HostingRedirector.BindingKey);
            if (Context.User.AllowPreassignedKeys)
            {
                sp.Parameters.SetInt("@flag", 1);
            }
            else
            {
                sp.Parameters.SetInt("@flag", 0);
            }

            sp.ExecuteNonQuery();

            //
            // Validate field length for AccessPoint.Value
            //
            Utility.ValidateLength(ref AccessPoint.Value, "accessPoint", UDDI.Constants.Lengths.AccessPoint);

            Descriptions.Validate();
            TModelInstanceInfos.Validate();
        }
Пример #3
0
        /// ****************************************************************
        ///   public Get
        ///	----------------------------------------------------------------
        ///	  <summary>
        ///		Retrieves the bindingTemplate details from the database.
        ///	  </summary>
        ///	----------------------------------------------------------------
        ///   <returns>
        ///	  </returns>
        ///	----------------------------------------------------------------
        ///	  <remarks>
        ///	    The bindingKey must be set prior to execution of this call.
        ///	  </remarks>
        /// ****************************************************************
        ///
        public override void Get()
        {
            Debug.Enter();

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_bindingTemplate_get_batch");

            sp.Parameters.Add("@bindingKey", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@serviceKey", SqlDbType.UniqueIdentifier, ParameterDirection.Output);
            sp.Parameters.Add("@URLTypeID", SqlDbType.TinyInt, ParameterDirection.Output);
            sp.Parameters.Add("@accessPoint", SqlDbType.NVarChar, UDDI.Constants.Lengths.AccessPoint, ParameterDirection.Output);
            sp.Parameters.Add("@hostingRedirector", SqlDbType.UniqueIdentifier, ParameterDirection.Output);

            sp.Parameters.SetGuidFromString("@bindingKey", BindingKey);

            SqlDataReaderAccessor reader      = null;
            ArrayList             instanceIds = new ArrayList();

            try
            {
                //
                // net_bindingTemplate_get will return the objects contained in a business in the following order:
                //
                //	- descriptions
                //  - tmodel instance infos
                reader = sp.ExecuteReader();

                //
                // Read the descriptions
                //
                Descriptions.Read(reader);

                //
                // Read the tmodel instance infos
                //
                if (true == reader.NextResult())
                {
                    instanceIds = TModelInstanceInfos.Read(reader);
                }
            }
            finally
            {
                if (null != reader)
                {
                    reader.Close();
                }
            }

            //
            // These calls will make separate sproc calls, so we have to close our reader first.
            //
            TModelInstanceInfos.Populate(instanceIds);

            //
            // Get output parameters
            //
            ServiceKey                   = sp.Parameters.GetGuidString("@serviceKey");
            AccessPoint.URLType          = (URLType)sp.Parameters.GetInt("@URLTypeID");
            AccessPoint.Value            = sp.Parameters.GetString("@accessPoint");
            HostingRedirector.BindingKey = sp.Parameters.GetGuidString("@hostingRedirector");

#if never
            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_bindingTemplate_get");

            sp.Parameters.Add("@bindingKey", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@serviceKey", SqlDbType.UniqueIdentifier, ParameterDirection.Output);
            sp.Parameters.Add("@URLTypeID", SqlDbType.TinyInt, ParameterDirection.Output);
            sp.Parameters.Add("@accessPoint", SqlDbType.NVarChar, UDDI.Constants.Lengths.AccessPoint, ParameterDirection.Output);
            sp.Parameters.Add("@hostingRedirector", SqlDbType.UniqueIdentifier, ParameterDirection.Output);

            sp.Parameters.SetGuidFromString("@bindingKey", BindingKey);

            sp.ExecuteNonQuery();

            ServiceKey                   = sp.Parameters.GetGuidString("@serviceKey");
            AccessPoint.URLType          = (URLType)sp.Parameters.GetInt("@URLTypeID");
            AccessPoint.Value            = sp.Parameters.GetString("@accessPoint");
            HostingRedirector.BindingKey = sp.Parameters.GetGuidString("@hostingRedirector");

            //
            // Get all contained objects.
            //
            Descriptions.Get(BindingKey, EntityType.BindingTemplate);
            TModelInstanceInfos.Get(BindingKey);
#endif

            QueryLog.Write(QueryType.Get, EntityType.BindingTemplate);
        }