It's all about the answers!

Ask a question

SDK Jazz - Getting files and folder in a Baseline


Lorena Cortés (2654) | asked Jun 22 '12, 9:46 a.m.
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

One answer



permanent link
Andrew Niefer (7135) | answered Jun 22 '12, 11:08 a.m.
JAZZ DEVELOPER
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>

Your answer


Register or 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.