It's all about the answers!

Ask a question

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 ?

Jazzuser user (681050) | asked Jul 19 '17, 12:17 a.m.

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();
  IFileContentManager contentManager = FileSystemCore.getContentManager(repo);
  IFileContent storedContent = contentManager.storeContent(IFileContent.ENCODING_UTF_8, FileLineDelimiter.LINE_DELIMITER_NONE,
  new VersionedContentManagerByteArrayInputStreamPovider(FileUtils.readFileToByteArray(file)), null, null);

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.


One answer

permanent link
Ralph Schoon (63.3k33646) | answered Jul 19 '17, 3:57 a.m.

What is described in 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.

Jazzuser user commented Jul 19 '17, 12:18 p.m. | edited Jul 19 '17, 12:19 p.m.

 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.

Shashikant Padur commented Jul 19 '17, 11:44 p.m.




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

Ralph Schoon commented Jul 20 '17, 2:25 a.m.

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).

Jazzuser user commented Jul 21 '17, 8:36 a.m.

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 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.