How Do I Get the "Before" State of the Project Area in an Operation Behavior Triggering on ProjectAreaSave?
I am writing a precondition that triggers off the operation id "com.ibm.team.process.server.saveProjectArea".
I am trying to create a precondition that will disallow changes to a project area's configuration if they qualify as a certain type of change. Basically, it's an attempt to get more granular control over a project's configuration than simply relying on the "final" checkbox.
I've written a prototype for the precondition and it looks like the pieces are there to make this work. However, I've run into a problem. In order to verify that the user hasn't changed something that they shouldn't, I need to be able to see what has changed with the save operation. I am able to see the current Process Configuration Source XML of the project area, but can't seem to figure out how to see what the user is trying to change.
When the operation fires, I cast the operation as a "ProjectAreaSaveOperation" object. This object has a function called "getItems" that has the following explanatory text: "Returns the items that this operation will save. These are the new item states." This sounded promising, particularly "these are the new item states". I started iterating over these saveItems and looking at each of them to see if one of them would give me a view into the "new" state of the ProjectArea XML. Unfortunately this appears to be a dead end (or I'm just looking at the wrong thing).
Can anyone advise me on how to do this?
One answer
I think I found the solution.
I cast the saveItem.getWorkingCopy() object to an IProcessArea object. I then used the getProcessData function of the IProcessArea object. This map was the NEW process configuration source XML.
So it looks like I now have a before-and-after shot of the process configuration XML.