Agile PLM API 在项目之间创建关系:无效参数

Agile PLM API create relationship between items: Invalid Parameter

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

但是在Relationship Table中创建Relationships时,我总是得到这个错误:

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)

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

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

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

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