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.
One answer
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.
Comments
thanks for the reply Ralph....We have used the above mentioned method itself.. Its working fine...We are able to checkin the files. :)
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.