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

How to set components scope in flow target using plain java/ client side api?

 Hi all,

My requirement is I want to scoped only selected components to flow with stream, I know in stream editor already has option for scope component, but I want to do it by code. Please suggest solution

0 votes


Accepted answer

Permanent link
    private void setFlow(IWorkspaceConnection source,
            IWorkspaceConnection dest, Collection<icomponenthandle> components,
            IProgressMonitor monitor) throws TeamRepositoryException {
        System.out.print("Set flow targets and component scope " + source.getName() + " to " + dest.getName() );

        // Get the current flow table
        IFlowTable cflowTable = source.getFlowTable().getWorkingCopy();
        // Set the accept and deliver flow to the target
        cflowTable.addAcceptFlow(dest.getResolvedWorkspace(), dest
                .teamRepository().getId(), dest.teamRepository()
                .getRepositoryURI(), components /* Collections.EMPTY_LIST */,
                "Accept Flow");
        cflowTable.addDeliverFlow(dest.getResolvedWorkspace(), dest
                .teamRepository().getId(), dest.teamRepository()
                .getRepositoryURI(), components /* Collections.EMPTY_LIST */,
                "Deliver Flow");
        // Limit the scope for accept and delivery to the components that are
        // needed
        cflowTable.setComponentScopes(dest.getResolvedWorkspace(), components);
        // We want incoming and outgoing default and current flow
        // Set the incoming flow for current and default
        IFlowEntry acceptEntry = cflowTable.getAcceptFlow(dest
                .getResolvedWorkspace());
        cflowTable.setCurrent(acceptEntry);
        cflowTable.setDefault(acceptEntry);
        // Set the incoming flow for current and default
        IFlowEntry deliverEntry = cflowTable.getDeliverFlow(dest
                .getResolvedWorkspace());
        cflowTable.setCurrent(deliverEntry);
        cflowTable.setDefault(deliverEntry);

        // Set the modified flow table
        source.setFlowTable(cflowTable, monitor);
        System.out.println(" success...");
           }
Ralph Schoon selected this answer as the correct answer

0 votes

Comments

Thanks @Ralph Schoon for your valuable contribution

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

Question asked: Mar 13 '19, 7:12 a.m.

Question was seen: 1,238 times

Last updated: Mar 20 '19, 7:11 a.m.

Confirmation Cancel Confirm