gpt4 book ai didi

java - 如何使用 "VersionOne SDK JAVA API"客户端创建缺陷

转载 作者:行者123 更新时间:2023-11-30 07:50:45 28 4
gpt4 key购买 nike

我正在尝试使用“VersionOne.SDK.Java.APIClient 13.0.1”jar 创建缺陷。

        Oid projectId = services.getOid(scopeId);
IAssetType assetType = this.metaModel.getAssetType("Defect");
Asset newAsset = services.createNew(assetType, projectId);

IAttributeDefinition nameAttribute = assetType.getAttributeDefinition("Name");
IAttributeDefinition Custom_FailureType = assetType.getAttributeDefinition("Custom_FailureType.Name");
IAttributeDefinition defectStatus=assetType.getAttributeDefinition("Status.Name");
IAttributeDefinition defectSeverity=assetType.getAttributeDefinition("Type.Name");
IAttributeDefinition defectSource=assetType.getAttributeDefinition("Source.Name");
IAttributeDefinition defectVersion=assetType.getAttributeDefinition("VersionAffected");

//newAsset.addAttributeValue(Custom_FailureType, "My New Defect");
newAsset.setAttributeValue(nameAttribute, "My New Defect");
newAsset.setAttributeValue(Custom_FailureType, "Functional Failure");
newAsset.setAttributeValue(defectStatus, "Done");
newAsset.setAttributeValue(defectSeverity, "Minor");
newAsset.setAttributeValue(defectSource, "sales");
newAsset.setAttributeValue(defectVersion, "1.2.3");

services.save(newAsset);

System.out.println(newAsset.getOid().getToken());
System.out.println(newAsset.getAttribute(nameAttribute).getValue());

但出现以下错误:

“无法为只读属性分配新值:Defect.Custom_FailureType.Name”

字段 Custom_FailureType 是强制性的,因此如果不为 Custom_FailureType 分配值,我就无法创建缺陷。

您能告诉我如何创建缺陷吗?

最佳答案

SDK 版本 13 不支持此功能。请下载版本15:

https://community.versionone.com/Developers/Developer-Library/Documentation/Java_SDK

关于java - 如何使用 "VersionOne SDK JAVA API"客户端创建缺陷,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33368948/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com