Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How does RTC determine literal id for a custom enumeration attribute?

RTC 4.0.5 used.

The user add enumeration attribute with some values and the configuration source will show

<enumeration attributeTypeId="ErrorCategoryEnum" name="Item">
   <literal default="true" id="ErrorCategoryEnum.literal.l2" name="item1"/>
   <literal id="ErrorCategoryEnum.literal.l4" name="item2"/>
   <literal id="ErrorCategoryEnum.literal.l6" name="item3"/>
   <literal id="ErrorCategoryEnum.literal.l8" name="item4"/>

In another project, when adding similar Item enumeration attribute, it will show
<enumeration attributeTypeId="ErrorCategoryEnum" name="Item">
   <literal default="true" id="ErrorCategoryEnum.literal.l1" name="item1"/>
   <literal id="ErrorCategoryEnum.literal.l2" name="item2"/>
   <literal id="ErrorCategoryEnum.literal.l3" name="item3"/>
   <literal id="ErrorCategoryEnum.literal.l4" name="item4"/>

Since there is an external program to check with literal id, they want to make them consistent. There are manual way to change literal id in the configuration source etc. The question here is:

How does RTC determine the literal id for the custom enumeration attribute as it does not make sense it assign
sequential id in one PA but even id in another one? Thanks


0 votes


Accepted answer

Permanent link
For what it is worth, I did a quick test and found that enumerations added in the web GUI had the sequential literals, while in the Eclipse client even-numbered. Can't really say why the two clients behave differently. I'm using RTC 4.0.6.
So if it is designed this way and you want sequential literals, add the enumerations in the web GUI, not the Eclipse GUI.
Don Yang selected this answer as the correct answer

1 vote

Comments

Thanks Donald for this info. I now know we need to find out why Eclipse and Web client have different behavior(as usual).


2 other answers

Permanent link
I have only ever seen the 2 step assignment
I2, I4, I6 ...

if you want specific IDs, I edit the source after creation but BEFORE saving to set the values as I want them.

I always recommend to use a class notation for the ID string

id=com.company.enum.value.name  name=name


1 vote


Permanent link
The ID value can be changed, but any work items that are using that literal value will actually show the ID in the associated attribute, not the name.    If you really want to go that route I suggest the following

  1. Change the name on the enumeration literals whose ID you are going to "retire" to a value with an eye-catching  string (e.g. DoNotUse+original name)
  2. In RTC Eclipse: Add new literals with the name you want using the UI, then before saving the configuration switch to the Configuration source and change the ID value to the one you want to end up with, save the project configuration.
  3. Change existing work items with the old enumeration values to the corresponding new value
  4. Remove the old enumeration literals.


1 vote

Comments

step 3 is the hard part.. and note that reports will be messed up for a while. 

Thanks Kevin for the details.
I did see the even id in my test here and manually modify the id to the expected ones. For the existing workitems, I have to use query to find and fix all of them and then delete the old ones in the source. These are basically similar approach as what you and Sam suggested.

I do notice that some enumeration attributes such as severity etc have sequential ids by default. So post this one and try to find out how RTC does to allocate the literal id for custom enum attributes as I have users who see the sequential ids in one place but even id in another one and wants to know why.

I think the built in enums are sequential.  all new are even numbered

one interesting info to share here is that if using [Duplicate] instead of [Add] to create a new enum, then literal ids will be sequential, not even numbered.

Interesting indeed. Thanks for that info. 

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019

Question asked: May 23 '14, 8:35 a.m.

Question was seen: 6,649 times

Last updated: May 28 '14, 9:41 p.m.

Confirmation Cancel Confirm