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

How can you create a stream and its component from Api Java or Rest

 I found this post that helps me in part:

But now I would have another need and that is to create one or more Components within the Stream.
I have always found the following method here:
stream.applyComponentOperations (list, monitor);
Where stream is the stream created and list is a list of Components to be created
(IComponentOp op = stream.componentOpFactory (). AddComponent (a, true), but there is also the method:
stream.addComponent (IComponent, boolean, monitor); but this is obsolete.
Finally I ask you the Boolean that is passed to both of you what does it mean? And above all, I haven't had a chance to try it yet, let's say I'm studying
still the best way, is the approach used for Java Api right? But Api Rest don't exist yet? I read that it was said no but it was 2016 I would like a confirmation thank you.

0 votes



3 answers

Permanent link

 My best hints are:


Look into https://github.com/jazz-community/ewm-scm-utils it contains a lot of examples and code you can look at.
E.g. com.ibm.js.team.supporttools.scmutils.commands.ImportWorkspace

You should set up your development environment following the complete LAB 1 in https://jazz.net/library/article/1000 .
The workspaces you have at the end of Lab 1 allow you to see the JavaDoc and SDK properly. 

Unfortunately, at the moment, I do not see the addComponent detailled documentation either. But I downloaded the JavaDoc and found it in there. The boolean is for detailledUpdates. I usually use false.

As far as I can tell there is no public REST API to do this. You can use the SDK/Plain Java Client Libraries or the SCM Command Line tool.

1 vote

Comments

Thank you so much for the quick reply, I will take a look at the links you gave me and I will also use false, as suggested.

I'm doing a batch to test everything on a ProjectArea under test, I'll go on on this line. As soon as I get a response, I will also update the answer for the sake of information. In the meantime, thank you very much as always.
P.s. I figured they weren't there yet, but since the question was out of date, I tried. 


Permanent link

Good evening and here I am as promised, I solved the "question" if someone was useful I leave my source, do not pay attention to some customizations such as the owners of the streams and related components, you can put them who you want just match the types.


[Code]
/ Creazione Stream /
String streamName = "StreamByApiJava";
String streamDescription = "Descrizione della stream creata con API Java.";
IWorkspaceConnection stream = wm.createStream(handleTa, streamName, streamDescription, monitor);

/ Creazione Componenti /
IComponent ic = wm.createComponent(streamName+"_Documentazione", stream.getOwner(), monitor); //NomeModuloApplicativo + "_Documentazione"
IComponent a = wm.createComponent("Comp1", stream.getOwner(), monitor); //NomeComponente + "_Properties"
IComponent b = wm.createComponent("Comp2", stream.getOwner(), monitor); 
IComponent c = wm.createComponent("Comp3", stream.getOwner(), monitor);

//Il false qui sta per detailledUpdates (non ho ancora ben capito cosa indica pero')
IComponentOp op = stream.componentOpFactory().addComponent(a, false);
IComponentOp op2 = stream.componentOpFactory().addComponent(b, false);
IComponentOp op3 = stream.componentOpFactory().addComponent(c, false);
IComponentOp op4 = stream.componentOpFactory().addComponent(ic, false);
ArrayList<IComponentOp> list = new ArrayList();
list.add(op);
list.add(op2);
list.add(op3);
list.add(op4);
stream.applyComponentOperations(list, monitor);
[/Code]

I hope I didn't write nonsense, in the tests I did, for what we need is just fine, thanks a lot again to everyone.

0 votes


Permanent link

Good evening and here I am as promised, I solved the "question" if someone was useful I leave my source, do not pay attention to some customizations such as the owners of the streams and related components, you can put them who you want just match the types.


[Code]
/ Creazione Stream /
String streamName = "StreamByApiJava";
String streamDescription = "Descrizione della stream creata con API Java.";
IWorkspaceConnection stream = wm.createStream(handleTa, streamName, streamDescription, monitor);

/ Creazione Componenti /
IComponent ic = wm.createComponent(streamName+"_Documentazione", stream.getOwner(), monitor); //NomeModuloApplicativo + "_Documentazione"
IComponent a = wm.createComponent("Comp1", stream.getOwner(), monitor); //NomeComponente + "_Properties"
IComponent b = wm.createComponent("Comp2", stream.getOwner(), monitor); 
IComponent c = wm.createComponent("Comp3", stream.getOwner(), monitor);

//Il false qui sta per detailledUpdates (non ho ancora ben capito cosa indica pero')
IComponentOp op = stream.componentOpFactory().addComponent(a, false);
IComponentOp op2 = stream.componentOpFactory().addComponent(b, false);
IComponentOp op3 = stream.componentOpFactory().addComponent(c, false);
IComponentOp op4 = stream.componentOpFactory().addComponent(ic, false);
ArrayList<IComponentOp> list = new ArrayList();
list.add(op);
list.add(op2);
list.add(op3);
list.add(op4);
stream.applyComponentOperations(list, monitor);
[/Code]
I hope I didn't write nonsense, in the tests I did, for what we need is just fine, thanks a lot again to everyone.

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

Question asked: Mar 30 '22, 9:40 a.m.

Question was seen: 1,924 times

Last updated: Mar 30 '22, 12:36 p.m.

Confirmation Cancel Confirm