基本上,我是在尝试IBMRationalTeamConcert平原Java客户端API,而且我仍然坚持添加操作来更改集合。
我创建一个新的更改集,检索Operation,然后从本地机器文件系统中添加一个新文件(可能是一个项目的新文件)。
val changeSetHandle = workspaceConnection.createChangeSet(component, null)
val operationFactory = workspaceConnection.configurationOpFactory()
val saveOperation = operationFactory.save(...)我不明白如何获得一个IVersionable句柄来提交给save()方法。
发布于 2018-01-06 21:22:53
您可以参考这条线,它显示了一个IVersionable示例
// Create a new file and give it some content
IFileItem file = (IFileItem) IFileItem.ITEM_TYPE.createItem();
file.setName("file.txt");
file.setParent(projectFolder);
// Create file content.
IFileContentManager contentManager = FileSystemCore.getContentManager(repository);
IFileContent fileContent = contentManager.storeContent(
"UTF-8",
FileLineDelimiter.LINE_DELIMITER_LF,
new VersionedContentManagerByteArrayInputStreamPovider(BYTE_ARRAY),
null,
null);
file.setContent(fileContent);
file.setContentType(IFileItem.CONTENT_TYPE_TEXT);
file.setFileTimestamp(new Date());
workspaceConnection.configurationOpFactory().save(file);然而,这还不够:
IConfigurationOpFactory用于通过向更改集添加更改来更新存储库工作区。 使用模式是获取一个工作区连接,创建一组保存操作,然后在这些操作上运行IWorkspaceConnection#commit()。 在不提交更改的情况下调用save(),将op拖到堆栈上,以便垃圾收集器吞食。;)
https://stackoverflow.com/questions/48131839
复制相似问题