how to retrieve the name of a baseline set
how can i get the names of all baseline sets available in repository using a JAVA API ...I have with me baseline set handles which give me the UUID of the baseline sets ..is there any way to get name from the UUID using any JAVA API
i am using these APIs to find the baselines from a stream ..
1)List <IBaselineSetHandle> blset = workspaceConnection.getBaselineSets(null);
2)BaselineSetSearchCriteria bssearch = (BaselineSetSearchCriteria) IBaselineSetSearchCriteria.FACTORY.newInstance();
bssearch.setOwnerWorkspaceOptional(handle);
List <IBaselineSet> blsets2 = SCMPlatform.getWorkspaceManager(teamRepository).findBaselineSets(bssearch, Integer.MAX_VALUE, null);
from the above code , i get the list having the baselinesets
i used this method to lift an element of the list :-
while(IBaselineSetHandle bsh : blset2){}
now from bsh i get the UUID of each set ...but not hte name of the baselineset .. is there any way to find the name of the baselinesets
i am using these APIs to find the baselines from a stream ..
1)List <IBaselineSetHandle> blset = workspaceConnection.getBaselineSets(null);
2)BaselineSetSearchCriteria bssearch = (BaselineSetSearchCriteria) IBaselineSetSearchCriteria.FACTORY.newInstance();
bssearch.setOwnerWorkspaceOptional(handle);
List <IBaselineSet> blsets2 = SCMPlatform.getWorkspaceManager(teamRepository).findBaselineSets(bssearch, Integer.MAX_VALUE, null);
from the above code , i get the list having the baselinesets
i used this method to lift an element of the list :-
while(IBaselineSetHandle bsh : blset2){}
now from bsh i get the UUID of each set ...but not hte name of the baselineset .. is there any way to find the name of the baselinesets
5 answers
String list = "";
// Create search Criteria and get Baselines
IBaselineSearchCriteria crit1 = IBaselineSearchCriteria.FACTORY.newInstance();
crit1.setComponentRequired(component);
List baselines = wm.findBaselines(crit1,Integer.MAX_VALUE,MONITOR);
for (Iterator b = baselines.iterator(); b.hasNext();) {
IBaselineHandle baseline = (IBaselineHandle) b.next();
IBaseline baseline_comp = (IBaseline)repo.itemManager().fetchCompleteItem(baseline, IItemManager.DEFAULT, MONITOR);
if (baseline_comp.getName().equals("")) {
list += "No Baseline name\n";
} else {
list += baseline_comp.getName() + "\n";
}
}
// Create search Criteria and get Baselines
IBaselineSearchCriteria crit1 = IBaselineSearchCriteria.FACTORY.newInstance();
crit1.setComponentRequired(component);
List baselines = wm.findBaselines(crit1,Integer.MAX_VALUE,MONITOR);
for (Iterator b = baselines.iterator(); b.hasNext();) {
IBaselineHandle baseline = (IBaselineHandle) b.next();
IBaseline baseline_comp = (IBaseline)repo.itemManager().fetchCompleteItem(baseline, IItemManager.DEFAULT, MONITOR);
if (baseline_comp.getName().equals("")) {
list += "No Baseline name\n";
} else {
list += baseline_comp.getName() + "\n";
}
}
String list = "";
// Create search Criteria and get Baselines
IBaselineSearchCriteria crit1 = IBaselineSearchCriteria.FACTORY.newInstance();
crit1.setComponentRequired(component);
List baselines = wm.findBaselines(crit1,Integer.MAX_VALUE,MONITOR);
for (Iterator b = baselines.iterator(); b.hasNext();) {
IBaselineHandle baseline = (IBaselineHandle) b.next();
IBaseline baseline_comp = (IBaseline)repo.itemManager().fetchCompleteItem(baseline, IItemManager.DEFAULT, MONITOR);
if (baseline_comp.getName().equals("")) {
list += "No Baseline name\n";
} else {
list += baseline_comp.getName() + "\n";
}
}
Your code give me the name of the baselines of a particular component ..but what i want is the name of a baseline set or a snapshot in a particular stream ........ i am able to get the handle but not the name of the baseline set/snapshot
// Get snapshot stream
crit1.setExactName(tmp);
crit1.setExactOwnerName(tmp);
crit1.setKind(IWorkspaceSearchCriteria.STREAMS);
List tmp_list = wm.findWorkspaces(crit1, 1, MONITOR);
if (tmp_list.size() == 0) {
throw new TeamRepositoryException("Snapshot Stream " + tmp + " does not exists");
}
// Get snapshot stream connection
Iterator it = tmp_list.iterator();
IWorkspaceHandle snapshot_hd = (IWorkspaceHandle) it.next();
IWorkspaceConnection wc = wm.getWorkspaceConnection(snapshot_hd, null);
// Get snap shot
IBaselineSetSearchCriteria crit2 = IBaselineSetSearchCriteria.FACTORY.newInstance();
crit2.setOwnerWorkspaceOptional(snapshot_hd);
crit2.setExactName(tmp);
tmp_list = wm.findBaselineSets(crit2,1,MONITOR);
if (tmp_list.size() == 0) {
throw new TeamRepositoryException("Snapshot " + tmp + " does not exists");
}
// Get baselines
it = tmp_list.iterator();
IBaselineSetHandle baselineSetHandle = (IBaselineSetHandle) it.next();
IBaselineSet baselineSet = (IBaselineSet)repo.itemManager().fetchCompleteItem(baselineSetHandle, IItemManager.DEFAULT, MONITOR);
// Get Snap shot baselines
List baselineHandles = baselineSet.getBaselines();
List baseline_comp = repo.itemManager().fetchCompleteItems(baselineHandles, IItemManager.DEFAULT, MONITOR);
// Get baseline names
for (Iterator b = baseline_comp.iterator(); b.hasNext();) {
IBaselineHandle baseline = (IBaselineHandle) b.next();
IBaseline baseline_tmp = (IBaseline)repo.itemManager().fetchCompleteItem(baseline, IItemManager.DEFAULT, MONITOR);
IBaselineConnection baselineConnection = wm.getBaselineConnection(baseline,MONITOR);
IComponentHandle component = baseline_tmp.getComponent();
list += baseline_tmp.getName() + "\n";
}
crit1.setExactName(tmp);
crit1.setExactOwnerName(tmp);
crit1.setKind(IWorkspaceSearchCriteria.STREAMS);
List tmp_list = wm.findWorkspaces(crit1, 1, MONITOR);
if (tmp_list.size() == 0) {
throw new TeamRepositoryException("Snapshot Stream " + tmp + " does not exists");
}
// Get snapshot stream connection
Iterator it = tmp_list.iterator();
IWorkspaceHandle snapshot_hd = (IWorkspaceHandle) it.next();
IWorkspaceConnection wc = wm.getWorkspaceConnection(snapshot_hd, null);
// Get snap shot
IBaselineSetSearchCriteria crit2 = IBaselineSetSearchCriteria.FACTORY.newInstance();
crit2.setOwnerWorkspaceOptional(snapshot_hd);
crit2.setExactName(tmp);
tmp_list = wm.findBaselineSets(crit2,1,MONITOR);
if (tmp_list.size() == 0) {
throw new TeamRepositoryException("Snapshot " + tmp + " does not exists");
}
// Get baselines
it = tmp_list.iterator();
IBaselineSetHandle baselineSetHandle = (IBaselineSetHandle) it.next();
IBaselineSet baselineSet = (IBaselineSet)repo.itemManager().fetchCompleteItem(baselineSetHandle, IItemManager.DEFAULT, MONITOR);
// Get Snap shot baselines
List baselineHandles = baselineSet.getBaselines();
List baseline_comp = repo.itemManager().fetchCompleteItems(baselineHandles, IItemManager.DEFAULT, MONITOR);
// Get baseline names
for (Iterator b = baseline_comp.iterator(); b.hasNext();) {
IBaselineHandle baseline = (IBaselineHandle) b.next();
IBaseline baseline_tmp = (IBaseline)repo.itemManager().fetchCompleteItem(baseline, IItemManager.DEFAULT, MONITOR);
IBaselineConnection baselineConnection = wm.getBaselineConnection(baseline,MONITOR);
IComponentHandle component = baseline_tmp.getComponent();
list += baseline_tmp.getName() + "\n";
}
// Get snapshot stream
crit1.setExactName(tmp);
crit1.setExactOwnerName(tmp);
crit1.setKind(IWorkspaceSearchCriteria.STREAMS);
List tmp_list = wm.findWorkspaces(crit1, 1, MONITOR);
if (tmp_list.size() == 0) {
throw new TeamRepositoryException("Snapshot Stream " + tmp + " does not exists");
}
// Get snapshot stream connection
Iterator it = tmp_list.iterator();
IWorkspaceHandle snapshot_hd = (IWorkspaceHandle) it.next();
IWorkspaceConnection wc = wm.getWorkspaceConnection(snapshot_hd, null);
// Get snap shot
IBaselineSetSearchCriteria crit2 = IBaselineSetSearchCriteria.FACTORY.newInstance();
crit2.setOwnerWorkspaceOptional(snapshot_hd);
crit2.setExactName(tmp);
tmp_list = wm.findBaselineSets(crit2,1,MONITOR);
if (tmp_list.size() == 0) {
throw new TeamRepositoryException("Snapshot " + tmp + " does not exists");
}
// Get baselines
it = tmp_list.iterator();
IBaselineSetHandle baselineSetHandle = (IBaselineSetHandle) it.next();
IBaselineSet baselineSet = (IBaselineSet)repo.itemManager().fetchCompleteItem(baselineSetHandle, IItemManager.DEFAULT, MONITOR);
// Get Snap shot baselines
List baselineHandles = baselineSet.getBaselines();
List baseline_comp = repo.itemManager().fetchCompleteItems(baselineHandles, IItemManager.DEFAULT, MONITOR);
// Get baseline names
for (Iterator b = baseline_comp.iterator(); b.hasNext();) {
IBaselineHandle baseline = (IBaselineHandle) b.next();
IBaseline baseline_tmp = (IBaseline)repo.itemManager().fetchCompleteItem(baseline, IItemManager.DEFAULT, MONITOR);
IBaselineConnection baselineConnection = wm.getBaselineConnection(baseline,MONITOR);
IComponentHandle component = baseline_tmp.getComponent();
list += baseline_tmp.getName() + "\n";
}
hey thanks mcraek ..tht wrks perfect ...i have 1 more query can u just answer tht ..
i am creating a workspace from the snapshot ..with the same name ->
..after creating the workspace ....i want to extract the contents of the workspace on to the local machine ..i hve been doing this using a scm command ->