It's all about the answers!

Ask a question

Problem with "setCurrent" and "setDefault"

Javier Lisbona (5157) | asked Oct 03 '11, 11:03 a.m.
edited May 31 '16, 9:56 p.m. by David Lafreniere (4.3k7)
Hi team,

I have a problem in a FlowTable.
I'm trying to put a default and current target of a target flow table but I can't it.
My code:


//Create workspace
IWorkspaceConnection wsc = workspaceManager.createWorkspace(teamRepository.loggedInContributor(), Workspace_name, Workspace_name, null);

//Add component
List<IComponentOp> ops = new ArrayList<IComponentOp>();
//ops.add(wsc.componentOpFactory().addComponent(auxcomp, false));
ops.add(wsc.componentOpFactory().addComponent(auxcomp, true));
wsc.applyComponentOperations(ops, null);

IWorkspaceSearchCriteria search2 = IWorkspaceSearchCriteria.FACTORY.newInstance();
List<IWorkspaceHandle> handles2 ;
handles2 = workspaceManager.findWorkspaces(search2, Integer.MAX_VALUE, null);
IWorkspace iwspaux2 = null;
for( IWorkspaceHandle aux2:handles2 ){
iwspaux2 = (IWorkspace) teamRepository.itemManager().fetchCompleteItem(aux2,0,null);

IWorkspaceHandle myws = (IWorkspaceHandle) iwspaux2;

IWorkspaceConnection workspaceConnection2 = workspaceManager.getWorkspaceConnection(myws, null);
IFlowTable flowTable2 = workspaceConnection2.getFlowTable().getWorkingCopy();
flowTable2.addDeliverFlow(workspaceConnection.getResolvedWorkspace(), null, null, Collections.singletonList(cmp), cmp.getName().toString());
flowTable2.setComponentScopes(workspaceConnection.getResolvedWorkspace(), Collections.singletonList(cmp));

List<IFlowEntry> entries = flowTable2.deliverTargets();

wsc.setFlowTable(flowTable2, null);


There is no error message but it doesn't work.
Could anyone help me?
Any help would be appreciated.

Thanks in advance!!

BR Javier Lisbona

Accepted answer

permanent link
Javier Lisbona (5157) | answered Oct 04 '11, 12:18 p.m.
List<IFlowEntry> entries = flowTable2.deliverTargets();
List<IFlowEntry> entries = flowTable2.acceptFlows();

Ralph Schoon selected this answer as the correct answer

Hakki Bozkurt commented May 16 '16, 3:23 a.m.

Hi Javier, I dont understant solution...

Here is my code,  what am I missing?

IFlowTable flowTable = wc.getFlowTable().getWorkingCopy();
flowTable.addDeliverFlow(targetStreamConnection.getResolvedWorkspace(), repo.getId(), repo.getRepositoryURI(), null, targetStreamConnection.getDescription());
IFlowEntry newnode = flowTable.getDeliverFlow(targetStreamConnection.getResolvedWorkspace()); 
wc.setFlowTable(flowTable, monitor);

Hakki Bozkurt commented May 16 '16, 4:07 a.m.

I found :D 

wrong -> correct
flowTable.addDeliverFlow -> flowTable.addAcceptFlow

2 other answers

permanent link
Javier Lisbona (5157) | answered Oct 04 '11, 12:15 p.m.
Ok, I know the problem:

"Yes, there is a problem, you are changing the 'deliverFlows', when you
should change the 'acceptFlows'.

The flow table API method names are misleading, and it is possible that
we'll be changing this in the future (partially to sort out this confusion
you're experiencing now). The 'acceptFlows' are for the collaborations.
The 'deliverFlows' are for helping identify component additions/removals
(I believe. Somebody correct me if I'm wrong.) "

Yes, I think so (The flow table API method names are misleading)

permanent link
stefano antoniazzi (168711) | answered Sep 02 '16, 4:42 a.m.
 Somehow it makes sense: even if you see it as a "Flow target" you must establish a connection for both accepting and delivering change sets.

This is used also in, String, boolean)
   workspaceConnection = createUniqueWorkspace(repo);
        workspaceConnection.addComponent(component, false, (IProgressMonitor) null);
        IFlowTable wc = workspaceConnection.getFlowTable().getWorkingCopy();
        wc.addAcceptFlow(masterWorkspace, null, null, Collections.singleton(component), null);
        wc.addDeliverFlow(masterWorkspace, null, null, Collections.singleton(component), null);
        workspaceConnection.setFlowTable(wc, null);

Your answer

Register or to post your answer.