Interface BPMInstanceClient

Hierarchy

  • BPMInstanceClient

Properties

addAttachments: ((instanceId, recs) => string[])

Type declaration

    • (instanceId, recs): string[]
    • 为运行BPM实例添加文件附件

      Parameters

      • instanceId: string

        BPM实例ID

      • recs: Dict[]

        添加文件信息的记录,需要符合attachfile表的字段要求

      Returns string[]

      添加成功的文件附件信息的记录id列表

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.addAttachments("002N000000VwBrSDISbQ", [
      {
      "name": "aaa",
      "fileName": "a/b/c",
      "category": "xxx",
      "url": "xxx.com/xxx/xxx",
      "taskID": "xxx",
      },
      {
      "name": "bbb",
      "fileName": "a/b/c/d",
      "category": "yyy",
      "url": "yyy.com/yyy/yyy",
      "taskID": "yyy",
      }
      ])
      console.log(res)
cancel: ((instID, reason?) => Dict)

Type declaration

    • (instID, reason?): Dict
    • 撤销BPM流程实例

      Parameters

      • instID: string

        BPM实例ID,若ID不存在会报错

      • Optional reason: string

        撤销原因,可选

      Returns Dict

      BPM实例运行状态信息

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.cancel("002N000000VwBrSDISbQ", "my reason")
delete: ((instanceId) => void)

Type declaration

    • (instanceId): void
    • 删除BPM实例以及相关资源

      Parameters

      • instanceId: string

        BPM实例ID,若ID不存在会报错

      Returns void

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.delete("bpInstanceId")
deleteAttachments: ((instanceId, idList) => void)

Type declaration

    • (instanceId, idList): void
    • 为运行BPM实例删除文件附件

      Parameters

      • instanceId: string

        BPM实例ID

      • idList: string[]

        需要删除的文件附件记录id列表

      Returns void

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.deleteAttachments("002N000000VwBrSDISbQ", ["10gh000000VwbArnQ75E"])
getJumpableElements: ((instanceId) => Set<string>)

Type declaration

    • (instanceId): Set<string>
    • 获取可跳转的元素列表。

      Parameters

      • instanceId: string

        BPM实例ID

      Returns Set<string>

      可跳转的元素列表

      {
      "task1": true,
      "task2": true
      }

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let recs = instClient.getJumpableElements("002N000000VwBrSDISbQ")
      console.log(recs)

      目前仅支持以下节点的跳转:

      1. 无法跨子流程回退 即无法回退到流程外的节点,无法回退第一个节点。具体来说,分为 3 个子场景限制:
        1. 并行网关场(AppCube BPM 中每个并行分支为一个子流程)
          1. 第一个节点无法回退,即无法回退并行任务;
          2. 并行网关内的节点无法回退到并行网关外;
          3. 并行网关外的节点无法跳转到并行网关内;
        2. 内嵌子流程场景:不能跳转到外部节点,外部节点无法跳转到内部;
        3. 调用活动场景:不能跳转到调用活动外的流程,外部节点无法跳转到内部。
      2. 只能跳转到人工节点。

      确定流程实例的方法主要通过任务的 parentId 确定。对于会签来说,需要获取个人任务的父任务(会签任务)的 parentId 才能确定。

getVars: ((instanceId, names) => Dict)

Type declaration

    • (instanceId, names): Dict
    • 获取BPM实例相关的变量值

      Parameters

      • instanceId: string

        BPM实例ID

      • names: string[]

        想查询的变量名清单,如果填入空数组,则查询所有变量

      Returns Dict

      查询出的变量值

      Example


      import * as bp from 'bp'
      let instClient=bp.newInstanceClient()
      let vars = instClient.getVars("002N000000VwBrSDISbQ", ["foo", "bar"])
      console.log(vars)
jumpToElement: ((instanceId, name) => void)

Type declaration

    • (instanceId, name): void
    • 关闭当前任务并跳转到指定名称的任务。

      Parameters

      • instanceId: string

        BPM实例ID

      • name: string

        用户任务的名称

      Returns void

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.jumpToElement("002N000000VwBrSDISbQ", "task1")

      See

      getJumpableElements 获取可跳转节点列表

query: ((instanceId, options?) => Dict)

Type declaration

    • (instanceId, options?): Dict
    • 查询具体BPM实例状态信息

      Parameters

      • instanceId: string

        BPM实例ID

      • Optional options: OptionItem

        可选参数,可部分留空或全部留空

      Returns Dict

      BPM实例状态信息

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.query("002N000000VwBrSDISbQ", {
      fields: ["name", "bpStatus", "createdDate", "owner"],
      })
      console.log(res)
queryActiveList: ((queryCondition?) => Dict[])

Type declaration

    • (queryCondition?): Dict[]
    • 查询激活状态的bpm实例(激活状态是指以下几种状态"New"、"Waiting for user interaction"、"Waiting for page event"、"Paused"、"Dispatched")

      Parameters

      • Optional queryCondition: QueryCondition

        查询条件,可部分留空或全部留空

      Returns Dict[]

      查询出BPM实例的记录

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let recs = instClient.queryActiveList({
      owner: "10gd000000KMFW1lhYZ6",
      options: {
      fields: ["name", "bpStatus", "createdDate", "owner"],
      }
      })
      console.log(recs)
queryAttachments: ((instanceId, options?) => Dict[])

Type declaration

    • (instanceId, options?): Dict[]
    • 查询BPM运行实例的文件附件记录

      Parameters

      • instanceId: string

        BPM实例ID

      • Optional options: OptionItem

        可选参数,可部分留空或全部留空

      Returns Dict[]

      多条关于指定BPM实例的文件附件信息

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let recs = instClient.queryAttachments("002N000000VwBrSDISbQ", {
      fields: ["taskID", "name", "fileName", "url"],
      limit: 5,
      })
      console.log(recs)
queryByCondition: ((condition?) => Dict[])

Type declaration

    • (condition?): Dict[]
    • 按自定condition和option来查询BPM实例

      Parameters

      • Optional condition: "bp".ConditionOption

        指定的查询条件,若不指定具体condition或option留空即可

      Returns Dict[]

      查询出BPM实例的记录

      Example


      import * as bp from 'bp'
      import * as db from 'db'
      let instClient = bp.newInstanceClient()
      let res = instClient.queryByCondition({
      condition: {
      conjunction: db.Conjunction.AND,
      conditions: [
      {
      field: "createdDate",
      operator: db.Operator.gt,
      value: "2019-08-01 00:00:00"
      }
      ]
      },
      options: {
      fields: ["name", "state", "version", "bpStatus", "createdDate"],
      orderby: [
      {
      field: "name",
      order: db.Order.desc
      }
      ],
      }
      })
      console.log(res)
queryComments: ((instanceId, options?) => Dict[])

Type declaration

    • (instanceId, options?): Dict[]
    • 查询BPM实例相关的评论

      Parameters

      • instanceId: string

        BPM实例ID

      • Optional options: OptionItem

        可选参数,可部分留空或全部留空

      Returns Dict[]

      BPM实例的评论记录

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.queryComments("bpInstanceId")
queryHistory: ((instanceId, category?, options?, sources?, kinds?) => Dict[])

Type declaration

    • (instanceId, category?, options?, sources?, kinds?): Dict[]
    • 查询BPM实例的历史记录

      Parameters

      • instanceId: string

        BPM实例ID

      • Optional category: string

        可选参数,指定查询历史的category,可以留空或置为undefined

      • Optional options: OptionItem

        可选参数,可部分留空或全部留空

      • Optional sources: string[]

        可选参数,历史记录的产生来源,用来根据数据来源筛选查询的历史记录。 Process: BPM流程实例上报的历史日志 UserTask: 用户任务图元上报的历史日志 CallActivity: 调用其他BPM流程图元上报的历史日志 Wait: 事件等待图元上报的历史日志 Task: 代办任务实例上报的历史日志

      • Optional kinds: string[]

        流程、任务状态。用于BPM历史记录查询接口,用来根据状态筛选历史日志。 created: 流程、图元或者任务创建/启动 completed: 流程、图元或者任务正常完成 suspended: 流程或者任务被挂起 resumed: 流程或者任务被恢复 terminated: 流程或者任务被终止 canceled: 流程或者任务被取消/撤回 delegated: 任务被委托 claimed: 任务(分配群组的)被认领 transferred: 任务被转移

      Returns Dict[]

      多条关于指定BPM实例的历史记录

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.queryHistory("002N000000VwBrSDISbQ", undefined, {
      fields: ["name", "bpStatus", "category", "owner"],
      }, ["Process","UserTask"], ["created", "completed"])
      console.log(res)
queryList: ((stateCondition?) => Dict[])

Type declaration

    • (stateCondition?): Dict[]
    • 按指定条件查询BPM实例

      Parameters

      • Optional stateCondition: StateCondition

        查询条件,可部分留空或全部留空,其中states参数可使用预定义枚举值

      Returns Dict[]

      返回BPM实例记录

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let recs = instClient.queryList({
      creator: "10gd000000KMFW1lhYZ6",
      states: [
      bp.State.New,
      bp.State.Suspended,
      bp.State.Dispatched,
      ]
      })
      console.log(recs)
queryMyList: ((options?) => Dict[])

Type declaration

    • (options?): Dict[]
    • 查询属主是调用者本人的bpm实例

      Parameters

      • Optional options: OptionItem

        查询设置,可为空

      Returns Dict[]

      查询出BPM实例的记录

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let recs = instClient.queryMyList({
      fields: ["name", "bpStatus", "createdDate", "owner"],
      })
      console.log(recs)
queryProcessTasks: ((instanceId, options?) => "bp".Process[])

Type declaration

    • (instanceId, options?): "bp".Process[]
    • 查询BPM实例任务流程列表

      Parameters

      • instanceId: string

        BPM实例ID

      • Optional options: DisplayOption

        可选参数,设置返回结构,默认为tree树形结构

      Returns "bp".Process[]

      多条关于指定BPM实例的任务执行流程

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.queryProcessTasks("002N000000VwBrSDISbQ", {"mode": "tree", "type": "all"})
      console.log(res)
querySuspendList: ((queryCondition?) => Dict[])

Type declaration

    • (queryCondition?): Dict[]
    • 查询suspended状态的bpm实例, 示例与queryActiveList类似

      Parameters

      • Optional queryCondition: QueryCondition

        查询条件,可部分留空或全部留空

      Returns Dict[]

      查询出BPM实例的记录

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res=instClient.querySuspendList({
      owner: "10gd000000KMFW1lhYZ6",
      options: {
      fields: ["name", "bpStatus", "createdDate", "owner"],
      }
      })
queryTasks: ((instanceId, states?, options?) => Dict[])

Type declaration

    • (instanceId, states?, options?): Dict[]
    • 查询一个BPM实例所对应的任务列表

      Parameters

      • instanceId: string

        BPM实例ID

      • Optional states: string[]

        指定要查询任务的状态,可使用枚举值,如不指定具体内容可留空或写为undefined

      • Optional options: OptionItem

        可选参数,可部分留空或全部留空

      Returns Dict[]

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.queryTasks("002N000000VwBrSDISbQ", [bp.State.Terminated, "Closed"], {
      fields: ["name", "owner", "state"]
      })
      console.log(res)
restart: ((instID, reason?, inputs?) => FlowInstance)

Type declaration

    • (instID, reason?, inputs?): FlowInstance
    • 重置BPM流程实例。即撤销正在执行的流程实例并重新启动

      Parameters

      • instID: string

        BPM实例ID,若ID不存在会报错

      • Optional reason: string

        撤销原因,可选

      • Optional inputs: Dict

        需要修改的流程变量值,可选

      Returns FlowInstance

      BPM实例运行状态信息

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.restart("002N000000VwBrSDISbQ", "my reason", {
      "foo": 1,
      "bar": 3
      })
resume: ((instanceId) => FlowInstance)

Type declaration

    • (instanceId): FlowInstance
    • 恢复一个suspended状态的BPM实例

      Parameters

      • instanceId: string

        BPM实例ID,若ID不存在会报错,若该实例非suspended状态,则无返回

      Returns FlowInstance

      BPM实例运行状态信息

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.resume("002N000000VwBrSDISbQ")
      console.log(res)
revokePreTask: ((instID, taskID?, allowClose?, create?) => FlowInstance)

Type declaration

    • (instID, taskID?, allowClose?, create?): FlowInstance
    • 撤回用户任务

      Parameters

      • instID: string

        BPM实例ID,若ID不存在会报错

      • Optional taskID: string

        task实例ID,若task已完成,则可以不填写

      • Optional allowClose: boolean

        是允许撤回已完成task

      • Optional create: boolean

        是否重新创建撤回节点的上一个节点

      Returns FlowInstance

      BPM实例运行状态信息

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.revokePreTask("002N000000VwBrSDISbQ", "002Q000000VwBrSDISbQ",true,true)
rollBackPreTask: ((instID, taskID?, allowClose?, create?) => FlowInstance)

Type declaration

    • (instID, taskID?, allowClose?, create?): FlowInstance
    • 打回用户任务

      Parameters

      • instID: string

        BPM实例ID,若ID不存在会报错

      • Optional taskID: string

        task实例ID,若task已完成,则可以不填写

      • Optional allowClose: boolean

        是允许打回已完成task

      • Optional create: boolean

        是否重新创建打回节点的上一个节点

      Returns FlowInstance

      BPM实例运行状态信息

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.rollBackPreTask("002N000000VwBrSDISbQ", "002Q000000VwBrSDISbQ",true,true)
setVars: ((instanceId, inputs) => void)

Type declaration

    • (instanceId, inputs): void
    • 设置BPM实例相关的变量值

      Parameters

      • instanceId: string

        BPM实例ID

      • inputs: Dict

        参数key-value键值对,注意设置的变量名是BPM定义过的变量

      Returns void

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.setVars("002N000000VwBrSDISbQ", {
      "foo": "aaa",
      "bar": "bbb"
      })
start: ((name, version, inputs) => FlowInstance)

Type declaration

    • (name, version, inputs): FlowInstance
    • 启动一个BPM实例

      Parameters

      • name: string

        BPM名

      • version: string

        版本号,如"1.0.1"

      • inputs: Dict

        入参,如无入参,可放置空Map{}

      Returns FlowInstance

      BPM实例运行状态信息

      {
      "name": "test",
      "version": "1.0.1",
      "id": "002N000000VwAuoT0WjA",
      "processDefID": "001L000000VBjcAIJjGa",
      "interviewLabel": "test",
      "nextElem": "userTask",
      "isTest": true,
      "state": "Dispatched",
      "bpStatus": "新建",
      ...
      ...
      }

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.start("test", "1.0.1", {
      "foo": 1,
      "bar": 3
      })
      console.log(res)
suspend: ((instanceId) => FlowInstance)

Type declaration

    • (instanceId): FlowInstance
    • 暂停一个运行的BPM实例

      Parameters

      • instanceId: string

        BPM实例ID,若ID不存在会报错

      Returns FlowInstance

      BPM实例运行状态信息

      Example


      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      let res = instClient.suspend("002N000000VwBrSDISbQ")
      console.log(res)
terminate: ((instanceId, reason?) => void)

Type declaration

    • (instanceId, reason?): void
    • 终结一个BPM实例以及相关资源

      Parameters

      • instanceId: string

        BPM实例ID,若ID不存在会报错

      • Optional reason: string

        可选参数,终结实例原因,不写可留空或写undefined

      Returns void

      Example

      import * as bp from 'bp'
      let instClient = bp.newInstanceClient()
      instClient.terminate("bpId","bp is end")