Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

SDK Jazz - Getting files and folder in a Baseline

Hello.

I need get a list of folders and files in a baseline.

Currently I have the following code to get all the folders in a component inside a stream, but this code gives to me all the content of the component (every files delivered). I only want the files that were in a baseline.

I'm sorry for my english....

=================================CODE==========================
for (Iterator<IComponentHandle> a = componentes.iterator(); a
.hasNext();) {

IComponentHandle comphandle = (IComponentHandle) a
.next();
IComponent component = (IComponent) itemManager
.fetchCompleteItem(comphandle,
IItemManager.DEFAULT, monitor);
String idcomponente = component.getItemId().toString();
String nomcomponente = component.getName();

/**
* Se encuentra el baseline en que el componente esta en
* el stream
*/
IBaseline baseline = jts.obtenerBaseline(repo,
itemManager, wm, streamConnection, comphandle,
monitor);
String nombaseline = baseline.getName();
String fechabaseline = baseline.getCreationDate()
.toString();


ic = (IConfiguration) streamConnection
.configuration(comphandle);
root = ic.rootFolderHandle(monitor);

List<IFolderHandle> proyectos = comp
.encuentraProyectos(ic, root, monitor);

for (IFolderHandle iFolderHandle : proyectos) {
// Here I get the files
}
}



public List<IFolderHandle> encuentraProyectos(IConfiguration ic,
IFolderHandle root, IProgressMonitor monitor) throws IOException,
Exception {

UtilidadesJazzRepository jts = new UtilidadesJazzRepository();
root = ic.rootFolderHandle(monitor);

List<IFolderHandle> proy = jts.obtenerCarpetasEnDirectorio(root, ic,
monitor);

return proy;
}
public List<IFolderHandle> obtenerCarpetasEnDirectorio(IFolderHandle root,IConfiguration iconfig,IProgressMonitor monitor) 
    throws TeamRepositoryException, IOException {
         
    List<IFolderHandle> Listado = new ArrayList<IFolderHandle>();
        Map childEntries = iconfig.childEntries(root,monitor); 
   
   Iterator it = childEntries.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry pairs = (Map.Entry)it.next();
        
            IVersionableHandle nextVersionable = (IVersionableHandle)pairs.getValue(); 
            if (nextVersionable instanceof IFolderHandle){
            Listado.add((IFolderHandle)iconfig.fetchCompleteItem(nextVersionable,monitor));
            }                                                
        } 
        return Listado;
    }       
========================

Thanks

0 votes



One answer

Permanent link
I believe you need to get the IConfiguration associated with the baseline instead of the stream.

Maybe something like this:
<pre>
//IWorkspaceManager#getBaselineConnection(IBaseline, IProgressMonitor)
IBaselineConnection connection = workspaceManager.getBaselineConnection(baselineHandle, monitor);
ic = connection.configuration();
</pre>

2 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jun 22 '12, 9:46 a.m.

Question was seen: 4,426 times

Last updated: Jun 22 '12, 11:08 a.m.

Confirmation Cancel Confirm