敏捷PLM API创建项目之间的关系:无效参数



我正在使用敏捷PLM API开发scala应用程序。到目前为止一切正常,添加附件,添加BOM项目,创建项目等等

但是当在关系表中创建关系时,我总是会得到这样的错误:

com.agile.api.APIException: Invalid parameter.
at com.agile.api.pc.Session.createError(Session.java:2039)
at com.agile.api.pc.APIObject.createError(APIObject.java:76)
at com.agile.api.pc.TableRelationships.convertCreateParamMapToVOCells(TableRelationships.java:92)
at com.agile.api.pc.TablePC.doCreateServerRowWithParam(TablePC.java:58)
at com.agile.api.pc.Table.createTableRow(Table.java:267)
at com.agile.api.pc.Table.createRow(Table.java:231)

敏捷API需要一个以属性和值为参数的哈希映射来创建关系。这是我的代码:

val cells: java.utils.Map[_, _] = Map(
Attrs.Items.Relationships.CriteriaMet -> null,
Attrs.Items.Relationships.TypeImage -> 666, // id of item type as Integer
Attrs.Items.Relationships.Name -> "foo", // name as String
Attrs.Items.Relationships.Description -> "bar", // the description as String
Attrs.Items.Relationships.CurrentStatus -> "Production", // lifecyclephase 'Production' as a String
Attrs.Items.Relationships.Rule -> null,
Attrs.Items.Relationships.Type -> 600 // id of item type as Integer
) 
relationshipTable.createRow(cells)

relationshipTable实例的类型是ITable,这种Map用于添加BOM项目和附件,所以我认为这不是问题所在。

我只是手动查询现有关系的单元格,并将它们的键与此映射中使用的常量进行比较,结果它们是相同的。我真的不知道无效参数是什么。是否缺少属性?参数的类型错误吗?没有迹象表明出了什么问题。

好的,答案很简单,尽管它的工作原理与BOM不同,而且没有文档记录。

解决方案只是传递要添加为关系的项目:relationshipTable.createRow(iitem(

最新更新