Author Topic: Linked to Element Feature  (Read 143 times)

George..Brennan

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Linked to Element Feature
« on: November 25, 2017, 12:54:17 am »
VBScripting ( ugh )

Well It looks like I can add a connector between Elements but when I try to use StyleEx to add an atttribute level link such..

   newStyleEx = "LFEP=" & oAttributeSource.AttributeGUID & "L;LFSP=" & oAttributeTarget.AttributeGUID & "R;"               
   'Session.Output("+:" & newStyleEx )
   set oConnector = oSource.Connectors.AddNew ("","Association")
   oConnector.StyleEx = newStyleEx
   oConnector.SupplierID = oTarget.ElementID
   oConnector.update()


everthing looks fine in the database tables but it's not rendering the attribute linkage ends only the relation ship to the element.

Can anyone please tell me what am I missing ?

G.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7752
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Linked to Element Feature
« Reply #1 on: November 25, 2017, 05:49:21 pm »
Hi George,

This is the code I have from in ConnectorWrapper
I don't see immediately what is wrong in your code.

Code: [Select]
    private void setLinkedFeature(UML.Classes.Kernel.Element linkedFeature, bool isSource)
    {
//check if attribute
Element actualEnd = linkedFeature as Attribute;
//or maybe operation
if (actualEnd == null) actualEnd = linkedFeature as Operation;
if (actualEnd != null)
{

//set the client id to the id of the owner
if (isSource)
{
_source = linkedFeature;
this.wrappedConnector.ClientID = ((ElementWrapper)actualEnd.owner).id;
}
else
{
_target = linkedFeature;
this.wrappedConnector.SupplierID = ((ElementWrapper)actualEnd.owner).id;
}
//set the linked feature
string key = isSource ? "LFSP" : "LFEP";
string suffix = isSource ? "R":"L";
string styleEx = KeyValuePairsHelper.setValueForKey(key,linkedFeature.uniqueID + suffix,this.wrappedConnector.StyleEx);
this.wrappedConnector.StyleEx = styleEx;
}
    }

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 8972
  • Karma: +136/-124
  • I'm no guru at all
    • View Profile
Re: Linked to Element Feature
« Reply #2 on: November 27, 2017, 03:49:43 am »
You could cross check by simply creating another connector manually and looking the the t_connector to see if both are looking identically.

q.

Guillaume

  • EA User
  • **
  • Posts: 549
  • Karma: +18/-0
    • View Profile
    • www.umlchannel.com
Re: Linked to Element Feature
« Reply #3 on: November 27, 2017, 06:27:00 pm »
Hi George,

I think the LFSP & LFEP are not associated with the right attribute.
Have you tried switching them to:

   newStyleEx = "LFEP=" & oAttributeTarget.AttributeGUID & "L;LFSP=" & oAttributeSource.AttributeGUID & "R;"     

Guillaume
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com | Automated tests for scripts & addins: www.eatests.com

George..Brennan

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Linked to Element Feature
« Reply #4 on: November 27, 2017, 08:43:54 pm »
Hi Guillaume,

Many thanks, working fine now.

George