Author Topic: Read only property and property constraints  (Read 14358 times)

sovetnikov

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Read only property and property constraints
« on: February 26, 2013, 06:31:20 am »
Hello!

I'm evaluating EA 10 and have a few questions.

Is there a way to:
1. Set readOnly prop-modifier for attribute?
I see nothing about it in attributes dialog, i can see isId, but not readOnly.

2. Show property constraints in attributes compartment of a class?
« Last Edit: February 26, 2013, 06:31:48 am by sovetnikov »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Read only property and property constraints
« Reply #1 on: February 26, 2013, 08:29:47 am »
1. create the attribute and select  Property. The window that pops up will allow what you need.

2. AFAIK no except you write some very tricky shape script

q.

sovetnikov

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Read only property and property constraints
« Reply #2 on: February 26, 2013, 05:39:23 pm »
1. Thanks, but i do not see "is read only" in the general or details section of attributes window.
I'm missing something?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13226
  • Karma: +550/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Read only property and property constraints
« Reply #3 on: February 26, 2013, 06:59:50 pm »
You have to tick the checkbox "Property" on the General tab of the Attribute.

Geert

sovetnikov

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Read only property and property constraints
« Reply #4 on: February 26, 2013, 08:24:17 pm »
Thanks Geert, now it's clear.
But i think this feature is primary for code generation, not for setting readOnly prop-modifier.

I expect that property will be presented as "+name:int {readOnly}"

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13226
  • Karma: +550/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Read only property and property constraints
« Reply #5 on: February 26, 2013, 08:31:41 pm »
AFAIK there's no standard UML "read-only" property on an attribute.
So you'll either have to use a tagged value, or a constraint to indicate this.
Unfortunately attribute constraints are not visible on diagrams.

There's a very dirty trick however that you can use if your only intend is to show get is graphically in order.
You can create a tagged value with the name "xUML" If you set the value of this taggedvalue to "{read-only} this appears next to the attribute's definition.

Geert
« Last Edit: February 26, 2013, 08:32:02 pm by Geert.Bellekens »

sovetnikov

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Read only property and property constraints
« Reply #6 on: February 26, 2013, 09:27:54 pm »
UML 2.4 Property class has isReadOnly attribute, as well as isID wich can be set directly in Details section.
Seems my problem is that in EA isReadOnly presented by Read and Write check boxes in property creation dialog and there is no way to display it in diagram.

xUML tagged value is great solution for me!

Thanks.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13226
  • Karma: +550/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Read only property and property constraints
« Reply #7 on: February 26, 2013, 09:51:25 pm »
Yes sorry you are right, there is indeed such an attribute.

I was just thinking, could it be that EA has translated this to the checkbox "Const"?

To be sure I checked the xmi file and bingo:
Code: [Select]
<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_4883F552_015D_4b69_91D0_C6151A60078F" name="ValidFromConst" visibility="private" isStatic="false" [highlight]isReadOnly="true"[/highlight]
Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13226
  • Karma: +550/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Read only property and property constraints
« Reply #8 on: February 26, 2013, 09:53:13 pm »
And the great thing about it is that EA displays the required {readonly} constraint as a result as well.

Geert

sovetnikov

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Read only property and property constraints
« Reply #9 on: February 26, 2013, 10:24:44 pm »
Great news!
It works.
I did not notice "Const" checkbox before :)