Getting last modifier of process template
Morten Madsen (305●32●50)
| asked Oct 25 '12, 8:08 a.m.
edited Oct 26 '12, 2:17 a.m. by David Olsen (523●7)
Hi, I'm creating a tool to manage the currently deployed process templates using the RTC Java API.
I've gotten almost everything to work, but I can't figure out how to retrieve the "modified()" and "modifiedBy()" of the *current* process template of a project. I'm using the same alorithm as in this message: https://jazz.net/forum/questions/81391/how-do-i-find-out-who-has-created-andor-modified-an-iteration-in-the-project-configuration But if you do: project.getProcessDefinition(); you get a pointer to the *original* process template and not the active one. You can get the current process xml by using: project.getProcessData().get("com.ibm.team.internal.process.compiled.xml") But this will only get you the IContent. Any ideas? |
Accepted answer
Jared Burns (4.5k●2●9)
| answered Oct 31 '12, 5:13 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
What you're asking to do is basically the same thing that RTC currently does to compute the history of the process specification for the Eclipse client. It works like this:
1. We walk the predecessor states of the project area backward, starting from the current. 2. As we go, we note the content ID of the IContent for the process specification (it sounds like you already know how to get to this). 3. Whenever we detect a change in the content ID between two states, we know the specification was changed. So something like this: PA stateID - spec contentID _aaaaaaa - abc _bbbbbbb - abc <--- the spec changed in state _bbbbbbb _cccccccc - def _ddddddd - def _eeeeeee - def <--- the spec changed in state _eeeeeee _fffffffffffffff - ghi _ggggggg - ghi Hope that helps. Morten Madsen selected this answer as the correct answer
Comments I agree with what Jared said and will add that to get the process specification of a project area you need to make a call like this.
IContent content =(IContent)projectArea.getProcessData().get(ProcessContentKeys.PROCESS_SPECIFICATION_KEY);
Morten Madsen
commented Oct 31 '12, 5:45 p.m.
Ah, sounds great!! :-). Will try that tomorrow and write feedback here!!
Morten Madsen
commented Nov 01 '12, 4:25 a.m.
Ah, I think I found what I'm looking for.
|
One other answer
Hi, I ended up doing like this:
public IProjectArea fetchLatestProcessModifiedState(IProjectAreaHandle handle) throws TeamRepositoryException { List<IProjectArea> states = repo.itemManager().fetchAllStateHandles((IAuditableHandle) handle, monitor); states = repo.itemManager().fetchCompleteStates(states, monitor); IProjectArea latest = null; UUID latestContentId = null; for (IProjectArea p : states) { IContent content = (IContent) p.getProcessData().get(ProcessContentKeys.PROCESS_SPECIFICATION_KEY); if (latest == null) { latest = p; latestContentId = content.getContentId(); } else if (latest.modified().before(p.modified()) && !content.getContentId().equals(latestContentId)) { latest = p; latestContentId = content.getContentId(); } else if (latest.modified().after(p.modified()) && content.getContentId().equals(latestContentId)) { latest = p; latestContentId = content.getContentId(); } } return latest; }/Cheers :-) |
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.
Comments
When you say the current process template are you looking to find the most recent state of the process template that was used to create a project area, even if that is newer than the version which was used to create the project area? You are correct in that getting the process xml is not going to help you discover anything about the process template.
Hi, thanks for your answer.
I'm trying to access the information about who last edited the process for the project. This history is normally accessible by going to "Process source" -> right click -> history.
Do you know how to access this information using the API?
Yes, I tried what you are suggesting, and then I actually get the information I'm looking for, but for the Process Template of which the project was originally initialized.
Do you know how to fetch the same information, but from the "active" process xml in the project?
Please... anyone?
I'll see if I can come up with a working code snippet that I can paste as an answer.
You are awesome :-D.