Get full path name for IVersionableHandle
Assume I have an IVersionableHandle
<b:ab332a6966>
and
</b:ab332a6966>
its associated IConfiguration context: what's when best way to determine the path name of the referenced IVersionable?
I'm currently walking the tree with getParent (see code below) but I'm wondering if there's a better way.
private String getCanonicalName (IVersionableHandle versionable, final IConfiguration context) throws TeamRepositoryException {
final Deque<String> path = new LinkedList<String> ();
while (versionable != null) {
final IVersionable currentItem = context.fetchCompleteItem (versionable, getMonitor ());
final String name = currentItem.getName ();
if (name.length () > 0)
path.push (name);
versionable = currentItem.getParent ();
}
final StringBuilder result = new StringBuilder ();
for (final Iterator<String> segment = path.iterator (); segment.hasNext ();) {
result.append (segment.next ());
if (segment.hasNext ())
result.append ('/');
}
return result.toString ();
}
Accepted answer
2 other answers
I'm trying to do the same on a postop delivery server-side plugin.
How can I obtain IConfiguration?
Thanks,
Andrea
_________________
Andrea Gabrielli
Nexen
Business Consultant
I think the IConfiguration#locateAncestors method will give you the path of the versionable.
Awesome, that worked, thanks.
In our present SCM system "ancestor" has an entirely different meaning so I didn't even look at that method; that's what I get for viewing RTC through the lens of what we're already used to...
the example
https://jazz.net/wiki/pub/Main/RTCSDK20_ProcessPreConditionExample/advisor-example.zip
resolved my problem.
Andrea
_________________
Andrea Gabrielli
Nexen
Business Consultant
Hi,
I'm trying to do the same on a postop delivery server-side plugin.
How can I obtain IConfiguration?
Thanks,
Andrea
_________________
Andrea Gabrielli
Nexen
Business Consultant
I think the IConfiguration#locateAncestors method will give you the path of the versionable.
Awesome, that worked, thanks.
In our present SCM system "ancestor" has an entirely different meaning so I didn't even look at that method; that's what I get for viewing RTC through the lens of what we're already used to...