It's all about the answers!

Ask a question

Howto use method setWorkspaceFlows in IScmService

Thorsten Ferres (1367) | asked Dec 10 '14, 4:35 a.m.
I am implementing a service and have to set the deliver flow target of the workspace that is going to be built to a specific target stream to be able to get a reference to this stream again after a successful build using the build result to get the build definition, the build definition to get the workspace that has been built and the workspace to get its deliver flow target to finally compare the workspace to the target stream and release the outgoing change sets from the workspace into the target stream.

I am trying to use the method workspace, IFlowEntry[] acceptFlows, IFlowEntry[] deliverFlows, CurrentFlows currentFlows, IComponentHandle[] components, CurrentFlows[] componentCurrentFlows, ISynchronizationTimes[] syncTimes, IRepositoryProgressMonitorHandle monitor) throws TeamRepositoryException
but I do not really understand what parameters I have to use to make it work. Especially the parameter 'CurrentFlows currentFlows' causes either an ImmutablePropertyException when I try to set the CurrentDeliverFlow of the workspace directly using '((Workspace)workspace).setCurrentDeliverFlow(targetStream), an IllegalArgumentAcception when I am trying to use the working copy of the workspace or an IllegalArgumentAcception with reason 'Specified current deliver flow is not in the list of deliver flows' when I do not try to set the current deliver flow at all in the currentFlows-parameter.

I am also unsure about the 'acceptFlows'-, the 'deliverFlows'- and the 'componentCurrentFlows'-parameters. As explained above, all I need to do is to set the deliver flow target of the workspace to the target stream.

One answer

permanent link
sam detweiler (12.5k6195201) | answered Dec 10 '14, 8:45 a.m.
I have never used that call.. seems pretty challenging..

when up update the flow table of a workspace, you update it directly, and then set the flow table back into the workspace..

from my copy workspace utility

// get the flow table working copy
IFlowTable dest_flowtable = new_destworkspace.getFlowTable().getWorkingCopy();

// add the flow target to the table
dest_flowtable.addAcceptFlow(destacceptStream.getResolvedWorkspace(), destrepo.getId(), destrepo.getRepositoryURI(), null, destacceptStream.getDescription());

// if you need to set current/default
// AFTER you have added to the flow table, you get the handle back out

// get the flow entry from the table for this stream
IFlowEntry newnode = dest_flowtable.getAcceptFlow(destacceptStream.getResolvedWorkspace());

// set current

// save the updated flow table                                                 
new_destworkspace.setFlowTable(dest_flowtable, null);

Thorsten Ferres commented Dec 11 '14, 4:00 a.m.

I am afraid this does not work because you are using an IWorkspaceConnection object which is available in the client API only (i. e. I am trying to change the flow target in a service on the RTC server, so I can only use the Server API and just have an IWorkspace object.

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.