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

Problem with "setCurrent" and "setDefault"

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();
search2.setExactName(Workspace_name);
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.removeDeliverFlow(workspaceConnection2.getResolvedWorkspace());
flowTable2.addDeliverFlow(workspaceConnection.getResolvedWorkspace(), null, null, Collections.singletonList(cmp), cmp.getName().toString());
flowTable2.setComponentScopes(workspaceConnection.getResolvedWorkspace(), Collections.singletonList(cmp));

List<IFlowEntry> entries = flowTable2.deliverTargets();
flowTable2.setCurrent(entries.get(0));
flowTable2.setDefault(entries.get(0));

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

1

0 votes


Accepted answer

Permanent link
Solution:
......................
......................
List<IFlowEntry> entries = flowTable2.deliverTargets();
List<IFlowEntry> entries = flowTable2.acceptFlows();
......................
......................

:-)
Ralph Schoon selected this answer as the correct answer

1 vote

Comments

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()); 
flowTable.setCurrent(newnode);
flowTable.setDefault(newnode);
wc.setFlowTable(flowTable, monitor);

I found :D 


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


2 other answers

Permanent link
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)

0 votes


Permanent link
 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 com.ibm.team.scm.client.tests.tools.samples.SampleChangeSets.SampleChangeSets(ITeamRepository, 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);

0 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
× 10,938
× 1,202

Question asked: Oct 03 '11, 11:03 a.m.

Question was seen: 7,019 times

Last updated: Sep 02 '16, 4:42 a.m.

Confirmation Cancel Confirm