Getting files of a Baselin
9 answers
Hi Lorena.
To answer your original question about getting the files in a particular baseline, here is some sample code based on the Jazz Java client API. Given a baseline handle, this code prints the files in the baseline, including file type, uuid, and path.
Is this what you had in mind?
-Matt
==============================
/**
* Print the specified baseline
*/
private static void printBaseline(IBaselineHandle handle, IProgressMonitor monitor) throws TeamRepositoryException {
IBaselineConnection blConn = SCMPlatform.getWorkspaceManager(repo).getBaselineConnection(handle, monitor);
IConfiguration config = blConn.changeHistory().configuration();
IFolderHandle rootFolder = config.rootFolderHandle(monitor);
printFolder(blConn.getName(), rootFolder, config, monitor);
}
/**
* Recursively print the specified repository folder and its file contents.
* Print the path and UUID of each entry.
*/
@SuppressWarnings("unchecked")
private static void printFolder(String path, IFolderHandle folder, IConfiguration config, IProgressMonitor monitor) throws TeamRepositoryException {
printEntry(path, folder);
Map<String,IVersionableHandle> kids = config.childEntries(folder, monitor);
for (Entry<String, IVersionableHandle> folderEntry : kids.entrySet()) {
path = path + "/" + folderEntry.getKey();
IVersionableHandle child = folderEntry.getValue();
if (child instanceof IFolderHandle) {
printFolder(path, (IFolderHandle) child, config, monitor);
} else {
printEntry(path, child);
}
}
}
/**
* Print a single repository file's type, UUID, and path.
*/
private static void printEntry(String path, IVersionableHandle vh) throws TeamRepositoryException {
if (firstTimeThrough) {
System.out.format("File Type,UUID,Path\n");
firstTimeThrough = false;
}
System.out.format("%s,%s,%s\n", vh.getItemType().getName(), vh.getStateId().getUuidValue(), path);
}
Thanks Ralph. Can operation advisor provide an equivalent of what i am trying to do?
My req. is: Based on project area, i want a drop-down of streams available,
based on selected stream,, i want a drop-down of baselines available
Its kind of dependent enumeration concept - but i need to automate the values in the enumeration list. Is this possible using operation advisor plugin?
Hi,
i think you want to create an AttributeValueProvider (see https://jazz.net/wiki/bin/view/Main/AttributeValueProviders ) and possibly an attribute presentation (see https://jazz.net/wiki/bin/view/Main/ContributingAttributePresentationsV2 ) to allows selecting the values.
An operation advisor would be required to make sure some precondition is met.
i think you want to create an AttributeValueProvider (see https://jazz.net/wiki/bin/view/Main/AttributeValueProviders ) and possibly an attribute presentation (see https://jazz.net/wiki/bin/view/Main/ContributingAttributePresentationsV2 ) to allows selecting the values.
An operation advisor would be required to make sure some precondition is met.
Having said that and even if I have looked into extending the tools, I rather try to avoid complex extensions like the ones mentioned above if at all possible. Keep it simple.
If you make work item usage too complex all users will start to hate it and you loose time etc. We have seen excessive customizations in the past with other tools and the ill effect it has.
There also seems a universal law that more stuff is added to work items, but it is almost never removed, even if it is not necessary anymore. 8-D
If you make work item usage too complex all users will start to hate it and you loose time etc. We have seen excessive customizations in the past with other tools and the ill effect it has.
There also seems a universal law that more stuff is added to work items, but it is almost never removed, even if it is not necessary anymore. 8-D
Valli,
please follow the links in https://jazz.net/forum/questions/79881/getting-files-of-a-baselin/79959 .
Since I haven't implemented anything like that myself, I can't provide more. The only think that I am pretty sure of is that you can't access that kind of data in a JavaScript based attribute customization.
please follow the links in https://jazz.net/forum/questions/79881/getting-files-of-a-baselin/79959 .
Since I haven't implemented anything like that myself, I can't provide more. The only think that I am pretty sure of is that you can't access that kind of data in a JavaScript based attribute customization.