ProductInstance – getPIDConfig(文字列 className, 文字列 modelCategorySysId)

  • リリースバージョン: Washingtondc
  • 更新日 2024年02月01日
  • 読む4読むのに数分
  • 階層とクラス名に基づいて、モデルカテゴリに関連付けられた PID 構成を取得します。

    このメソッドは、モデルカテゴリのすべての階層をスキャンし、最初に見つかったモデルカテゴリの PID 構成を返します。

    表 : 1. パラメーター
    名前 タイプ 説明
    className 文字列 生成される PID のテーブル名。
    modelCategorySysID 文字列 モデル カテゴリ [cmdb_model_category] テーブルのモデル カテゴリのsys_id。詳細については、「 Model categories 」を参照してください。
    表 : 2. 返される内容
    タイプ 説明
    オブジェクト 指定されたクラス名とモデルカテゴリに関連付けられた PID 構成を含む JSON オブジェクト。
    {
      "model_category_sysId": "String",
      "configs": [Array]
    }
    <Object>.model_category_sysId モデル カテゴリ [cmdb_model_category] テーブルの製品カテゴリのsys_id。

    モデルカテゴリ階層が PID の生成に使用された場合、この値は入力値とは異なる場合があります。

    データタイプ:文字列

    <Object>。Configs 指定されたモデルカテゴリに関連付けられている各構成のリスト。
    
    "configs": [
     {
      "configuration_order": Number,
      "parameters": [Array]
     }
    ]

    データタイプ:アレイ

    <Object>.configs.configuration_order 製品インスタンス識別子パラメーター [product_instance_identifier_parameters] テーブルで定義された構成の順序を返します。

    データタイプ:数値

    <Object>.configs.parameters 構成とその順序に関連付けられているすべてのパラメーターのリスト。
    "parameters": [
      {
       "parameter_class_attribute_name": "String",
       "parameter_class_name": "String",
       "parameter_name": "String",
       "parameter_order": Number
      }
    ]

    データタイプ:オブジェクトのアレイ

    <Object>.configs.parameters.parameter_class_attribute_name parameter_class_nameプロパティに関連付けられたパラメーター名。この文字列は、そのクラスに対応する列の名前を表します。

    データタイプ:文字列

    <Object>.configs.parameters.parameter_class_name 製品インスタンス識別子パラメーター [product_instance_identifier_parameters] テーブルで定義されたパラメーターに関連付けられたクラス名。

    データタイプ:文字列

    <Object>.configs.parameters.parameter_name 製品インスタンス識別子パラメーター [product_instance_identifier_parameters] テーブルで定義されたパラメーター名。

    データタイプ:文字列

    <Object>.configs.parameters.parameter_order 製品インスタンス識別子パラメーター [product_instance_identifier_parameters] テーブルで定義されたパラメーターの順序。

    データタイプ:数値

    次の例は、医療資産 [sn_ent_medical_asset] テーブルで指定されたモデルカテゴリの構成の詳細を取得する方法を示しています。このテーブルは、Customer Service Install Base Management (com.snc.install_base) プラグインに含まれています。

    var config = sn_cmdb.ProductInstance.getPIDConfig('sn_ent_medical_asset', '4b8aa89a77710110dd5fca22fe5a9984');
    gs.info(JSON.stringify(config,null,'\t'));

    出力:

    {
      "model_category_sysId": "4b8aa89a77710110dd5fca22fe5a9984",
      "configs": [
        {
          "parameters": [
            {
              "parameter_class_attribute_name": "serial_number",
              "parameter_class_name": "sn_ent_medical_asset",
              "parameter_name": "serial_number",
              "parameter_order": 1
            }
          ],
          "configuration_order": 100
        },
        {
          "parameters": [
            {
              "parameter_class_attribute_name": "parent",
              "parameter_class_name": "sn_ent_medical_asset",
              "parameter_name": "parent_asset",
              "parameter_order": 1
            },
            {
              "parameter_class_attribute_name": "model_component_id",
              "parameter_class_name": "sn_ent_medical_asset",
              "parameter_name": "model_component_id",
              "parameter_order": 2
            }
          ],
          "configuration_order": 200
        }
      ]
    }