更新时间:2024-08-19 GMT+08:00
分享

生命周期管理开发指导

本文指导您通过全量数据服务API使用生命周期管理功能。

涉及的接口

表1 涉及的接口

接口名称

说明

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/LifecycleBusinessOperation/create

创建业务操作。

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/LifecycleState/create

创建状态。

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/LifecycleTemplate/create

创建生命周期模板。

https://{Endpoint}/rdm_{appID}_app/services/rdm/basic/api/LifecycleTemplate/updateLifecycleInfo

为实体绑定生命周期模板。

https://{Endpoint}/rdm_{appID}_app/services/dynamic/api/{entityName}/update

修改数据实例,更新数据实例当前的生命周期阶段。

https://{Endpoint}/rdm_{appID}_app/services/dynamic/api/{entityName}/checkout

检出M-V模型的数据实例,更新数据实例当前的生命周期阶段。

https://{Endpoint}/rdm_{appID}_app/services/dynamic/api/{entityName}/checkin

检入M-V模型的数据实例,更新数据实例当前的生命周期阶段。

步骤1:创建业务操作

  1. 准备工作。

    应用运行态中获取创建业务操作的API信息,具体操作请参见全量数据服务

  2. 根据实际业务对象的生命周期管理流程,调用API创建业务操作。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/basic/api/LifecycleBusinessOperation/create
      
      {
          "params": {
              "name": "发布",
              "nameEn": "Publish",
              "description": "",
              "descriptionEn": ""
          }
      }

      其中,{Endpoint}、{appID}表示数据建模引擎所在域名/IP地址和应用ID,“name”“nameEn”“description”“descriptionEn”表示业务操作的中英文名称和中英文描述。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [
              {
                  "id": "504753788985286656",
                  "creator": "XDM_Developer 93172bbfd0f644************345386",
                  "modifier": "XDM_Developer 93172bbfd0f644************345386",
                  "createTime": "2023-05-29T12:31:21.166+0000",
                  "lastUpdateTime": "2023-05-29T12:31:21.166+0000",
                  "rdmVersion": 1,
                  "rdmDeleteFlag": 0,
                  "rdmExtensionType": "LifecycleBusinessOperation",
                  "tenant": {
                      "id": "-1",
                      "creator": "xdmAdmin",
                      "modifier": "xdmAdmin",
                      "createTime": "2023-05-29T11:27:42.000+0000",
                      "lastUpdateTime": "2023-05-29T11:27:42.000+0000",
                      "rdmVersion": 1,
                      "rdmDeleteFlag": 0,
                      "rdmExtensionType": "Tenant",
                      "tenant": null,
                      "className": "Tenant",
                      "name": "basicTenant",
                      "description": "默认租户",
                      "kiaguid": null,
                      "securityLevel": "internal",
                      "code": "basicTenant",
                      "disableFlag": false,
                      "dataSource": "DefaultDataSource"
                  },
                  "className": "LifecycleBusinessOperation",
                  "businessCode": "LOP00000001",
                  "description": "",
                  "descriptionEn": "",
                  "nameEn": "Publish",
                  "name": "发布",
                  "disableFlag": false
              }
          ],
          "errors": []
      }

步骤2:创建状态

  1. 准备工作。

    应用运行态中获取创建状态的API信息,具体操作请参见全量数据服务

  2. 根据实际业务对象的生命周期管理流程,调用API创建状态。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/basic/api/LifecycleState/create
      
      {
          "params": {
              "name": "已发布",
              "nameEn": "Published",
              "description": "",
              "descriptionEn": "",
              "internalName": "Published"
          }
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“name”“nameEn”“description”“descriptionEn”表示生命周期状态的中英文名称和中英文描述。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [
              {
                  "id": "504966116662059008",
                  "creator": "XDM_Developer 93172bbfd0f644************345386",
                  "modifier": "XDM_Developer 93172bbfd0f644************345386",
                  "createTime": "2023-05-30T02:35:04.029+0000",
                  "lastUpdateTime": "2023-05-30T02:35:04.029+0000",
                  "rdmVersion": 1,
                  "rdmDeleteFlag": 0,
                  "rdmExtensionType": "LifecycleState",
                  "tenant": {
                      "id": "-1",
                      "creator": "xdmAdmin",
                      "modifier": "xdmAdmin",
                      "createTime": "2023-05-29T11:27:42.000+0000",
                      "lastUpdateTime": "2023-05-29T11:27:42.000+0000",
                      "rdmVersion": 1,
                      "rdmDeleteFlag": 0,
                      "rdmExtensionType": "Tenant",
                      "tenant": null,
                      "className": "Tenant",
                      "name": "basicTenant",
                      "description": "默认租户",
                      "kiaguid": null,
                      "securityLevel": "internal",
                      "code": "basicTenant",
                      "disableFlag": false,
                      "dataSource": "DefaultDataSource"
                  },
                  "className": "LifecycleState",
                  "descriptionEn": "",
                  "businessCode": "LCS00000003",
                  "name": "已发布",
                  "description": "",
                  "nameEn": "Published",
                  "internalName": "Published",
                  "disableFlag": false,
                  "extAttrs": [],
                  "extAttrMap": {}
              }
          ],
          "errors": []
      }

步骤3:创建生命周期模板

  1. 准备工作。

    应用运行态中获取创建生命周期模板的API信息,具体操作请参见全量数据服务

  2. 根据实际业务对象的生命周期管理流程,调用API创建生命周期模板。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/basic/api/LifecycleTemplate/create
      
      {
          "params": {
              "name": "产品发布流程",
              "nameEn": "Product Release Process",
              "description": "",
              "descriptionEn": "",
              "master": {
                  "id": null,
                  "category": "",
                  "name": "产品发布流程",
                  "nameEn": "Product Release Process"
              },
              "branch": {
                  "id": null
              }
          }
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“master”“branch”表示生命周期模板的主对象和分支对象。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [
              {
                  "id": "504971863990996992",
                  "className": "LifecycleTemplate",
                  "name": "产品发布流程",
                  "description": "",
                  "master": {
                      "id": "504971863999385600",
                      "className": "LifecycleTemplateMaster",
                      "businessCode": "LCT00000002",
                      "nameEn": "Product Release Process",
                      "name": "产品发布流程",
                      "disableFlag": false
                  },
                  "branch": {
                      "id": "504971863999385601",
                      "className": "LifecycleTemplateBranch",
                      "version": "A"
                  },
                  "latest": true,
                  "latestIteration": true,
                  "versionCode": 1,
                  "iteration": 1,
                  "version": "A",
                  "latestVersion": true,
                  "workingCopy": false,
                  "workingState": {
                      "code": "CHECKED_IN",
                      "cnName": "已检入",
                      "enName": "checked in",
                      "alias": "CHECKED_IN"
                  },
                  "checkOutUserName": null,
                  "checkOutTime": null,
                  "preVersionId": null,
                  "descriptionEn": "",
                  "nameEn": "Product Release Process",
                  "reserved": null,
                  "lifecyclePhaseList": []
              }
          ],
          "errors": []
      }

步骤4:绑定生命周期模板

  1. 准备工作。

    应用运行态中获取绑定生命周期模板的API信息,具体操作请参见全量数据服务

  2. 根据实际业务对象的生命周期管理,调用API绑定生命周期模板。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/basic/api/LifecycleTemplate/updateLifecycleInfo
      
      {
          "params": {
              "applicationId": "1bab18b61c6f4f5bbd031d2d8e0e3fda",
              "id": "478135618698743808",
              "curLifecycleTemplateAttached": [
                  {
                      "id": "63c7e2aad21a4715bd8ac08d73da4805",
                      "templateAttrName": "生命周期模板",
                      "templateAttrNameEn": "LifecycleTemplate",
                      "templateAttrDescription": "生命周期模板",
                      "templateAttrDescriptionEn": "LifecycleTemplate",
                      "stateAttrName": "生命周期状态",
                      "stateAttrNameEn": "LifecycleState",
                      "stateAttrDescription": "生命周期状态",
                      "stateAttrDescriptionEn": "LifecycleState",
                      "attachTemplateId": "504971863990996992",
                      "attachTemplateName": "Product Release Process",
                      "attachTemplateNameEn": "产品发布流程"
                  }
              ]
          }
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,“attachTemplateId”“attachTemplateName”“attachTemplateNameEn”表示需要绑定的生命周期模板ID、名称和英文名称。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [
              {
                  "id": "478135618698743808",
                  "rdmExtensionType": "TypeDefinition",
                  "className": "TypeDefinition",
                  ...... // 实体详细信息
                  "lifecycleTemplateAttached": [
                      {
                          "attachTemplateId": "477901037156446208",
                          "stateAttrDescriptionEn": "LifecycleState",
                          "readOnly": true,
                          "stateAttrName": "生命周期状态",
                          "attachTemplateNameEn": "Test0316",
                          "templateAttrDescriptionEn": "LifecycleTemplate",
                          "templateAttrDescription": "生命周期模板",
                          "stateAttrDescription": "生命周期状态",
                          "id": "63c7e2aad21a4715bd8ac08d73da4805",
                          "attachTemplateName": "Test0316",
                          "templateAttrNameEn": "LifecycleTemplate",
                          "templateAttrName": "生命周期模板",
                          "stateAttrNameEn": "LifecycleState"
                      }
                  ],
                  "curLifecycleTemplateAttached": [
                      {
                          "id": "63c7e2aad21a4715bd8ac08d73da4805",
                          "templateAttrName": "生命周期模板",
                          "templateAttrNameEn": "LifecycleTemplate",
                          "templateAttrDescription": "生命周期模板",
                          "templateAttrDescriptionEn": "LifecycleTemplate",
                          "stateAttrName": "生命周期状态",
                          "stateAttrNameEn": "LifecycleState",
                          "stateAttrDescription": "生命周期状态",
                          "stateAttrDescriptionEn": "LifecycleState",
                          "attachTemplateId": "504971863990996992",
                          "attachTemplateName": "Product Release Process",
                          "attachTemplateNameEn": "产品发布流程"
                      }
                  ]
              }
          ],
          "errors": []
      }

步骤5:使用生命周期模板

  1. 准备工作。

    应用运行态中获取更新生命周期阶段的API信息,具体操作请参见全量数据服务

  2. 根据实际业务对象当前的生命周期阶段,调用API更新生命周期。

    • 请求示例
      POST http://{Endpoint}/rdm_{appID}_app/services/dynamic/api/{entityName}/update
      
      {
          "params": {
              ...... // 其他实体属性
              "lifecycleTemplate": {
                  "id": "455805277254459392",
                  "clazz": "LifecycleTemplate"
              },
              "lifecycleState": {
                  "id": "455663911463555072",
                  "clazz": "LifecycleState"
              },
              "tenant": {
                  "id": "-1",
                  "clazz": "Tenant"
              },
              "creator": "XDM_Developer 93172bbfd0f644************345386",
              "modifier": "XDM_Developer",
              "id": "505046194565681152"
          }
      }

      其中,{Endpoint}表示数据建模引擎所在域名或IP地址,{appID}表示应用ID,{entityName}表示实体的英文名称,“lifecycleTemplate”“lifecycleState”表示实例需要更新的生命周期模板和状态。

    • 响应示例
      {
          "result": "SUCCESS",
          "data": [
              {
                  "id": "505046194565681152",
                  ...... // 其他实例属性
                  "disableFlag": false,
                  "lifecycleTemplate": {
                      "id": "455805277254459392",
                      "className": "lifecycleTemplate"
                      ...... // 其他生命周期模板属性
                  },
                  "lifecycleState": {
                      "id": "455801165657935872",
                      "className": "LifecycleState"
                      ...... // 其他状态属性
                  }
              }
          ],
          "errors": []
      }

相关文档