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

How to get a Stream Object

Hi,

trying to automate some funcionalities in TC, we took some snippets and one of them teachs how to create a stream, components and etc..


ITeamAreaHandle teamArea = Snippet3.createProject(repo, "Snippet 2");

IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);

IWorkspaceConnection workspace = wm.createWorkspace(repo.loggedInContributor(), "WS", "Des", monitor);

IComponentHandle component = wm.createComponent("Component", repo.loggedInContributor(), monitor);

workspace.addComponent(component, false, monitor);

// create the stream seeded from the workspace
IWorkspaceConnection stream = wm.createStream(teamArea, "Example Stream", "Desc", monitor);
stream.addComponent(component, workspace, false, monitor);


What i want to do is to get a stream that already exists in the project area, the integration stream, and then add some components to her. I dont want to create a new one, like the code does calling "createStream".

Tks for any help!!

0 votes



6 answers

Permanent link
fausto wrote:
Hi,

trying to automate some funcionalities in TC, we took some snippets
and one of them teachs how to create a stream, components and etc..


ITeamAreaHandle teamArea = Snippet3.createProject(repo,
"Snippet 2");

IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);

IWorkspaceConnection workspace =
wm.createWorkspace(repo.loggedInContributor(),
"WS", "Des", monitor);

IComponentHandle component =
wm.createComponent("Component",
repo.loggedInContributor(), monitor);

workspace.addComponent(component, false, monitor);

// create the stream seeded from the workspace
IWorkspaceConnection stream = wm.createStream(teamArea,
"Example Stream", "Desc", monitor);
stream.addComponent(component, workspace, false,
monitor);

What i want to do is to get a stream that already exists in the
project area, the integration stream, and then add some components to
her. I dont want to create a new one, like the code does calling
"createStream".

Tks for any help!!


Try

public IItemQueryPage IWorkspaceManager#findWorkspacesByName(String
namePattern, boolean matchWorkspaces, boolean matchStreams, boolean
matchOwners, int pageSize, IProgressMonitor progressMonitor) throws
TeamRepositoryException;

Cheers
JohnC
SCM Server

0 votes


Permanent link
Hi John,

i try to use your sample but still not getting the stream object.


IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(teamRepository);

IItemQueryPage itemQueryPage = wm.findWorkspacesByName([b]workspaceName, true , false , false , 2[/b], monitor);

List<IWorkspaceHandle> handles = itemQueryPage.getItemHandles();

return handles.get(0);


i get a "BasicIndexOutOfBoundsException" when i try to get a IWorkspaceHandle from the handles list that i obtain calling itemQueryPage.getItemHandles();

My question is: the code above its right ? this is the right way to get a stream object ?

Its possible that im not passing the parameters correctly, for example the workspace name, and the booleans.

In the image below, i demonstrate what i want to get, my stream object, and then i will add more components to her!

http://www.faustolemos.com.br/TC.jpg


Tks for help!

0 votes


Permanent link
Hi,

any help ?

0 votes


Permanent link
fausto wrote:
Hi John,

i try to use your sample but still not getting the stream object.


IWorkspaceManager wm =
SCMPlatform.getWorkspaceManager(teamRepository);

IItemQueryPage itemQueryPage =
wm.findWorkspacesByName(workspaceName, true , false ,
false , 2
, monitor);

List<IWorkspaceHandle> handles =
itemQueryPage.getItemHandles();

return handles.get(0);


i get a "BasicIndexOutOfBoundsException" when i try to get a
IWorkspaceHandle from the handles list that i obtain calling
itemQueryPage.getItemHandles();

My question is: the code above its right ? this is the right way to
get a stream object ?

Its possible that im not passing the parameters correctly, for
example the workspace name, and the booleans.

In the image below, i demonstrate what i want to get, my stream
object, and then i will add more components to her!

http://www.faustolemos.com.br/TC.jpg


Tks for help!


What are you passing in for name?

0 votes


Permanent link
im passing blank!

tks!

0 votes


Permanent link
fausto wrote:
im passing blank!

tks!


Then I believe there are no streams in your repository.
You can check whether this is true or not by connecting w/the RTC UI to
project areas in your repository.

If you can see streams in the UI, but the API does not find them, you
should raise a bug on jazz.net

Thanks
JohnC
SCM Server

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

Question asked: Dec 18 '08, 11:34 a.m.

Question was seen: 7,295 times

Last updated: Dec 18 '08, 11:34 a.m.

Confirmation Cancel Confirm