EA_GetCompartmentData [Guía de Usuario de Enterprise Architect] |
Top Previous Next |
Temas
Sintaxis: FunciónEA_GetCompartmentData(Repositorio como EA.Repository, sCompartment Como Cadena, sGUID Como Cadena, oType Como EA.ObjectType) como Variante La sintaxis de la función EA_QueryAvailableCompartments contiene los siguientes elementos:
Valor de Retorno: Una variante conteniendo una cadena formateada. Vea el ejemplo de abajo para ver el formato. Ejemplo
Función EA_GetCompartmentData(Repositorio como EA.Repository, sCompartment Como Cadena, sGUID Como Cadena, oType Como EA.ObjectType) como Variante
If Repository Is Nothing Then Exit Function End If
Dim sCompartmentData As String Dim oXML As MSXML2.DOMDocument Dim Nodes As MSXML2.IXMLDOMNodeList Dim Node1 As MSXML2.IXMLDOMNode Dim Node As MSXML2.IXMLDOMNode Dim sData As String
sCompartmentData = "" Set oXML = New MSXML2.DOMDocument sData = ""
On Error GoTo ERR_GetCompartmentData
oXML.loadXML (Repository.GetTreeXMLByGUID(sGUID)) Set Node1 = oXML.selectSingleNode("//ModelItem")
If Node1 Is Nothing Then Exit Function End If
sCompartmentData = sCompartmentData + "Name=" + sCompartment + ";" sCompartmentData = sCompartmentData + "OwnerGUID=" + sGUID + ";" sCompartmentData = sCompartmentData + "Options=SkipIfOnDiagram&_eq_^1&_sc_^"
Select Case sCompartment Case "parts" Set Nodes = Node1.selectNodes("ModelItem( @Metatype=""Part"" ) ") For Each Node In Nodes sData = sData + "Data&_eq_^" + Node.Attributes.getNamedItem("Name").nodeValue + "&_sc_^" sData = sData + "GUID&_eq_^" + Node.Attributes.getNamedItem("GUID").nodeValue + "&_sc_^," Next
Case "ports" Set Nodes = Node1.selectNodes("ModelItem( @Metatype=""Port"" ) ") For Each Node In Nodes sData = sData + "Data&_eq_^" + Node.Attributes.getNamedItem("Name").nodeValue + "&_sc_^" sData = sData + "GUID&_eq_^" + Node.Attributes.getNamedItem("GUID").nodeValue + "&_sc_^," Next
End Select
' Si no hay datos para mostrar, no devuelven ningún dato de compartimiento If sData <> "" Then sCompartmentData = sCompartmentData + "CompartmentData=" + sData + ";" Else sCompartmentData = "" End If
EA_GetCompartmentData = sCompartmentData Exit Function
ERR_GetCompartmentData: EA_GetCompartmentData = ""
End Function |