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

Is it possible to deliver a given file as a changeset to a component instead of creating the file and then copying the contents in RTC SCM ?

Hello All,

I have a scenario to deliver a file  to RTC SCM component programatically using SCM APIs.

 I want to deliver the entire file object as a Change set instead of creating the fileItem and copying the contents byte by byte.

I feel copying contents is error prone in my case, as when copying these contents, some special characters might be missed in those code files(What if some characters are not in ENCODING_UTF_8).

Currently am using this below code :
IFileItem fileItem = (IFileItem) IFileItem.ITEM_TYPE.createItem();
  fileItem.setParent(parentFolder);
  fileItem.setName(file.getName());
  IFileContentManager contentManager = FileSystemCore.getContentManager(repo);
  IFileContent storedContent = contentManager.storeContent(IFileContent.ENCODING_UTF_8, FileLineDelimiter.LINE_DELIMITER_NONE,
  new VersionedContentManagerByteArrayInputStreamPovider(FileUtils.readFileToByteArray(file)), null, null);
  fileItem.setContent(storedContent);
  fileItem.setContentType(IFileItem.CONTENT_TYPE_UNKNOWN);


Is it possible to deliver the entire file object as changeSet ? Or creating fileItem and then copying contents, is the only way ?

Please assist me on this.

Thanks.

0 votes



One answer

Permanent link

What is described in https://rsjazz.wordpress.com/2013/09/30/delivering-change-sets-and-baselines-to-a-stream-using-the-plain-java-client-libraries/ is the only method I am aware of. Why should there be more than one in the API? You can certainly search the API for usage of the calls and may be find a short cut. In any case the information that is needed is needed

I don't get the error prone argument in an automation.

1 vote

Comments

 thanks for the reply Ralph....We have used the above mentioned method itself.. Its working fine...We are able to checkin the files. :) 


however our usecase is slightly different then the one in the provided sample example. It is to finally, "Deliver the each file as  a new changeset"(We need this for future enhancements). so we now have succeeded in creating new changesets for each file checkIn. 

however they are not delivered. Are there any APIs to deliver the changeset by associating the workitem and adding a comment to the changeset programmatically ?

We are getting pre-condition failure exception in this case :(

Request you to assist.

IWorkspaceConnection#deliver()

IFileSystemWorkItemManager#createLink()

IWorkspaceManager#setComment() 

<style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} </style>

1 vote

The series of posts I sent you actually talks about delivery of change sets as well. Does not matter how many change sets you create.

A work item does not deliver anything, as Shashikant points out you can link work items to change sets. Note, this might actually be limited to the SCM component you will see what I mean if you see an error message saying so.

So you still have to deliver the change sets the normal way and ndependently link the work item(s).

1 vote

Thanks for the reply Shashi and Ralph..We will try on the above mentioned APIs and will get back to you with our approach.

Thanks again.

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,937
× 1,202

Question asked: Jul 19 '17, 12:17 a.m.

Question was seen: 2,739 times

Last updated: Jul 21 '17, 8:36 a.m.

Confirmation Cancel Confirm