Beispiel #1
0
 private void LoadSendPortGroups(BtsCatalogExplorer explorer, Application application)
 {
     TraceManager.SmartTrace.TraceIn();
     // Send Port Groups
     foreach (BizTalk.ExplorerOM.SendPortGroup sendPortGroup in application.SendPortGroups)
     {
         SendPortGroup spg = new SendPortGroup(sendPortGroup.Name);
         spg.Application = this;
         spg.Load(explorer, sendPortGroup);
         this.SendPortGroups.Add(spg);
     }
     TraceManager.SmartTrace.TraceOut();
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        internal override void FixReferences(BizTalkCore.BtsCatalogExplorer explorer)
        {
            TraceManager.SmartTrace.TraceIn(explorer);

            // Host
            if (this.Host != null)
            {
                Host h = this.Application.ParentInstallation.Hosts[this.Host.Name] as Host;

                if (h != null)
                {
                    this.host = h.NameIdPair;
                    h.HostedOrchestrations.Add(this.NameIdPair);
                }
            }

            // Ports
            foreach (OrchestrationPort port in this.ports)
            {
                if (port.ReceivePortName != null)
                {
                    ReceivePort rp = this.Application.ParentInstallation.ReceivePorts[port.ReceivePortName.Name] as ReceivePort;

                    if (rp != null)
                    {
                        port.ReceivePortName = rp.NameIdPair;
                        rp.BoundOrchestrations.Add(this.NameIdPair);
                    }
                }

                if (port.SendPortName != null)
                {
                    SendPort sp = this.Application.ParentInstallation.SendPorts[port.SendPortName.Name] as SendPort;

                    if (sp != null)
                    {
                        port.SendPortName = sp.NameIdPair;
                        sp.BoundOrchestrations.Add(this.NameIdPair);
                    }
                }

                if (port.SendPortGroupName != null)
                {
                    SendPortGroup spg = this.Application.ParentInstallation.SendPortGroups[port.SendPortGroupName.Name] as SendPortGroup;

                    if (spg != null)
                    {
                        port.SendPortGroupName = spg.NameIdPair;
                        spg.BoundOrchestrations.Add(this.NameIdPair);
                    }
                }
            }

            // Maps
            foreach (NameIdPair transform in this.transforms)
            {
                Transform t = this.Application.ParentInstallation.Maps[transform.Name] as Transform;

                if (t != null)
                {
                    transform.Id = t.NameIdPair.Id;
                    t.Orchestrations.Add(this.NameIdPair);
                }
            }

            // Role links
            foreach (OrchestrationRoleLink roleLink in this.roleLinks)
            {
                if (roleLink.ConsumerRole != null)
                {
                    Role role = this.Application.ParentInstallation.Roles[roleLink.ConsumerRole.Name] as Role;

                    if (role != null)
                    {
                        roleLink.ConsumerRole.Id = role.Id;
                    }
                }

                if (roleLink.ProviderRole != null)
                {
                    Role role = this.Application.ParentInstallation.Roles[roleLink.ProviderRole.Name] as Role;

                    if (role != null)
                    {
                        roleLink.ProviderRole.Id = role.Id;
                    }
                }

                if (roleLink.InitiatingRole != null)
                {
                    Role role = this.Application.ParentInstallation.Roles[roleLink.InitiatingRole.Name] as Role;

                    if (role != null)
                    {
                        roleLink.InitiatingRole.Id = role.Id;
                    }
                }
            }

            // Shape Map
            if (this.artifactData != string.Empty && this.viewData != string.Empty)
            {
                try
                {
                    Bitmap bmp = this.GetImage();
                    bmp.Dispose();

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(this.ArtifactData);

                    XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable);
                    xnm.AddNamespace("om", "http://schemas.microsoft.com/BizTalk/2003/DesignerData");

                    foreach (OrchShape os in this.ShapeMap)
                    {
                        switch (os.ShapeType)
                        {
                        case ShapeType.ReceiveShape:
                        case ShapeType.SendShape:
                            XmlNode shapeNode = doc.SelectSingleNode("//om:Element[@OID='" + os.Id + "']", xnm);

                            if (shapeNode != null)
                            {
                                os.PortName      = shapeNode.SelectSingleNode("om:Property[@Name='PortName']/@Value", xnm).Value;
                                os.OperationName = shapeNode.SelectSingleNode("om:Property[@Name='OperationName']/@Value", xnm).Value;
                                os.MessageName   = shapeNode.SelectSingleNode("om:Property[@Name='MessageName']/@Value", xnm).Value;
                            }
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    TraceManager.SmartTrace.TraceError(ex);
                }
            }

            TraceManager.SmartTrace.TraceOut();
            return;
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        internal override void FixReferences(BizTalkCore.BtsCatalogExplorer explorer)
        {
            TraceManager.SmartTrace.TraceIn(explorer);

            // Host
            if (this.Host != null)
            {
                Host h = this.Application.ParentInstallation.Hosts[this.Host.Name] as Host;

                if (h != null)
                {
                    this.host = h.NameIdPair;
                    h.HostedOrchestrations.Add(this.NameIdPair);
                }
            }

            // Ports
            foreach (OrchestrationPort port in this.ports)
            {
                if (port.ReceivePortName != null)
                {
                    ReceivePort rp = this.Application.ParentInstallation.ReceivePorts[port.ReceivePortName.Name] as ReceivePort;

                    if (rp != null)
                    {
                        port.ReceivePortName = rp.NameIdPair;
                        rp.BoundOrchestrations.Add(this.NameIdPair);
                    }
                }

                if (port.SendPortName != null)
                {
                    SendPort sp = this.Application.ParentInstallation.SendPorts[port.SendPortName.Name] as SendPort;

                    if (sp != null)
                    {
                        port.SendPortName = sp.NameIdPair;
                        sp.BoundOrchestrations.Add(this.NameIdPair);
                    }
                }

                if (port.SendPortGroupName != null)
                {
                    SendPortGroup spg = this.Application.ParentInstallation.SendPortGroups[port.SendPortGroupName.Name] as SendPortGroup;

                    if (spg != null)
                    {
                        port.SendPortGroupName = spg.NameIdPair;
                        spg.BoundOrchestrations.Add(this.NameIdPair);
                    }
                }
            }

            // Maps
            foreach (NameIdPair transform in this.transforms)
            {
                Transform t = this.Application.ParentInstallation.Maps[transform.Name] as Transform;

                if (t != null)
                {
                    transform.Id = t.NameIdPair.Id;
                    t.Orchestrations.Add(this.NameIdPair);
                }
            }

            // Role links
            foreach (OrchestrationRoleLink roleLink in this.roleLinks)
            {
                if (roleLink.ConsumerRole != null)
                {
                    Role role = this.Application.ParentInstallation.Roles[roleLink.ConsumerRole.Name] as Role;

                    if (role != null)
                    {
                        roleLink.ConsumerRole.Id = role.Id;
                    }
                }

                if (roleLink.ProviderRole != null)
                {
                    Role role = this.Application.ParentInstallation.Roles[roleLink.ProviderRole.Name] as Role;

                    if (role != null)
                    {
                        roleLink.ProviderRole.Id = role.Id;
                    }
                }

                if (roleLink.InitiatingRole != null)
                {
                    Role role = this.Application.ParentInstallation.Roles[roleLink.InitiatingRole.Name] as Role;

                    if (role != null)
                    {
                        roleLink.InitiatingRole.Id = role.Id;
                    }
                }
            }

            // Shape Map
            if (this.artifactData != string.Empty && this.viewData != string.Empty)
            {
                try
                {
                    Bitmap bmp = this.GetImage();
                    bmp.Dispose();

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(this.ArtifactData);

                    XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable);
                    xnm.AddNamespace("om", "http://schemas.microsoft.com/BizTalk/2003/DesignerData");

                    foreach (OrchShape os in this.ShapeMap)
                    {
                        switch (os.ShapeType)
                        {
                        case ShapeType.ReceiveShape:
                        case ShapeType.SendShape:
                            XmlNode shapeNode = doc.SelectSingleNode("//om:Element[@OID='" + os.Id + "']", xnm);

                            if (shapeNode != null)
                            {
                                os.PortName      = shapeNode.SelectSingleNode("om:Property[@Name='PortName']/@Value", xnm).Value;
                                os.OperationName = shapeNode.SelectSingleNode("om:Property[@Name='OperationName']/@Value", xnm).Value;
                                os.MessageName   = shapeNode.SelectSingleNode("om:Property[@Name='MessageName']/@Value", xnm).Value;
                            }
                            break;

                        case ShapeType.TransformShape:     // NJB TransformShape  -- CD Tidied this code.
                            XmlNode shapeNode2 = doc.SelectSingleNode("//om:Element[@OID='" + os.Id + "']", xnm);
                            XmlNode name       = shapeNode2.SelectSingleNode("om:Property[@Name='ClassName']/@Value", xnm);

                            if (name != null)
                            {
                                os.TransformName = name.Value;
                            }

                            XmlNodeList messagesIn = shapeNode2.SelectNodes("om:Element[@ParentLink='Transform_InputMessagePartRef']", xnm);

                            if (messagesIn != null)
                            {
                                foreach (XmlNode selectNode in messagesIn)
                                {
                                    foreach (XmlNode detail in selectNode.ChildNodes)
                                    {
                                        if (detail.Attributes != null)
                                        {
                                            if (detail.Attributes["Name"].Value == "MessageRef")
                                            {
                                                os.InputMessage += detail.Attributes["Value"].Value + ',';
                                            }
                                        }
                                    }
                                }
                            }

                            if (!string.IsNullOrEmpty(os.InputMessage))
                            {
                                os.InputMessage = os.InputMessage.Remove(os.InputMessage.LastIndexOf(","));
                            }

                            XmlNodeList messagesOut = shapeNode2.SelectNodes("om:Element[@ParentLink='Transform_OutputMessagePartRef']", xnm);

                            if (messagesOut != null)
                            {
                                foreach (XmlNode selectNode in messagesOut)
                                {
                                    foreach (XmlNode detail in selectNode.ChildNodes)
                                    {
                                        if (detail.Attributes != null)
                                        {
                                            if (detail.Attributes["Name"].Value == "MessageRef")
                                            {
                                                os.OutputMessage += detail.Attributes["Value"].Value + ',';
                                            }
                                        }
                                    }
                                }
                            }

                            if (!string.IsNullOrEmpty(os.OutputMessage))
                            {
                                os.OutputMessage = os.OutputMessage.Remove(os.OutputMessage.LastIndexOf(","));
                            }

                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    TraceManager.SmartTrace.TraceError(ex);
                }
            }

            TraceManager.SmartTrace.TraceOut();
            return;
        }