0

我使用 Java API 以编程方式为 VersionOne 资产创建对话。检查 Web UI 上的对话时,我看到提到的资产是按字母顺序排列的。

我想知道是否有办法覆盖提及的默认排列。目标安排将来自父资产 -> 子项。

像这样的东西:

  • 默认值:添加重置按钮(任务)、添加提交按钮(任务)、创建 UI(故事)
  • 目标:创建 UI(故事)、添加重置按钮(任务)、添加提交按钮(任务)

我尝试过的一些事情:

  1. 查看表达式和消息元数据。找不到与排序或排序相关的任何内容。
  2. 首先添加父资产,然后添加子资产:

    // create a new conversation; this will act as the container of the expression (message)
    
    IAssetType conversationType = super.connection.metaModel.getAssetType(CONVERSATION);
    Asset conversationAsset = super.connection.services.createNew(conversationType, Oid.Null);
    super.connection.services.save(conversationAsset);
    
    // create a new expression containing the error message
    
    IAssetType expressionType = super.connection.metaModel.getAssetType(EXPRESSION);
    IAttributeDefinition expressionContentAttr = super.connection.metaModel.getAttributeDefinition(EXPRESSION_CONTENT);
    IAttributeDefinition expressionBelongsTo = super.connection.metaModel.getAttributeDefinition(EXPRESSION_BELONGS_TO);
    IAttributeDefinition expressionMentionsAttr = super.connection.metaModel.getAttributeDefinition(EXPRESSION_MENTIONS);
    
    Asset expressionAsset = super.connection.services.createNew(expressionType, Oid.Null);
    
    // set the message
    expressionAsset.setAttributeValue(expressionContentAttr, message);
    
    // add the message to the conversation
    expressionAsset.setAttributeValue(expressionBelongsTo, conversationAsset.oid);
    
    // set the context of the expression to belong to the VersionOne record
    Oid oid = Oid.fromToken(entity.oid, super.connection.metaModel);
    expressionAsset.addAttributeValue(expressionMentionsAttr, oid);
    
    // add mentions of other assets to the conversation
    for (String assetOid : assetOids) {
        Oid otherOid = Oid.fromToken(assetOid, super.connection.metaModel);
        expressionAsset.addAttributeValue(expressionMentionsAttr, otherOid);
    }
    
    super.connection.services.save(expressionAsset);
    
4

1 回答 1

1

如果您检查 meta,您会看到 Mentions 是一个多关系属性。不幸的是,没有办法在多关系属性中设置项目的顺序。这是检查元的查询:

https://www14.v1host.com/v1sdktesting/meta.v1/Expression?xsl=api.xsl

VersionOne UI 有一些逻辑可以在显示之前设置对话提及的顺序。

于 2014-08-12T13:38:46.077 回答