It's all about the answers!

Ask a question

Deliver by using plainJava API

Tifa Tan (1835) | asked Nov 26 '14, 8:16 a.m.
The code as follow, I've check in, but an exception throw when program call the last line code: These change sets are not outgoing and therefore cannot be delivered.
My Code:
IChangeSet changeSetToDeliver = null;
   List<IChangeSetHandle> activeChangeSets = workspaceConnection.activeChangeSets(comp);
   System.out.println("Active ChangeSets: " + activeChangeSets.size());
   for (IChangeSetHandle changeSetHandle : activeChangeSets) {
    if (changeSetHandle instanceof IChangeSet) {

     changeSetToDeliver = (IChangeSet) changeSetHandle;
   IChangeSetHandle ics = workspaceConnection.getCurrentChangeSet(comp);
   System.out.println("IChangeSetHandle:" + ics);//Here output is 0
   // deliver the code
   IChangeHistorySyncReport sync = workspaceConnection.compareTo(workspaceConnection, WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY, Collections.EMPTY_LIST, null);//The 3rd parameter could be used to exclude components on the workspace from the compare operation
   List list = sync.outgoingChangeSets(comp);
   System.out.println("Out going change sets size:" + list.size()); //Here output is 0
   workspaceConnection.deliver(workspaceConnection, sync, workspaceConnection.getBaselineSets(null), Arrays.asList(new IChangeSet[]{changeSetToDeliver}), null);

Is there any one can help for this issue? how should I make the change set to out going chengeset ?
And I know the last line code should be:
workspaceConnection.deliver(workspaceConnection, sync, workspaceConnection.getBaselineSets(null), sync.outgoingChangeSets(comp), null);
But as you can see the out going size is 0 ,but the change set above I get it, which is not 0.

2 answers

permanent link
Ralph Schoon (63.3k33646) | answered Nov 26 '14, 9:57 a.m.
Please see: and the related posts.

The error indicates that the change sets are not going out. Maybe there is no flow target set. Maybe they are incoming.

permanent link
Evan Hughes (2.4k1318) | answered Nov 26 '14, 10:27 a.m.
You are comparing the workspace to itself (see workspaceConnection.compareTo(workspaceConnection, ...) then telling the workspace to deliver the change sets to itself (see workspaceConnection.deliver(workspaceConnection, ...).

You may be able to accomplish what you want by using the command line interface. It would allow you to avoid these mechanical/syntactic problems and concentrate on flowing your changes.

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.