Getting last modifier of process template
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:
you get a pointer to the *original* process template and not the active one.
You can get the current process xml by using:
But this will only get you the IContent. Any ideas?
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
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.
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.
Comments
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 :-)
Comments
Chris Goldthorpe
JAZZ DEVELOPER Oct 26 '12, 2:04 p.m.1 vote
Morten Madsen
Oct 28 '12, 12:35 p.m.Morten Madsen
Oct 31 '12, 2:39 p.m.Chris Goldthorpe
JAZZ DEVELOPER Oct 31 '12, 4:52 p.m.1 vote
Morten Madsen
Oct 31 '12, 5:41 p.m.