Book a Demo

Author Topic: Connector.AssociationClass not present in EA.Interop  (Read 7283 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Connector.AssociationClass not present in EA.Interop
« on: May 08, 2016, 04:55:44 pm »
According to http://sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/connector2_2.html the EA.ConnectorClass should contain a property called AssociationClass, but I get a compile error when trying to use that.

Bug reported

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Connector.AssociationClass not present in EA.Interop
« Reply #1 on: May 09, 2016, 09:01:58 am »
Looks like that got into the user guide early. It is coming, but it's not available yet.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Connector.AssociationClass not present in EA.Interop
« Reply #2 on: May 09, 2016, 09:25:00 am »
Looks like that got into the user guide early. It is coming, but it's not available yet.
And about time!   ;)

Will it apply to any connector type (not just Associations)?

We'd like to use the concept of a class (or shape) representing a binary relationship in a number of other scenarios / use cases.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Connector.AssociationClass not present in EA.Interop
« Reply #3 on: May 09, 2016, 11:03:03 am »
It's only providing a convenient API call for the existing behavior for Associations that are part of an Association Class.

It does not extend any other functionality.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Connector.AssociationClass not present in EA.Interop
« Reply #4 on: May 09, 2016, 05:06:58 pm »
It's only providing a convenient API call for the existing behavior for Associations that are part of an Association Class.

It does not extend any other functionality.
Is the API returning the object corresponding to the value of t_connector.PDATA1, but does not require the t_connector.Type to be Association?  That all I think I need to know for now.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connector.AssociationClass not present in EA.Interop
« Reply #5 on: May 09, 2016, 07:28:42 pm »
For those stumbling onto this post before the new feature has been released, this is the code in the Association class I wrote to implement it myself:

Code: [Select]
private AssociationClass _associationClass = null;
public AssociationClass associationClass
{
get
{
//TODO use the EA.Connector.AssociationClass property once fixed by Sparx
if (_associationClass == null)
{
int associationClassID;
if (int.TryParse(this.WrappedConnector.MiscData[0].ToString(),out associationClassID))
{
if (associationClassID > 0)
{
this._associationClass = this.model.getElementWrapperByID(associationClassID) as AssociationClass;
}
}
}
return _associationClass;
}
}
  }

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Connector.AssociationClass not present in EA.Interop
« Reply #6 on: May 10, 2016, 08:33:56 am »
Code: [Select]
if (associationClassID > 0)Should be
Code: [Select]
if (associationClassID != 0)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connector.AssociationClass not present in EA.Interop
« Reply #7 on: May 10, 2016, 01:43:38 pm »
Code: [Select]
if (associationClassID > 0)Should be
Code: [Select]
if (associationClassID != 0)
Why? Could the ElementID be a negative number too?

I guess in theory it could and only the value "0" is a special case to indicate no ID. I'll update my code.

Geert

VKN

  • EA User
  • **
  • Posts: 187
  • Karma: +9/-1
    • View Profile
Re: Connector.AssociationClass not present in EA.Interop
« Reply #8 on: May 10, 2016, 02:19:17 pm »
Why? Could the ElementID be a negative number too?
I think an ID for anything could have a negative number, especially I guess if the model has replicas.