Author Topic: Class operation parameter types  (Read 2924 times)

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Class operation parameter types
« on: June 26, 2024, 05:24:57 am »
I have two classes, "Class1" with a single operation, "oper(param:Class2[0..*])", and Class2, which contains a single attribute, name:string.  I've tried to bind the type of the parameter, 'param', to Class2, but the fact that it's an array keeps it from binding.  I've not found any way to add multiplicity to the parameter param.  Need help with a way to bind Class2 with multiplicity to the parameter.   

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #1 on: August 30, 2024, 05:16:27 am »
Is there anyone who can tell me how to add multiplicity to an operation parameter type?

qwerty

  • EA Guru
  • *****
  • Posts: 13574
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Class operation parameter types
« Reply #2 on: August 31, 2024, 08:33:22 am »
I'd guess it's either or. If you select the type then you have no multiplicity. Or you use a string which does not reference a classifier. Alternatively you could model a class like list that represents sort of an array.

q.

ea0522

  • EA User
  • **
  • Posts: 113
  • Karma: +3/-0
    • View Profile
Re: Class operation parameter types
« Reply #3 on: September 03, 2024, 03:41:27 pm »
Have you tried using a connector between the parameter and Class2?
With connectors, you can define multiplicity on either end.

Takeshi K

  • EA User
  • **
  • Posts: 542
  • Karma: +33/-1
    • View Profile
Re: Class operation parameter types
« Reply #4 on: September 03, 2024, 06:18:58 pm »
Hello tweber,

You can specify the multiplicity of parameters, but currently EA does not seem to support displaying the specified multiplicity like method(p1 : Class2[1..*]).

1. select the Class in the diagram
2. select the target operation in the Class (you can select an operation when you select the owing Class)
3. double-click the operation to open the propety dialog of the operation
4. you can specify the multiplicity from the Parameter group in the dialog



--
t-kouno

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #5 on: September 03, 2024, 10:11:26 pm »
I just got the answer from Sparx support.  I can't specify the cardinality (multiplicity) of a parameter in an operation.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13136
  • Karma: +547/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Class operation parameter types
« Reply #6 on: September 03, 2024, 10:22:38 pm »
I just got the answer from Sparx support.  I can't specify the cardinality (multiplicity) of a parameter in an operation.
Well, they are wrong. You can definitely enter the multiplicity of a parameter following the instructions of Takeshi

Geert

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #7 on: September 04, 2024, 03:05:18 am »
Agreed.  I can see the info in the t_xref table.  That said, I'm  trying to figure out how to access (or change) the same info in a jscript script.  Appreciate any help.  TIA.

qwerty

  • EA Guru
  • *****
  • Posts: 13574
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Class operation parameter types
« Reply #8 on: September 04, 2024, 07:32:30 am »
t_xref's content is only sparsely accessible from the API. In most cases a SQL query is the way to go. For manpulating it you have to fall back to repository.execute(<sql>). Always remember that this is like playing with an unsecured weapon. Know what you're doing and throughly test it in a playground first!

q.

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #9 on: September 04, 2024, 09:27:08 pm »
This is what I've determined so far.  The info I need is hidden within parameter.TypeInfoProperties. Each element within is a TypeInfoProperty.  I've accessed so far by indexing through TypeInfoProperties.items(i). The issue is that while I can access the TypeInfoProperty.Name, not all of the TypeInfoProperty.Value values appear (the booleans do, as well as 'direction', but the others appear as undefined values).  Again, TIA.

qwerty

  • EA Guru
  • *****
  • Posts: 13574
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Class operation parameter types
« Reply #10 on: September 05, 2024, 06:24:26 am »
I'm no more that deep in the matter since I'm retired (and tired of Sparx at all). I'll see if I can get up to digging into this once more.

q.

philchudley

  • EA User
  • **
  • Posts: 730
  • Karma: +19/-0
  • UML/EA Principal Consultant / Trainer
    • View Profile
Re: Class operation parameter types
« Reply #11 on: September 05, 2024, 09:01:00 pm »
Here's what I found in t_xref for a test parameter multiplicity of 1..*

XrefID,Name,Type,Visibility,Namespace,Requirement,Constraint,Behavior,Partition,Description,Client,Supplier,Link,

{D8433594-6904-416a-B247-DA7EC76655B5},CustomProperties,parameter property,Public, , , , ,0,@PROP=@NAME=lower@ENDNAME;@TYPE=Integer@ENDTYPE;@VALU=1@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;@PROP=@NAME=upper@ENDNAME;@TYPE=UnlimitedNatural@ENDTYPE;@VALU=*@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;@PROP=@NAME=isUnique@ENDNAME;@TYPE=Boolean@ENDTYPE;@VALU=0@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;,{4E9BC795-3D5A-4eb7-A916-65648B6F004E},<none>, ,

The multiplicity encapsulated within the Description field is here:

@PROP=@NAME=lower@ENDNAME;@TYPE=Integer@ENDTYPE;@VALU=1@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;@PROP=@NAME=upper@ENDNAME;@TYPE=UnlimitedNatural@ENDTYPE;@VALU=*@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;

t_xref.Client is the GUID of the operation parameter

t_xref.Type = parameter property

So

1) Extract required row(s) from t_xref using a SQL Query
2) Split t.xref.Description into its parts using ; storing in a String[]
3) Extract the info you want from the String[] using subscripts (you can work out the value from the above example) ...


Hope this helps

Phil
follow me on Twitter

@SparxEAGuru

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #12 on: September 05, 2024, 10:27:58 pm »
Appreciate the replies.  I've seen the t_xref output.  I'm trying to determine how to  modify this information in a script (jscript preferable, but I can probably determine the equivalent from a vbScript).  I'm concentrating on the TypeInfoProperties class, as parameter appears to hold the lowerBound and upperBound info there.  I've tried to output in a jscript, but appear to be missing something.

qwerty

  • EA Guru
  • *****
  • Posts: 13574
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Class operation parameter types
« Reply #13 on: September 06, 2024, 06:52:42 am »
You can use repository.execute("UPDATE ..."). This is an undocumented feature but it works. In ordrer to create new entries you can use any GUID generator where needed.

Again: this might clobber your DB so test in a sandbox extensively!

q.

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #14 on: September 06, 2024, 09:09:08 pm »
If it were for me, I wouldn't worry about using an undocumented feature.  However, I can't chance blowing up the model we have.  There has to be a way to do this using parameter attributes.