Part 2 of 2:
/*
* Adds an entry for the method object 'theRelationship' to the xml row node 'rowsNode'
*/
function AddRow( xmlDOM, rowsNode, theRelationship )
{
// Cast theMethod for intellisense
var relationship as EA.Connector;
relationship = theRelationship;
// Create a Row node
var row = xmlDOM.createElement( "Row" );
// Get client details for the connector
var client as EA.Element;
var clientEnd as EA.ConnectorEnd;
client = Repository.GetElementByID( relationship.ClientID );
clientEnd = relationship.ClientEnd;
// Get supplier details for the connector
var supplier as EA.Element;
var supplierEnd as EA.ConnectorEnd;
supplier = Repository.GetElementByID( relationship.SupplierID );
supplierEnd = relationship.SupplierEnd;
// Add the Model Search row data to our DOM
AddField( xmlDOM, row, "CLASSGUID", relationship.ConnectorGUID );
AddField( xmlDOM, row, "CLASSTYPE", "connector" );
AddField( xmlDOM, row, "Client", client.Name );
AddField( xmlDOM, row, "Client", supplier.Name );
AddField( xmlDOM, row, "Direction", relationship.Direction );
AddField( xmlDOM, row, "Name", relationship.Name );
AddField( xmlDOM, row, "Notes", relationship.Notes );
AddField( xmlDOM, row, "Client Aggregation", clientEnd.Aggregation );
AddField( xmlDOM, row, "Client Cardinality", clientEnd.Cardinality );
AddField( xmlDOM, row, "Client Role", clientEnd.Role );
AddField( xmlDOM, row, "Supplier Aggregation", supplierEnd.Aggregation );
AddField( xmlDOM, row, "Supplier Cardinality", supplierEnd.Cardinality );
AddField( xmlDOM, row, "Supplier Role", supplierEnd.Role );
// Append the newly created row node to the rows node
rowsNode.appendChild( row );
}
/*
* Adds an Element to our DOM called Field which makes up the Row data for the Model Search window.
* <Field name "" value ""/>
*/
function AddField( xmlDOM, row, name, value )
{
var fieldNode = xmlDOM.createElement( "Field" );
// Create first attribute for the name
var nameAttribute = xmlDOM.createAttribute( "name" );
nameAttribute.value = name;
fieldNode.attributes.setNamedItem( nameAttribute );
// Create second attribute for the value
var valueAttribute = xmlDOM.createAttribute( "value" );
valueAttribute.value = value;
fieldNode.attributes.setNamedItem( valueAttribute );
// Append the fieldNode
row.appendChild( fieldNode );
}
ListDiagramConnectors();