It's all about the answers!

Ask a question

How to get a Stream Object


Fausto Lemos (16811518) | asked Dec 18 '08, 11:34 a.m.
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!!

6 answers



permanent link
John Camelon (1.7k14) | answered Dec 19 '08, 12:18 a.m.
JAZZ DEVELOPER
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

permanent link
Fausto Lemos (16811518) | answered Dec 19 '08, 12:50 p.m.
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!

permanent link
Fausto Lemos (16811518) | answered Dec 22 '08, 6:18 a.m.
Hi,

any help ?

permanent link
John Camelon (1.7k14) | answered Dec 22 '08, 11:08 a.m.
JAZZ DEVELOPER
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?

permanent link
Fausto Lemos (16811518) | answered Dec 22 '08, 2:39 p.m.
im passing blank!

tks!

permanent link
John Camelon (1.7k14) | answered Dec 23 '08, 11:08 a.m.
JAZZ DEVELOPER
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

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.