gpt4 book ai didi

java - 如何在 VersionOne 中重新排列表达式中提及的顺序?

转载 作者:行者123 更新时间:2023-12-01 12:41:34 25 4
gpt4 key购买 nike

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

我想知道是否有办法覆盖提及的默认排列。目标排列是从父 Assets -> 子 Assets 。

类似这样的:

  • 默认:添加重置按钮(任务)、添加提交按钮(任务)、创建 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);

最佳答案

如果你检查元数据,你会发现提及是一个多关系属性。不幸的是,无法设置多关系属性中项目的顺序。这是检查元的查询:

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

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

关于java - 如何在 VersionOne 中重新排列表达式中提及的顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25050918/

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