How does RTC determine literal id for a custom enumeration attribute?
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
Accepted answer
So if it is designed this way and you want sequential literals, add the enumerations in the web GUI, not the Eclipse GUI.
2 other answers
- 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)
-
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.
- Change existing work items with the old enumeration values to the corresponding new value
- Remove the old enumeration literals.
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.