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

Create a stream using JAVA API

Hi,

I have to create a new stream without flows with a new component.
So i began to read the snippet files and i created a new stream but the problem cames when i've tried to creates a configuration for it. Instead to stream.addComponent method, which is deprecated and it still used in the snippet files, i've tried to use addBaselineSet method, more interesting if i want to seed my new stream from another stream configuration or snapshot:

IComp src = wm.createComponent(name,projectArea,null);
IBaselineHandle bh = src.getInitialBaseline();
IBaselineSetHandle intialBaselineSetHandle = (IBaselineSetHandle) IBaselineSet.ITEM_TYPE.createItemHandle(bh.getItemId,null);
stream.addBaselineSet(intialBaselineSetHandle,null);

</pre>

It returns a beautiful classCastException at the fourth line.

Reading in jazz.net, somebody suggested to use that if u are using flows, but we are not using flows.


I have tried in many other ways and i can not change my stream configuration using that addBaselineSet method. I found something similar in this place: jazzForum but it has no answer and i don't find nothing about IWorkSpaceUpdateOperation class in javadoc or jazzForum.

Any suggestion?


Best Regards,

Sergio
 

0 votes


Accepted answer

Permanent link
IBaselineSetHandle refers to a snapshot, which is why you get a ClassCastException when casting the IComponent.

On your stream, you'll want to get the componentOpFactory to create your component operations that you'll apply on your stream:

IComponentOp op = stream.componentOpFactory().addComponent(componentHandle, boolean);
stream.applyComponentOperations(Collections.singletonList(op), monitor);
David Lafreniere selected this answer as the correct answer

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,943
× 79

Question asked: Dec 26 '12, 7:53 a.m.

Question was seen: 6,675 times

Last updated: Oct 05 '17, 11:54 p.m.

Confirmation Cancel Confirm