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:
It returns a beautiful classCastException at the fourth line.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>
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
Accepted answer
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:
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);