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

How Can I See Which Attributes are Changing in a Server-Side Pre-Condition?

In our process, we disallow changes to work items once they have entered a "closed" state. In addition, only certain power users are allowed to re-open closed work items. One of our users has requested that we provide a means for them to add comments to closed work items, but continue to restrict all other changes.

We think the best way to support this would be to create a server-side pre-condition operation behavior that checks on work item save to see if the only change is an added comment. I'm unsure how to do this. I think I know how to check whether a specific attribute has changed by comparing the old state and the new state, but I have two issues with that approach:
1) I'm paranoid that it only works on follow-up actions, not pre-conditions.
2) I can't explicitly validate a list of work item attributes because that would make the code really complex and hard to maintain.

Is there a way to see what exactly changed in a work item without explicitly checking a specific attribute? Ideally, I'd like to get an enumerated list of changes.

0 votes


Accepted answer

Permanent link
1. works for pre-conditions
2. far as I know, there is no list of just changes

but you could make a list pretty easily..
from the oldState get the list of attributes
WorkItemServer.findAttributes(projectArea, monitor) - have to load access to the IWorkItemServer service
then loop thru the old-state workitem (hasAttribute == true)
  compare attribute old = new
     if not equal, add to a list collection
     if handles compare UUIDs for equal

once done, then process the list
Nate Decker selected this answer as the correct answer

0 votes

Comments

Thanks. That is helpful. I'll try to head down that route and if I'm successful, I'll come back and mark this answer as accepted.

and u can see how to handle different attributes here in my utility that dumps the attributes of workitems found in a query result list (accepted answer)
https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes

function
static void printAttributes(IWorkItem workItem,

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
× 10,935
× 411

Question asked: Jan 05 '15, 4:45 p.m.

Question was seen: 3,722 times

Last updated: Jan 06 '15, 4:44 p.m.

Confirmation Cancel Confirm