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

existing stream to deliver and multiple files

I try to deliver new file or to update existing file from my repository workspace to existing Stream. I work snippets in plain java client.

I created a changeset and set comments and relate to workitem by creating new stream succesfully. But I try to deliver changeset to existing stream. I think I set to wrong streamConnection. I try like

IChangeSetHandle cs1 = workspace.createChangeSet(currentComponent, monitor);
SCMPlatform.getWorkspaceManager(workspace.teamRepository()).setComment(cs1, "comments", monitor);

IFolderHandle rootFolder = (IFolderHandle) workspace.configuration(currentComponent).rootFolderHandle(monitor);
String[] nameSegments = new String;
nameSegments = "project";
IVersionableHandle filePathHandle = workspace.configuration(currentComponent).resolvePath(rootFolder,nameSegments, monitor);

IFolderHandle projectFolder = (IFolderHandle) filePathHandle;

IFileItem file = (IFileItem) IFileItem.ITEM_TYPE.createItem();
file.setName("file2.txt");
file.setParent(projectFolder);//file.setParent(projectFolder);
IFileContentManager contentManager = FileSystemCore.getContentManager(repo);
IFileContent storedContent = contentManager.storeContent(IFileContent.ENCODING_US_ASCII,FileLineDelimiter.LINE_DELIMITER_PLATFORM,
new VersionedContentManagerByteArrayInputStreamPovider("The contents of mhhy file.txt".getBytes()), null, monitor);
file.setContentType(IFileItem.CONTENT_TYPE_TEXT);
file.setContent(storedContent);
file.setFileTimestamp(new Date());
workspace.commit(cs1, Collections
.singletonList(workspace.configurationOpFactory().save(file)), monitor);

IWorkItemClient workItemClient = (IWorkItemClient) repo.getClientLibrary(IWorkItemClient.class);
IWorkItemWorkingCopyManager copyManager = workItemClient.getWorkItemWorkingCopyManager();
IWorkItem workItem = workItemClient.findWorkItemById(972, IWorkItem.FULL_PROFILE, monitor);
IWorkItemHandle workItemhandle= workItemClient.findWorkItemById(972,IWorkItem.FULL_PROFILE, null);
.......
IChangeHistorySyncReport sync = workspace.compareTo(workspace, WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY,
Collections.EMPTY_LIST, monitor);
workspace.deliver(workspace, sync, Collections.EMPTY_LIST,
sync.outgoingChangeSets(currentComponent), monitor);

I set to same values for StreamConnection and workspaceConnection because I want to deliver them to existing stream. Is it wrong or how can I set stream Connection? In addition it creates files in repository workspace.

And also I wonder about to deliver. Is it possible to deliver multiple files? I can do it like workspace.configurationOpFactory().save(rootFolder) ?

0 votes



One answer

Permanent link
I can get stream connection and deliver to existing stream successfully. Maybe I can get stream Connection with different way. I had stream connection value like this...

List<IFlowEntry> flowEntryList = workspace.getFlowTable().deliverTargets();
IFlowEntry FlowList = flowEntryList.get(0);

IFlowNodeHandle flowhandle = FlowList.getFlowNode();
IWorkspaceHandle remoteworkspaceHandle = (IWorkspaceHandle) flowhandle;

IWorkspaceConnection remoteworkspace = wm.getWorkspaceConnection(remoteworkspaceHandle, null);

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,939

Question asked: Jan 27 '12, 3:57 a.m.

Question was seen: 5,509 times

Last updated: Jan 27 '12, 3:57 a.m.

Confirmation Cancel Confirm