Book a Demo

Author Topic: Working With Interfaces (Operations/Behaviors)  (Read 4563 times)

blawton

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Working With Interfaces (Operations/Behaviors)
« on: July 29, 2011, 12:49:19 am »
Sorry if this is an obvious question, but EA isn't the most transparent environment.

I have an interface with a few child operations and I want to get access to those operations in my addin (and eventually the behaviors associated with those operations).

I get the selected object in my addin ok, but when I try to cast it to an EA.Element object I am informed that that is not the correct type -- what IS the correct type? When I look at the properties I see that the interface and its operations are all of Type Interface, and when I cast the parent as an EA.Element object it works fine, but I can't find any EA types to cast the operations to that will work. Help!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Working With Interfaces (Operations/Behaviors)
« Reply #1 on: July 29, 2011, 04:51:54 pm »
EA.Method

Geert

blawton

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Working With Interfaces (Operations/Behaviors)
« Reply #2 on: July 29, 2011, 11:08:01 pm »
Phew, thanks! That was holding me up.

blawton

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Working With Interfaces (Operations/Behaviors)
« Reply #3 on: August 02, 2011, 12:13:38 am »
A further question: I'm trying to determine what Action elements call my selected operation as a behavior. Where in the database structure is that information stored?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Working With Interfaces (Operations/Behaviors)
« Reply #4 on: August 02, 2011, 04:57:35 am »
This is the code I use in my EA Navigator:

  
Code: [Select]
/// <summary>
    /// returns all CallOperationActions that call this operation
    /// </summary>
    /// <returns>all CallOperationActions that call this operation</returns>
    public HashSet<UML.Actions.BasicActions.CallOperationAction> getDependentCallOperationActions()
    {
          string sqlCallOperationActions =
                @"SELECT a.Object_ID FROM t_operation op
                  inner join t_object a on op.ea_guid = a.Classifier_guid
                  where op.OperationID = " +this.wrappedOperation.MethodID;
          return new HashSet<UML.Actions.BasicActions.CallOperationAction>(this.model.getElementWrappersByQuery(sqlCallOperationActions).Cast<UML.Actions.BasicActions.CallOperationAction>());
    }

Geert

PS. Yes you read that right! They abused the fricking Classifier_guid to store the operations GUID ::)
« Last Edit: August 02, 2011, 04:59:47 am by Geert.Bellekens »