Jazz Library Dynamically changing an attribute to ReadOnly in Rational Team Concert
Author name

Dynamically changing an attribute to ReadOnly in Rational Team Concert

When an attribute is set to ReadOnly, it is read only across all the states of the work item.

If you have a requirement that the attribute has to be read only in specific states, there is no out of the box feature to make this happen. So, in summary an attribute cannot change its read only nature dynamically.

However, when you use an attribute in a work item, you have to go through its presentation element, and presentation elements have the support for Hidden in states apart from ability to be ReadOnly or Editable. This gives you a way for implementing the dynamic nature for these attributes.

To do this, you need the following:

  • Instead of one presentation element for the attribute, you need one which has ReadOnly set to TRUE and a second one mapped to the same attribute but has its ReadOnly property set to FALSE.
  • Hiding and un-hiding these presentations in different states gives the attribute its dynamic ReadOnly nature.

For more details on how its actually done using the Eclipse client, you can refer to the below sample scenario and the steps you can follow.

Sample Scenario:

Lets say the attribute is named “Owner” and the work flow you have is to allow ownership change in the beginning and once the work item is completed, disallowing ownership change. This requires “Owner” to be editable in the “New” and “InProgress” states and should be ReadOnly once its marked “Completed”. The table below summarizes the dynamic nature of “Owner” attribute across different states:

 
New
In Progress
Completed
Owner editable editable read only

Steps:

  • ReadOnly Presentation for Owner
    • Create a new Presentation “roOwner” and configure it to the attribute “Owner”
    • Mark it ReadOnly
    • Select New and InProgress from Hide in Workflow States

    Sample screen capture

  • Editable Presentation for Owner
    • Create another Presentation “rwOwner” for “Owner” again
    • DO NOT mark it ReadOnly
    • Select Completed from Hide in Workflow States

    Sample screen capture

The editor will now have two presentations for the same attribute as shown below.

Sample screen capture


Now when the work item is created, presentation “rwOwner” shows up during “New” and “InProgress” states and allows you to modify the “Owner” attribute. The “roOwner” presentation is hidden and does not show its effect.

When the work item enters the “Completed” state, “roOwner” goes visible and shows its effect. This together with “rwOwner” getting hidden, gives the ReadOnly nature to the “Owner” attribute. Hence the dynamic change in nature of the “Owner” attribute.

The table below summarizes the different presenations used for the attribute:

 
New
In Progress
Completed
Owner rwOwner rwOwner roOwner

Continuing with this, if in a later state there is a need to write, again a switch in the hidden states of these presentation elements will get the job done.


Note:

  1. Once an attribute is configured with a Presentation, it does not show up again until the option Show already configured attributes is selected. Sample screen capture
  2. A page or workitem refresh might be required sometimes to see the changes.

About the author

Dinesh Kumar B is a IBM Certified Solution Designer working as a member of Technical Leadership Team in Rational Client Support, Bangalore. He is a SWAT for Rational Rhapsody. He has experience in Rational Team Concert customizations. He can be contacted at bdineshkumar@in.ibm.com.

Thu, 05 Apr 2012