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
1 vote
1 vote