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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13240
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Class operation parameter types
« Reply #15 on: September 06, 2024, 09:50:44 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.
Not every aspect of the EA model is exposed in the API. For some things you don't have any other choice.
If you know what you are doing and test properly it should be OK.
Not sure if this is one of those cases though. I'll have a closer look when I find the time..

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13240
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Class operation parameter types
« Reply #16 on: September 07, 2024, 12:03:49 am »
I did a bit of digging and wrote a small test script

Code: [Select]
function testParameterMultiplicity()
dim operation as EA.Method
set operation = Repository.GetMethodByGuid("{BDE09079-D60A-4cf8-93AA-01057665DC9C}")
dim parameter as EA.Parameter
for each parameter in operation.Parameters
Session.Output "Parameter name: " & parameter.Name
dim i
for i = 0 to parameter.TypeInfoProperties.Count -1
dim propertyItem as EA.TypeInfoProperty
set propertyItem = parameter.TypeInfoProperties.Items(i)
dim propertyValue
propertyValue = propertyItem.Value
Session.Output "property name: " & propertyItem.Name & " property value: " & propertyItem.Value
next
dim updated
updated = parameter.TypeInfoProperties.SetProperty("lowerValue", "0")
Session.Output "updated lowerValue: " & updated
updated = parameter.TypeInfoProperties.SetProperty("isOrdered", "True")
Session.Output "updated isOrdered: " & updated
next
end function

The results in the Session output:

Code: [Select]
[26893073]      Parameter name: param1
[26893094]      property name: direction property value: in
[26893102]      property name: effect property value:
[26893110]      property name: isException property value: False
[26893118]      property name: lowerValue property value:
[26893127]      property name: name property value:
[26893134]      property name: isOrdered property value: True
[26893142]      property name: isStream property value: False
[26893150]      property name: type property value:
[26893159]      property name: isUnique property value: True
[26893166]      property name: upperValue property value:
[26893179]      property name: visibility property value:
[26893186]      updated lowerValue: False
[26893191]      updated isOrdered: True

As you can see there is a lowerValue and a upperValue property, which I assume was meant to represent the lowerBound and upperBound of the multiplicity of the parameter, but unfortunately these properties always return an empty string.
Trying to update them using this properties object doesn't work either. (as opposed to the isOrdered property, which I can update just fine)

I consider this a bug that should be reported to Sparx.
In the meantime, I'm afraid there's no alternative to using Repository.SQLQuery() (for reading) and Repository.Execute() (for updating)

Geert

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #17 on: September 07, 2024, 12:38:28 am »
I was getting something for the TypeInfoProperties collection in JScript.
param TypeInfoProperty Name : direction
param TypeInfoProperty Value: in
param TypeInfoProperty Name : effect
param TypeInfoProperty Value:
param TypeInfoProperty Name : isException
param TypeInfoProperty Value: false
param TypeInfoProperty Name : lowerValue
param TypeInfoProperty Value: undefined
param TypeInfoProperty Name : name
param TypeInfoProperty Value: undefined
param TypeInfoProperty Name : isOrdered
param TypeInfoProperty Value: false
param TypeInfoProperty Name : isStream
param TypeInfoProperty Value: false
param TypeInfoProperty Name : type
param TypeInfoProperty Value: undefined
param TypeInfoProperty Name : isUnique
param TypeInfoProperty Value: true
param TypeInfoProperty Name : upperValue
param TypeInfoProperty Value: undefined
param TypeInfoProperty Name : visibility
param TypeInfoProperty Value: undefined

Note that except for the booleans, direction, and effect, the other values are undefined, which is strange.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Class operation parameter types
« Reply #18 on: September 07, 2024, 05:25:54 am »
Not strange, but simply a bug as Geert mentioned. Report it...

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Class operation parameter types
« Reply #19 on: September 09, 2024, 06:33:14 pm »
Not strange, but simply a bug as Geert mentioned. Report it...

q.
Wot 'e sed!

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

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Class operation parameter types
« Reply #20 on: September 09, 2024, 10:09:10 pm »
I have asked support about it. 

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Class operation parameter types
« Reply #21 on: September 10, 2024, 02:32:25 am »
There IS a bug reporting form down here.

q.