예제 #1
0
        private void RenderServiceDetail(string serviceKey, HtmlTextWriter writer)
        {
            //
            // Get details for this service
            //
            StringCollection serviceKeys = new StringCollection();

            serviceKeys.Add(serviceKey);

            ServiceDetail serviceDetail = new ServiceDetail();

            serviceDetail.Get(serviceKeys);

            //
            // We will only get the first one
            //
            BusinessService businessService = serviceDetail.BusinessServices[0];

            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "serviceDetailOuterTable");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            //
            // Render the business descriptions if there is one
            //
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.Write(Localization.GetString("AWR_SERVICE_DESCRIPTION"));
            writer.RenderEndTag();                      // B
            writer.RenderEndTag();                      // Td
            writer.RenderEndTag();                      // Tr

            foreach (Description description in businessService.Descriptions)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write(Server.HtmlEncode(description.Value));
                writer.RenderEndTag();                          // Td
                writer.RenderEndTag();                          // Tr
            }

            //
            // Render each binding in the service that has a WSDL file associated with it
            //
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.Write(Localization.GetString("AWR_BINDINGS"));
            writer.RenderEndTag();                      // B
            writer.RenderEndTag();                      // Td
            writer.RenderEndTag();                      // Tr

            foreach (BindingTemplate bindingTemplate in businessService.BindingTemplates)
            {
                //
                // Render each binding in a row
                //
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "accessPointTable");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);

                //
                // Render the access point
                //
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.B);
                writer.Write(Localization.GetString("AWR_ACCESS_POINT"));
                writer.RenderEndTag();                          // B
                writer.RenderEndTag();                          // Td
                writer.RenderEndTag();                          // Tr

                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write(Server.HtmlEncode(bindingTemplate.AccessPoint.Value));
                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr

                //
                // Render the descriptions.
                //
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.B);
                writer.Write(Localization.GetString("AWR_DESCRIPTION"));
                writer.RenderEndTag();                  // B
                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr

                foreach (Description description in bindingTemplate.Descriptions)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(Server.HtmlEncode(description.Value));
                    writer.RenderEndTag();                      // Td
                    writer.RenderEndTag();                      // Tr

                    //
                    // Render an empty row between descriptions
                    //
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.RenderEndTag();                      // Tr
                    writer.RenderEndTag();                      // Td
                }

                //
                // Render the WSDL files.  We are assuming that any overview doc urls are urls to WSDL files
                //
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.B);
                writer.Write(Localization.GetString("AWR_ID"));
                writer.RenderEndTag();                  // B
                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr

                int wsdlCount = 0;

                foreach (TModelInstanceInfo instanceInfo in bindingTemplate.TModelInstanceInfos)
                {
                    //
                    // Get the tModel related to this instance.
                    //
                    TModel tModel = new TModel(instanceInfo.TModelKey);

                    //
                    // We don't want any exceptions ruining the rest of our display
                    //
                    try
                    {
                        //
                        // Get details for this tModel.
                        //
                        tModel.Get();

                        bool isWsdlSpec = false;
                        foreach (KeyedReference keyedReference in tModel.CategoryBag)
                        {
                            if (true == keyedReference.KeyValue.Equals(UDDI.Constants.UDDITypeTaxonomyWSDLSpecKeyValue) &&
                                true == keyedReference.TModelKey.ToLower().Equals(UDDI.Constants.UDDITypeTaxonomyTModelKey))
                            {
                                isWsdlSpec = true;
                                break;
                            }
                        }

                        //
                        // If this tModel has an overview doc, then consider that document as the link to the
                        // WSDL file.
                        //
                        if (true == isWsdlSpec &&
                            null != tModel.OverviewDoc.OverviewURL &&
                            tModel.OverviewDoc.OverviewURL.Length > 0)
                        {
                            //
                            // Render the WSDL link
                            //
                            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                            writer.RenderBeginTag(HtmlTextWriterTag.Td);

                            //
                            // Render the arrow image.
                            //
                            writer.AddAttribute(HtmlTextWriterAttribute.Src, "../images/orange_arrow_right.gif");
                            writer.RenderBeginTag(HtmlTextWriterTag.Img);
                            writer.Write(" ");
                            writer.RenderEndTag();                              // Img

                            //
                            // Make the overview URL a hyper link
                            //
                            writer.AddAttribute(HtmlTextWriterAttribute.Href, tModel.OverviewDoc.OverviewURL);
                            writer.RenderBeginTag(HtmlTextWriterTag.A);
                            writer.Write(tModel.OverviewDoc.OverviewURL);
                            writer.RenderEndTag();                              // A

                            //
                            // Render the first description if there is one
                            //
                            if (tModel.OverviewDoc.Descriptions.Count > 0)
                            {
                                writer.Write(" - ");
                                writer.Write(tModel.OverviewDoc.Descriptions[0].Value);
                            }

                            wsdlCount++;

                            writer.RenderEndTag();                              // Td
                            writer.RenderEndTag();                              // Tr
                        }
                    }
                    catch
                    {
                        //
                        // Intentionally empty.
                        //
                    }
                }

                //
                // If there were no WSDL files registered, render a message saying so.
                //
                if (0 == wsdlCount)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(Localization.GetString("AWR_NO_WSDLS"));
                    writer.RenderEndTag();                      // Td
                    writer.RenderEndTag();                      // Tr
                }

                writer.RenderEndTag();          // TABLE
                writer.RenderEndTag();          // Td
                writer.RenderEndTag();          // Tr
            }
            writer.RenderEndTag();              // TABLE
        }
예제 #2
0
        public void Save()
        {
            string tmodelkey;

            Debug.Enter();

            Debug.Write(SeverityType.Info, CategoryType.Data, "Importing categorization scheme...");

            if (null != TModel)
            {
                TModel.AuthorizedName = null;
                TModel.Save();
            }
            else
            {
                TModel = new TModel(TModelKey);
                TModel.Get();
            }

            //
            // If the TModel Provided is categorized with 'Browsing Intended'
            // Set the flag (0x0002)
            //
            //if( TModel.CategoryBag.Contains( new KeyedReference( "Browsing Intended","1","uuid:BE37F93E-87B4-4982-BF6D-992A8E44EDAB" ) ) )
            foreach (KeyedReference kr in TModel.CategoryBag)
            {
                if (kr.KeyValue == "1" && kr.TModelKey.ToUpper() == "UUID:BE37F93E-87B4-4982-BF6D-992A8E44EDAB")
                {
                    CategorizationSchemeFlag = CategorizationSchemeFlag | 0x0002;
                }
            }

            //
            // Store the TModelKey
            //
            tmodelkey = TModel.TModelKey;

            //
            // Save the categorization scheme
            //

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();

            sp.ProcedureName = "net_taxonomy_save";

            sp.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@flag", SqlDbType.Int);
            sp.Parameters.Add("@taxonomyID", SqlDbType.BigInt, ParameterDirection.InputOutput);

            sp.Parameters.SetGuidFromKey("@tModelKey", tmodelkey);
            sp.Parameters.SetInt("@flag", CategorizationSchemeFlag);

            sp.ExecuteNonQuery();

            int taxonomyID = sp.Parameters.GetInt("@taxonomyID");

            //
            // Save the category values
            //

            foreach (CategoryValue cv in CategoryValues)
            {
                cv.Save(tmodelkey);
            }

            Debug.Leave();
        }