Added tagged values to attributes based on the class' tagged values
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
This EAL code will add the tagged value "PrimaryKey" to the attribute on the class that matches the class' primary key (which | This EAL code will add the tagged value "PrimaryKey" to the attribute on the class that matches the class' primary key (which itself is stored as a tagged value). | ||
TaggedValue.allInstances-> | TaggedValue.allInstances-> | ||
select(tv|tv.Tag='Eco.PrimaryKey')-> | select(tv|tv.Tag='Eco.PrimaryKey')-> | ||
Line 17: | Line 17: | ||
) | ) | ||
) | ) | ||
[[Category:Tagged Values]] | [[Category:Tagged Values]] | ||
[[Category:Advanced]] | |||
[[Category:Advanced]] |
Revision as of 06:05, 7 March 2023
This EAL code will add the tagged value "PrimaryKey" to the attribute on the class that matches the class' primary key (which itself is stored as a tagged value).
TaggedValue.allInstances-> select(tv|tv.Tag='Eco.PrimaryKey')-> collect(tv | tv.ModelElement->safeCast(Class).Feature->filterOnType(Attribute)->select(a|a.TaggedValue->select(atv|(atv.Tag='Eco.ColumnName') and (atv.Value=tv.Value) )->notEmpty)-> collect(pka | if pka.TaggedValue->select(atv| atv.Tag='Eco.ColumnName')->isEmpty then let pktv = TaggedValue.Create in ( pktv.Tag := 'PrimaryKey'; pktv.Value := 'true'; pka.TaggedValue.add(pktv) ); true else false endif ) )
This page was edited 132 days ago on 01/09/2024. What links here