CdmQuery - スコープ指定
CdmQuery スクリプトインクルードは、CDMデータモデルツリーのクエリを可能にするメソッドを提供します。CDM ノード [sn_cdm_node] テーブルの特定のフィールド/列であるノードオブジェクトのリストを返します。これらの値は、オブジェクトのプロパティとして返されます。すべてのオブジェクトはデータモデル内のノードです。
このスクリプトインクルードは流暢です。つまり、ほとんどのメソッドがチェーンをサポートし、CdmQuery オブジェクトを返します。このスクリプトインクルード内のメソッドは、さまざまなタイプに分類されます。これらは、タイプに基づいて、呼び出し内で特定の順序で指定する必要があります。結果メソッドを除くすべてのメソッドはチェーン可能です。
- entry メソッド: このメソッドは、エントリノードを指定します。CdmQuery は、クエリをエントリ ノードとその子孫ノードに制限します。入力ノードの指定は必須です。
- query method:このメソッドは、指定されたクエリを実行します。
- result メソッド: これらのメソッドは、特定の結果データのセットを返します。
- メソッドの設定: これらのメソッドは、 CdmQuery() の動作を変更します。
snapshotId() メソッドと query() メソッドは必須です。filterメソッドとsettingメソッドは、 query() メソッドの前、 snapshotId() メソッドの後に追加する必要があります。フィルター メソッドと設定メソッドを追加する順序は、競合する場合を除き重要ではなく、最新の関連するメソッドが優先されます。結果をフェッチするには、 getTree() などの結果メソッドを query() メソッドの後に追加する必要があります。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
.decryptPassword(true)
.includeFileMetadata()
.query()
.getTree(true, false);この API は sn_cdm 名前空間で実行され、さまざまなメソッドにアクセスするには sn_cdm.cdm_viewer または sn_cdm.cdm_secrets ロールが必要です。
CdmQuery - CdmQuery()
CdmQuery オブジェクトをインスタンス化します。他の CdmQuery メソッドを呼び出す前に、このメソッドを呼び出す必要があります。
| 名前 | タイプ | 説明 |
|---|---|---|
| なし |
次のコード例は、 CdmQuery メソッドを呼び出して、sn_cdm 名前空間で CdmQuery オブジェクトをインスタンス化する方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
.decryptPassword(true)
.query()
.getTree();
CdmQuery - decryptPassword(ブール復号)
暗号化された構成データ項目 (CDI) および変数ノードの復号化された値を結果に返すかどうかを指定できます。
ユーザーが必要な sn_cdm.cdm_secrets ロールを持っていない場合は、エラーがスローされます。
| 名前 | タイプ | 説明 |
|---|---|---|
| 復号化 | ブーリアン | オプション。CDI ノードと変数ノードの復号化された値を返すかどうかを示すフラグ。 有効な値:
デフォルト値:false |
| タイプ | 説明 |
|---|---|
| なし |
次のコード例は、 CdmQuery() API を呼び出し、CDI ノードと変数ノードの暗号化された値を返すように指定する方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("9f12a80047352150fd6ce977746d4364")
.decryptPassword(false)
.query()
.getTree(true,true);
gs.info(primarySnapshot);
返される結果:
{
"Development_1": {
"vars": {},
"services": {
"vars": {},
"paymentComponent": {
"applicationSLA": "24x7",
"paymentService": {
"database": {
"backup": {
"dbServer": "db23.paymentx.be"
},
"dbIpAddress": "10.20.40.50",
"dbName": "paymentX_dev2",
"dbPort": "8050",
"dbServer": "db22.paymentx.be",
"dbUserName": "root",
"dbPassword": "*******"
}
}
}
}
}
}
次のコード例は、 CdmQuery() API を呼び出し、CDI ノードと変数ノードの復号化された値を返すように指定する方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("9f12a80047352150fd6ce977746d4364")
.decryptPassword(true)
.query()
.getTree(true,true);
gs.info(primarySnapshot);
返される結果:
{
"Development_1": {
"vars": {},
"services": {
"vars": {},
"paymentComponent": {
"applicationSLA": "24x7",
"paymentService": {
"database": {
"backup": {
"dbServer": "db23.paymentx.be"
},
"dbIpAddress": "10.20.40.50",
"dbName": "paymentX_dev2",
"dbPort": "8050",
"dbServer": "db22.paymentx.be",
"dbUserName": "root",
"dbPassword": "dev1-password"
}
}
}
}
}
}
CdmQuery - followIncludes(ブール値 followIncludes)
参照先ノードの子孫ノードがリンクされたノードの下に表示されるように、リンクされたノードを完全に解決するかどうかを指定できます。
| 名前 | タイプ | 説明 |
|---|---|---|
| フォローインクルード | ブーリアン | オプション。リンクされたノードが完全に解決されたかどうかを示すフラグ。 有効な値:
デフォルト:true |
| タイプ | 説明 |
|---|---|
| なし |
次のコード例は、完全に解決されたデータ ( followIncludes = true) を返す方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("9f12a80047352150fd6ce977746d4364")
.followIncludes(true)
.query()
.getTree(false, true);
返されるデータの例:
{
"sys_id": "62a0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_deployable",
"main_id": "111673",
"name": "Development_1",
"node_path": "!K<+!K<0!K<1",
"effective_path": "!K<+!K<0!K<1",
"main_id_encoded": "K<1",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "2",
"children": [
{
"sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_folder",
"main_id": "111674",
"name": "vars",
"node_path": "!K<+!K<0!K<1!K<2",
"effective_path": "!K<+!K<0!K<1!K<2",
"main_id_encoded": "K<2",
"node_classifier": "/application/deployables/env:Development/vars",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "2ca1600047352150fd6ce977746d4391",
"type": "sn_cdm_node_linked",
"main_id": "111693",
"name": "services",
"node_path": "!K<+!K<0!K<1!K<G",
"effective_path": "!K<+!K<0!K<1!K<G",
"main_id_encoded": "K<G",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "3",
"children": [
{
"sys_id": "2bb0e0cc47f12150fd6ce977746d43e2",
"type": "sn_cdm_node_folder",
"main_id": "111680",
"name": "vars",
"node_path": "!K<+!K</!K<7!K<8",
"effective_path": "!K<+!K<0!K<1!K<G!K<8",
"main_id_encoded": "K<8",
"node_classifier": "/application/collections/vars",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "ccf1640047352150fd6ce977746d438b",
"type": "sn_cdm_node_component",
"main_id": "111697",
"name": "paymentComponent",
"node_path": "!K<+!K<0!K<1!K<G!K<K",
"effective_path": "!K<+!K<0!K<1!K<G!K<K",
"main_id_encoded": "K<K",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "4",
"children": [
{
"sys_id": "7fd064cc47f12150fd6ce977746d4372",
"type": "sn_cdm_node_cdi",
"main_id": "111682",
"name": "applicationSLA",
"node_path": "!K<+!K<,!K<9!K<:",
"value": "24x7",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<:",
"main_id_encoded": "K<:",
"node_classifier": "/application/components",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "44f1a40047352150fd6ce977746d43dc",
"type": "sn_cdm_node_component",
"main_id": "111698",
"name": "paymentService",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
"main_id_encoded": "K<L",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "5",
"children": [
{
"sys_id": "8cf1a40047352150fd6ce977746d43dc",
"type": "sn_cdm_node_component",
"main_id": "111699",
"name": "database",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
"main_id_encoded": "K<M",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "6",
"children": [
{
"sys_id": "b3d064cc47f12150fd6ce977746d4374",
"type": "sn_cdm_node_component",
"main_id": "111685",
"name": "backup",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<?",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?",
"main_id_encoded": "K<?",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [
{
"sys_id": "7bd064cc47f12150fd6ce977746d4374",
"type": "sn_cdm_node_cdi",
"main_id": "111686",
"name": "dbServer",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<?!K<@",
"value": "db23.paymentx.be",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?!K<@",
"main_id_encoded": "K<@",
"node_classifier": "/application/components",
"status": "valid",
"level": "6",
"children": [],
"hasParent": true
}
],
"hasParent": true
},
{
"sys_id": "33d064cc47f12150fd6ce977746d4375",
"type": "sn_cdm_node_cdi",
"main_id": "111687",
"name": "dbIpAddress",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<A",
"value": "10.20.40.50",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<A",
"main_id_encoded": "K<A",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "f7d064cc47f12150fd6ce977746d4375",
"type": "sn_cdm_node_cdi",
"main_id": "111688",
"name": "dbName",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<B",
"value": "paymentX_dev2",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<B",
"main_id_encoded": "K<B",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "77d064cc47f12150fd6ce977746d4376",
"type": "sn_cdm_node_cdi",
"main_id": "111690",
"name": "dbPort",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<D",
"value": "8050",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<D",
"main_id_encoded": "K<D",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "3fd064cc47f12150fd6ce977746d4376",
"type": "sn_cdm_node_cdi",
"main_id": "111691",
"name": "dbServer",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<E",
"value": "db22.paymentx.be",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<E",
"main_id_encoded": "K<E",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "f3d064cc47f12150fd6ce977746d4377",
"type": "sn_cdm_node_cdi",
"main_id": "111692",
"name": "dbUserName",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<F",
"value": "root",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<F",
"main_id_encoded": "K<F",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "c4f1a40047352150fd6ce977746d43dd",
"type": "sn_cdm_node_cdi",
"main_id": "111700",
"name": "dbPassword",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
"secure_value": "dac329a2476c6110fd6ce977746d43e11w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
"main_id_encoded": "K<N",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "7",
"masked_value": "*******",
"children": [],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
]
}
次のコード例は、完全に解決されていないデータ ( followIncludes = false) を返す方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("9f12a80047352150fd6ce977746d4364")
.followIncludes(false)
.query()
.getTree(false, true);
返されるデータの例:
{
"sys_id": "62a0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_deployable",
"main_id": "111673",
"name": "Development_1",
"node_path": "!K<+!K<0!K<1",
"effective_path": "!K<+!K<0!K<1",
"main_id_encoded": "K<1",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "2",
"children": [
{
"sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_folder",
"main_id": "111674",
"name": "vars",
"node_path": "!K<+!K<0!K<1!K<2",
"effective_path": "!K<+!K<0!K<1!K<2",
"main_id_encoded": "K<2",
"node_classifier": "/application/deployables/env:Development/vars",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "2ca1600047352150fd6ce977746d4391",
"type": "sn_cdm_node_linked",
"main_id": "111693",
"name": "services",
"node_path": "!K<+!K<0!K<1!K<G",
"effective_path": "!K<+!K<0!K<1!K<G",
"main_id_encoded": "K<G",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "3",
"children": [
{
"sys_id": "ccf1640047352150fd6ce977746d438b",
"type": "sn_cdm_node_component",
"main_id": "111697",
"name": "paymentComponent",
"node_path": "!K<+!K<0!K<1!K<G!K<K",
"effective_path": "!K<+!K<0!K<1!K<G!K<K",
"main_id_encoded": "K<K",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "4",
"children": [
{
"sys_id": "44f1a40047352150fd6ce977746d43dc",
"type": "sn_cdm_node_component",
"main_id": "111698",
"name": "paymentService",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
"main_id_encoded": "K<L",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "5",
"children": [
{
"sys_id": "8cf1a40047352150fd6ce977746d43dc",
"type": "sn_cdm_node_component",
"main_id": "111699",
"name": "database",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
"main_id_encoded": "K<M",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "6",
"children": [
{
"sys_id": "c4f1a40047352150fd6ce977746d43dd",
"type": "sn_cdm_node_cdi",
"main_id": "111700",
"name": "dbPassword",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
"secure_value": "dac329a2476c6110fd6ce977746d43e11w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
"main_id_encoded": "K<N",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "7",
"masked_value": "*******",
"children": [],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
]
}
CdmQuery - forEach(関数、関数)
各結果ノードを反復処理し、CdmNode オブジェクトを受け入れる指定された関数を適用します。
| 名前 | タイプ | 説明 |
|---|---|---|
| 関数 | 関数 | CdmNode オブジェクトに適用する関数。 |
| タイプ | 説明 |
|---|---|
| なし |
このコード例は、 forEach() メソッドを呼び出す方法を示しています。
CdmQuery.forEach(function (node) {
gs.info("Node - {0}:{1} ", [node.getValue("name"), node.getValue("value")]);
});
CdmQuery - getTree(ブール simpleTree, ブール prettify)
指定された CDM クエリ結果を返します。
呼び出し内で関連するフラグを設定することで、返すコンテンツのレベルと形式を指定できます。デフォルトでは、ノードメタデータとその子ノードを含み、エントリノードが最上位ノードとなるフォーマットされた文字列が返されます。
| 名前 | タイプ | 説明 |
|---|---|---|
| シンプルツリー | ブーリアン | オプション。返すコンテンツのレベルを示すフラグ。 有効な値:
デフォルト値:false |
| 飾り立てる | ブーリアン | オプション。JSON オブジェクトの代わりに書式設定された文字列を返すかどうかを示すフラグ。 有効な値:
デフォルト値:false |
| タイプ | 説明 |
|---|---|
| CdmQuery | 指定されたクエリ情報を含む CdmQuery オブジェクト。 |
次のコード例は、デフォルト設定を使用して getTree() メソッドを呼び出す方法を示しています。これは、ノードメタデータとそのすべての子ノードを含むフォーマットされた文字列を返します。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("9f12a80047352150fd6ce977746d4364")
.query()
.getTree();
gs.info(JSON.stringify(primarySnapshot));
返される結果:
{"sys_id":"62a0a0cc47f12150fd6ce977746d431a","type":"sn_cdm_node_deployable","main_id":"111673","name":"Development_1","node_path":"!K<+!K<0!K<1","effective_path":"!K<+!K<0!K<1","main_id_encoded":"K<1","node_classifier":"/application/deployables/env:Development","status":"valid","level":"2","children":[{"sys_id":"2aa0a0cc47f12150fd6ce977746d431a","type":"sn_cdm_node_folder","main_id":"111674","name":"vars","node_path":"!K<+!K<0!K<1!K<2","effective_path":"!K<+!K<0!K<1!K<2","main_id_encoded":"K<2","node_classifier":"/application/deployables/env:Development/vars","status":"valid","level":"3","children":[],"hasParent":true},{"sys_id":"2ca1600047352150fd6ce977746d4391","type":"sn_cdm_node_linked","main_id":"111693","name":"services","node_path":"!K<+!K<0!K<1!K<G","effective_path":"!K<+!K<0!K<1!K<G","main_id_encoded":"K<G","node_classifier":"/application/deployables/env:Development","status":"valid","level":"3","children":[{"sys_id":"2bb0e0cc47f12150fd6ce977746d43e2","type":"sn_cdm_node_folder","main_id":"111680","name":"vars","node_path":"!K<+!K</!K<7!K<8","effective_path":"!K<+!K<0!K<1!K<G!K<8","main_id_encoded":"K<8","node_classifier":"/application/collections/vars","status":"valid","level":"3","children":[],"hasParent":true},{"sys_id":"ccf1640047352150fd6ce977746d438b","type":"sn_cdm_node_component","main_id":"111697","name":"paymentComponent","node_path":"!K<+!K<0!K<1!K<G!K<K","effective_path":"!K<+!K<0!K<1!K<G!K<K","main_id_encoded":"K<K","node_classifier":"/application/deployables/env:Development","status":"valid","level":"4","children":[{"sys_id":"7fd064cc47f12150fd6ce977746d4372","type":"sn_cdm_node_cdi","main_id":"111682","name":"applicationSLA","node_path":"!K<+!K<,!K<9!K<:","value":"24x7","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<:","main_id_encoded":"K<:","node_classifier":"/application/components","status":"valid","level":"3","children":[],"hasParent":true},{"sys_id":"44f1a40047352150fd6ce977746d43dc","type":"sn_cdm_node_component","main_id":"111698","name":"paymentService","node_path":"!K<+!K<0!K<1!K<G!K<K!K<L","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L","main_id_encoded":"K<L","node_classifier":"/application/deployables/env:Development","status":"valid","level":"5","children":[{"sys_id":"8cf1a40047352150fd6ce977746d43dc","type":"sn_cdm_node_component","main_id":"111699","name":"database","node_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M","main_id_encoded":"K<M","node_classifier":"/application/deployables/env:Development","status":"valid","level":"6","children":[{"sys_id":"b3d064cc47f12150fd6ce977746d4374","type":"sn_cdm_node_component","main_id":"111685","name":"backup","node_path":"!K<+!K<,!K<9!K<;!K<<!K<?","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?","main_id_encoded":"K<?","node_classifier":"/application/components","status":"valid","level":"5","children":[{"sys_id":"7bd064cc47f12150fd6ce977746d4374","type":"sn_cdm_node_cdi","main_id":"111686","name":"dbServer","node_path":"!K<+!K<,!K<9!K<;!K<<!K<?!K<@","value":"db23.paymentx.be","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?!K<@","main_id_encoded":"K<@","node_classifier":"/application/components","status":"valid","level":"6","children":[],"hasParent":true}],"hasParent":true},{"sys_id":"33d064cc47f12150fd6ce977746d4375","type":"sn_cdm_node_cdi","main_id":"111687","name":"dbIpAddress","node_path":"!K<+!K<,!K<9!K<;!K<<!K<A","value":"10.20.40.50","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<A","main_id_encoded":"K<A","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"f7d064cc47f12150fd6ce977746d4375","type":"sn_cdm_node_cdi","main_id":"111688","name":"dbName","node_path":"!K<+!K<,!K<9!K<;!K<<!K<B","value":"paymentX_dev2","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<B","main_id_encoded":"K<B","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"77d064cc47f12150fd6ce977746d4376","type":"sn_cdm_node_cdi","main_id":"111690","name":"dbPort","node_path":"!K<+!K<,!K<9!K<;!K<<!K<D","value":"8050","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<D","main_id_encoded":"K<D","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"3fd064cc47f12150fd6ce977746d4376","type":"sn_cdm_node_cdi","main_id":"111691","name":"dbServer","node_path":"!K<+!K<,!K<9!K<;!K<<!K<E","value":"db22.paymentx.be","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<E","main_id_encoded":"K<E","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"f3d064cc47f12150fd6ce977746d4377","type":"sn_cdm_node_cdi","main_id":"111692","name":"dbUserName","node_path":"!K<+!K<,!K<9!K<;!K<<!K<F","value":"root","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<F","main_id_encoded":"K<F","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"c4f1a40047352150fd6ce977746d43dd","type":"sn_cdm_node_cdi","main_id":"111700","name":"dbPassword","node_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N","secure_value":"dac329a2476c6110fd6ce977746d43e11w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N","main_id_encoded":"K<N","node_classifier":"/application/deployables/env:Development","status":"valid","level":"7","masked_value":"*******","children":[],"hasParent":true}],"hasParent":true}],"hasParent":true}],"hasParent":true}],"hasParent":true}]}
次のコード例は、 getTree() メソッドを呼び出して、階層的なキーと値のペアの簡略化された JSON オブジェクトを返す方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("9f12a80047352150fd6ce977746d4364")
.query()
.getTree(true, true);
gs.info(JSON.stringify(primarySnapshot));
返される結果:
{
"Development_1": {
"vars": {},
"services": {
"vars": {},
"paymentComponent": {
"applicationSLA": "24x7",
"paymentService": {
"database": {
"backup": {
"dbServer": "db23.paymentx.be"
},
"dbIpAddress": "10.20.40.50",
"dbName": "paymentX_dev2",
"dbPort": "8050",
"dbServer": "db22.paymentx.be",
"dbUserName": "root",
"dbPassword": "*******"
}
}
}
}
}
}
次のコード例は、 getTree() メソッドを呼び出して、ノードメタデータとそのすべての子ノードを含む JSON オブジェクトを返す方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("9f12a80047352150fd6ce977746d4364")
.query()
.getTree(false, true);
gs.info(JSON.stringify(primarySnapshot));
返される結果:
{
"sys_id": "62a0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_deployable",
"main_id": "111673",
"name": "Development_1",
"node_path": "!K<+!K<0!K<1",
"effective_path": "!K<+!K<0!K<1",
"main_id_encoded": "K<1",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "2",
"children": [
{
"sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_folder",
"main_id": "111674",
"name": "vars",
"node_path": "!K<+!K<0!K<1!K<2",
"effective_path": "!K<+!K<0!K<1!K<2",
"main_id_encoded": "K<2",
"node_classifier": "/application/deployables/env:Development/vars",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "2ca1600047352150fd6ce977746d4391",
"type": "sn_cdm_node_linked",
"main_id": "111693",
"name": "services",
"node_path": "!K<+!K<0!K<1!K<G",
"effective_path": "!K<+!K<0!K<1!K<G",
"main_id_encoded": "K<G",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "3",
"children": [
{
"sys_id": "2bb0e0cc47f12150fd6ce977746d43e2",
"type": "sn_cdm_node_folder",
"main_id": "111680",
"name": "vars",
"node_path": "!K<+!K</!K<7!K<8",
"effective_path": "!K<+!K<0!K<1!K<G!K<8",
"main_id_encoded": "K<8",
"node_classifier": "/application/collections/vars",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "ccf1640047352150fd6ce977746d438b",
"type": "sn_cdm_node_component",
"main_id": "111697",
"name": "paymentComponent",
"node_path": "!K<+!K<0!K<1!K<G!K<K",
"effective_path": "!K<+!K<0!K<1!K<G!K<K",
"main_id_encoded": "K<K",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "4",
"children": [
{
"sys_id": "7fd064cc47f12150fd6ce977746d4372",
"type": "sn_cdm_node_cdi",
"main_id": "111682",
"name": "applicationSLA",
"node_path": "!K<+!K<,!K<9!K<:",
"value": "24x7",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<:",
"main_id_encoded": "K<:",
"node_classifier": "/application/components",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "44f1a40047352150fd6ce977746d43dc",
"type": "sn_cdm_node_component",
"main_id": "111698",
"name": "paymentService",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
"main_id_encoded": "K<L",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "5",
"children": [
{
"sys_id": "8cf1a40047352150fd6ce977746d43dc",
"type": "sn_cdm_node_component",
"main_id": "111699",
"name": "database",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
"main_id_encoded": "K<M",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "6",
"children": [
{
"sys_id": "b3d064cc47f12150fd6ce977746d4374",
"type": "sn_cdm_node_component",
"main_id": "111685",
"name": "backup",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<?",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?",
"main_id_encoded": "K<?",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [
{
"sys_id": "7bd064cc47f12150fd6ce977746d4374",
"type": "sn_cdm_node_cdi",
"main_id": "111686",
"name": "dbServer",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<?!K<@",
"value": "db23.paymentx.be",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?!K<@",
"main_id_encoded": "K<@",
"node_classifier": "/application/components",
"status": "valid",
"level": "6",
"children": [],
"hasParent": true
}
],
"hasParent": true
},
{
"sys_id": "33d064cc47f12150fd6ce977746d4375",
"type": "sn_cdm_node_cdi",
"main_id": "111687",
"name": "dbIpAddress",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<A",
"value": "10.20.40.50",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<A",
"main_id_encoded": "K<A",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "f7d064cc47f12150fd6ce977746d4375",
"type": "sn_cdm_node_cdi",
"main_id": "111688",
"name": "dbName",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<B",
"value": "paymentX_dev2",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<B",
"main_id_encoded": "K<B",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "77d064cc47f12150fd6ce977746d4376",
"type": "sn_cdm_node_cdi",
"main_id": "111690",
"name": "dbPort",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<D",
"value": "8050",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<D",
"main_id_encoded": "K<D",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "3fd064cc47f12150fd6ce977746d4376",
"type": "sn_cdm_node_cdi",
"main_id": "111691",
"name": "dbServer",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<E",
"value": "db22.paymentx.be",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<E",
"main_id_encoded": "K<E",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "f3d064cc47f12150fd6ce977746d4377",
"type": "sn_cdm_node_cdi",
"main_id": "111692",
"name": "dbUserName",
"node_path": "!K<+!K<,!K<9!K<;!K<<!K<F",
"value": "root",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<F",
"main_id_encoded": "K<F",
"node_classifier": "/application/components",
"status": "valid",
"level": "5",
"children": [],
"hasParent": true
},
{
"sys_id": "c4f1a40047352150fd6ce977746d43dd",
"type": "sn_cdm_node_cdi",
"main_id": "111700",
"name": "dbPassword",
"node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
"secure_value": "dac329a2476c6110fd6ce977746d43e11w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=",
"effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
"main_id_encoded": "K<N",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "7",
"masked_value": "*******",
"children": [],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
]
}
CdmQuery - getValue (文字列フィールド名)
現在の反復ノードの結果の指定されたフィールドの値を返します。
| 名前 | タイプ | 説明 |
|---|---|---|
| fieldName | 文字列 | 返されるスナップショットレコードを持つフィールドの名前。 |
| タイプ | 説明 |
|---|---|
| なし |
次のコード例は、 getValue() メソッドを使用して必要なデータを抽出する方法を示しています。
var cdmQuery = new sn_cdm.CdmQuery()
.snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
.decryptPassword(true)
.query();
var output = [];
while(cdmQuery.next()) {
var name = cdmQuery.getValue('name');
var type = cdmQuery.getValue('type');
if (type == 'sg_cdm_node_cdi' || type == 'sg_cdm_node_variable') {
var value = cdmQuery.getValue('value');
output.push(gs.getMessage("{0} : {1} [{2}]", [name, value, type]));
} else {
output.push(gs.getMessage("{0} [{1}]", [name, type]));
}
}
戻り値:
[
"test_login_service [sg_cdm_node_deployable]",
"vars [sg_cdm_node_folder]",
"service_password : service12345 [sg_cdm_node_variable]",
"login_service [sg_cdm_node_linked]",
"vars [sg_cdm_node_folder]",
"core_component [sg_cdm_node_component]",
"user_name : admin [sg_cdm_node_cdi]",
"user_password : service12345 [sg_cdm_node_cdi]"
]
CdmQuery - includeFileMetadata()
ファイルノードのファイルメタデータ情報をフェッチするかどうかを指定できます。ファイルのメタデータには、attachment_id、file_name、content_type、およびチェックサムが含まれています。
| 名前 | タイプ | 説明 |
|---|---|---|
| なし |
| タイプ | 説明 |
|---|---|
| なし |
次のコード例は、 CdmQuery() API を呼び出し、ファイルのメタデータ情報を返す方法を示しています。
var cdmQuery = new CdmQuery()
.snapshotId("20c365a2476c6110fd6ce977746d4336")
.includeFileMetadata()
.query()
.getTree(false, true);
返される内容:
{
"sys_id": "62a0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_deployable",
"main_id": "111673",
"name": "Development_1",
"node_path": "!K<+!K<0!K<1",
"effective_path": "!K<+!K<0!K<1",
"main_id_encoded": "K<1",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "2",
"children": [
{
"sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
"type": "sn_cdm_node_folder",
"main_id": "111674",
"name": "vars",
"node_path": "!K<+!K<0!K<1!K<2",
"effective_path": "!K<+!K<0!K<1!K<2",
"main_id_encoded": "K<2",
"node_classifier": "/application/deployables/env:Development/vars",
"status": "valid",
"level": "3",
"children": [],
"hasParent": true
},
{
"sys_id": "b83eb65fffdf6110f0ccffffffffff7d",
"type": "sn_cdm_node_file",
"main_id": "111675",
"name": "deploy_config.xml",
"node_path": "!K<+!K<0!K<1!K<G",
"value": "file: http://instance.servicenow.com/sys_attachment.do?sys_id=bc3eb65fffdf6110f0ccffffffffff7d",
"effective_path": "!K<+!K<0!K<1!K<G",
"main_id_encoded": "V",
"node_classifier": "/application/deployables/env:Development",
"status": "valid",
"level": "3",
"file_metadata": {
"attachment_id": "bc3eb65fffdf6110f0ccffffffffff7d",
"file_name": "deploy_config.xml",
"content_type": "application/xml",
"checksum": "UbWkF5HZOQTQ89bFrqyFBg=="
},
"children": [],
"hasParent": true
}
]
}
CdmQuery - 次の()
次のノードの結果まで反復処理し、存在する場合はそれを返します。
| 名前 | タイプ | 説明 |
|---|---|---|
| なし |
| タイプ | 説明 |
|---|---|
| CdmQuery | 利用可能な場合は、次のノードの CdmQuery オブジェクト。 使用可能な追加のノードがない場合は、null または undefined を返します。 |
次のコード例は、 next() メソッドが使用可能なノードを反復処理する方法を示しています。
var cdmQuery = new sn_cdm.CdmQuery()
.snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
.decryptPassword(true)
.query();
var output = [];
while(cdmQuery.next()) {
var name = cdmQuery.getValue('name');
var type = cdmQuery.getValue('type');
if (type == 'sg_cdm_node_cdi' || type == 'sg_cdm_node_variable') {
var value = cdmQuery.getValue('value');
output.push(gs.getMessage("{0} : {1} [{2}]", [name, value, type]));
} else {
output.push(gs.getMessage("{0} [{1}]", [name, type]));
}
}
返される結果:
[
"test_login_service [sg_cdm_node_deployable]",
"vars [sg_cdm_node_folder]",
"service_password : service12345 [sg_cdm_node_variable]",
"login_service [sg_cdm_node_linked]",
"vars [sg_cdm_node_folder]",
"core_component [sg_cdm_node_component]",
"user_name : username [sg_cdm_node_cdi]",
"user_password : service12345 [sg_cdm_node_cdi]"
]
CdmQuery - query()
設定、入力ノード、フィルター設定に基づいて、 CDM データベースまたはキャッシュに対して指定されたクエリを実行します。
| 名前 | タイプ | 説明 |
|---|---|---|
| なし |
| タイプ | 説明 |
|---|---|
| CdmQuery | CdmQuery オブジェクトです。 |
次のコード例は、 CdmQuery() API を呼び出し、クエリする展開可能なスナップショットを指定する方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
.decryptPassword(true)
.query()
.getTree();
返される結果:
{
"_decryptPassword": true,
"sys_id": "d73d6666c3a27010cc0a259d7640dde7",
"type": "sg_cdm_node_deployable",
"main_id": "731",
"name": "test_login_service",
"node_path": "!1+!1/!10",
"effective_path": "!1+!1/!10",
"main_id_encoded": "10",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "9f3d6666c3a27010cc0a259d7640dde7",
"type": "sg_cdm_node_folder",
"main_id": "732",
"name": "vars",
"node_path": "!1+!1/!10!11",
"effective_path": "!1+!1/!10!11",
"main_id_encoded": "11",
"node_classifier": "/application/deployables/dep:test_login_service/vars",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "49dd2e66c3a27010cc0a259d7640ddf9",
"type": "sg_cdm_node_variable",
"main_id": "741",
"name": "service_password",
"node_path": "!1+!1/!10!11!1:",
"value": "service12345",
"effective_path": "!1+!1/!10!11!1:",
"main_id_encoded": "1:",
"node_classifier": "/application/deployables/dep:test_login_service/vars",
"status": "valid",
"children": [],
"hasParent": true
}
],
"hasParent": true
},
{
"_decryptPassword": true,
"sys_id": "26bd2e66c3a27010cc0a259d7640dd74",
"type": "sg_cdm_node_linked",
"main_id": "740",
"name": "login_service",
"node_path": "!1+!1/!10!19",
"effective_path": "!1+!1/!10!19",
"main_id_encoded": "19",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "eeadea66c3a27010cc0a259d7640dd8c",
"type": "sg_cdm_node_folder",
"main_id": "738",
"name": "vars",
"node_path": "!1+!1.!16!17",
"effective_path": "!1+!1/!10!19!17",
"main_id_encoded": "17",
"node_classifier": "/application/collections/vars",
"status": "valid",
"children": [],
"hasParent": true
},
{
"_decryptPassword": true,
"sys_id": "da1f22e6c3a27010cc0a259d7640dda2",
"type": "sg_cdm_node_component",
"main_id": "742",
"name": "core_component",
"node_path": "!1+!1/!10!19!1;",
"effective_path": "!1+!1/!10!19!1;",
"main_id_encoded": "1;",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "921f22e6c3a27010cc0a259d7640dda3",
"type": "sg_cdm_node_cdi",
"main_id": "743",
"name": "user_name",
"node_path": "!1+!1/!10!19!1;!1<",
"value": "admin",
"effective_path": "!1+!1/!10!19!1;!1<",
"main_id_encoded": "1<",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [],
"hasParent": true
},
{
"_decryptPassword": true,
"sys_id": "5a1f22e6c3a27010cc0a259d7640dda3",
"type": "sg_cdm_node_cdi",
"main_id": "744",
"name": "user_password",
"node_path": "!1+!1/!10!19!1;!1?",
"value": "service12345",
"effective_path": "!1+!1/!10!19!1;!1?",
"main_id_encoded": "1?",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": false
}
CdmQuery - snapshotId(文字列 snapshotSysID)
入力ノードを指定します。CdmQuery API は、そのクエリをエントリ ノードとその子孫ノードに制限します。このメソッドの呼び出しは必須です。
| 名前 | タイプ | 説明 |
|---|---|---|
| スナップショット SysID | 文字列 | クエリする展開可能スナップショットのSys_id。CDM スナップショット [sn_cdm_snapshot] テーブルにあります。 内部的には、変更セットのsys_idと展開可能なノードのsys_idを設定します。 |
| タイプ | 説明 |
|---|---|
| なし |
次のコード例は、 CdmQuery() API を呼び出し、クエリする展開可能なスナップショットを指定する方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
.decryptPassword(true)
.query()
.getTree();
返される結果:
{
"_decryptPassword": true,
"sys_id": "d73d6666c3a27010cc0a259d7640dde7",
"type": "sg_cdm_node_deployable",
"main_id": "731",
"name": "test_login_service",
"node_path": "!1+!1/!10",
"effective_path": "!1+!1/!10",
"main_id_encoded": "10",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "9f3d6666c3a27010cc0a259d7640dde7",
"type": "sg_cdm_node_folder",
"main_id": "732",
"name": "vars",
"node_path": "!1+!1/!10!11",
"effective_path": "!1+!1/!10!11",
"main_id_encoded": "11",
"node_classifier": "/application/deployables/dep:test_login_service/vars",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "49dd2e66c3a27010cc0a259d7640ddf9",
"type": "sg_cdm_node_variable",
"main_id": "741",
"name": "service_password",
"node_path": "!1+!1/!10!11!1:",
"value": "service12345",
"effective_path": "!1+!1/!10!11!1:",
"main_id_encoded": "1:",
"node_classifier": "/application/deployables/dep:test_login_service/vars",
"status": "valid",
"children": [],
"hasParent": true
}
],
"hasParent": true
},
{
"_decryptPassword": true,
"sys_id": "26bd2e66c3a27010cc0a259d7640dd74",
"type": "sg_cdm_node_linked",
"main_id": "740",
"name": "login_service",
"node_path": "!1+!1/!10!19",
"effective_path": "!1+!1/!10!19",
"main_id_encoded": "19",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "eeadea66c3a27010cc0a259d7640dd8c",
"type": "sg_cdm_node_folder",
"main_id": "738",
"name": "vars",
"node_path": "!1+!1.!16!17",
"effective_path": "!1+!1/!10!19!17",
"main_id_encoded": "17",
"node_classifier": "/application/collections/vars",
"status": "valid",
"children": [],
"hasParent": true
},
{
"_decryptPassword": true,
"sys_id": "da1f22e6c3a27010cc0a259d7640dda2",
"type": "sg_cdm_node_component",
"main_id": "742",
"name": "core_component",
"node_path": "!1+!1/!10!19!1;",
"effective_path": "!1+!1/!10!19!1;",
"main_id_encoded": "1;",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [
{
"_decryptPassword": true,
"sys_id": "921f22e6c3a27010cc0a259d7640dda3",
"type": "sg_cdm_node_cdi",
"main_id": "743",
"name": "user_name",
"node_path": "!1+!1/!10!19!1;!1<",
"value": "admin",
"effective_path": "!1+!1/!10!19!1;!1<",
"main_id_encoded": "1<",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [],
"hasParent": true
},
{
"_decryptPassword": true,
"sys_id": "5a1f22e6c3a27010cc0a259d7640dda3",
"type": "sg_cdm_node_cdi",
"main_id": "744",
"name": "user_password",
"node_path": "!1+!1/!10!19!1;!1?",
"value": "service12345",
"effective_path": "!1+!1/!10!19!1;!1?",
"main_id_encoded": "1?",
"node_classifier": "/application/deployables/dep:test_login_service",
"status": "valid",
"children": [],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": true
}
],
"hasParent": false
}
CdmQuery - substituteVariable(ブール値置換)
構成データ項目 (CDI) ノードの変数参照を参照先の変数ノードの値に置き換えるかどうかを指定できます。
| 名前 | タイプ | 説明 |
|---|---|---|
| 代える | ブーリアン | オプション。CDI ノードの変数参照を参照先の変数ノードの値に置き換えるかどうかを示すフラグ。 有効な値:
デフォルト:true |
| タイプ | 説明 |
|---|---|
| なし |
次のコード例は、CDI ノードで変数参照の置換をオフにする方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("20c365a2476c6110fd6ce977746d4336")
.substituteVariable(false)
.query()
.getTree(true, true);
gs.info(primarySnapshot);
返される結果の例:
{
"paymentService-V1.1": {
"featureToggles": {
"paymentRefund": "enabled",
"myPreferredPaymentMethods": "enabled",
"invoicePrinting": "enabled",
"payOnDelivery": "disabled",
"payByVoucher": "enabled"
},
"vars": {
"paymentService": {
"database": {
"dbName": "paymentX_dev2",
"dbUserName": "root",
"dbPassword": "admin123",
"dbServer": "db22.paymentx.be",
"dbPort": "8050",
"dbIpAddress": "10.20.40.50",
"backup": {
"dbServer": "db23.paymentx.be"
}
}
},
"applicationSLA": "24x7"
},
"settings": {
"merchantId": "10334",
"paymentMethods": "1,3,5,6",
"allowed.billing.countries": "74,76,88,136,139,176,197",
"creditcards.cacf.type.ids": "43,44,45,46,48,49,50",
"creditcards.oney.type.ids": "33,34,35",
"included.availabilityids": "999",
"included.warrantiestypeids.cacf": "19002,19005,19006,19009,19010,19011,19014,19016",
"dbIPAddress": "@@paymentService/database/dbIpAddress@@",
"dbPort": "@@paymentService/database/dbPort@@",
"dbConnectionString": "@@paymentService/database/dbUserName@@:@@paymentService/database/dbPassword@@ @@paymentService/database/dbServer@@:@@paymentService/database/dbPort@@ @@paymentService/database/dbName@@",
"dbConnectionStringBackup": "@@paymentService/database/dbUserName@@:@@paymentService/database/dbPassword@@ @@paymentService/database/backup/dbServer@@ @@paymentService/database/dbName@@",
"paypal": "enabled",
"applePay": "disabled",
"ogone": "enabled"
}
}
}
次のコード例は、CDI ノードの変数参照の置換と、同じレコードに関連する戻り結果をオンにする方法を示しています。
var primarySnapshot = new sn_cdm.CdmQuery()
.snapshotId("20c365a2476c6110fd6ce977746d4336")
.substituteVariable(true)
.query()
.getTree(false, true);
gs.info(primarySnapshot);
返される結果の例:
{
"paymentService-V1.1": {
"featureToggles": {
"paymentRefund": "enabled",
"myPreferredPaymentMethods": "enabled",
"invoicePrinting": "enabled",
"payOnDelivery": "disabled",
"payByVoucher": "enabled"
},
"vars": {
"paymentService": {
"database": {
"dbName": "paymentX_dev2",
"dbUserName": "root",
"dbPassword": "admin123",
"dbServer": "db22.paymentx.be",
"dbPort": "8050",
"dbIpAddress": "10.20.40.50",
"backup": {
"dbServer": "db23.paymentx.be"
}
}
},
"applicationSLA": "24x7"
},
"settings": {
"merchantId": "10334",
"paymentMethods": "1,3,5,6",
"allowed.billing.countries": "74,76,88,136,139,176,197",
"creditcards.cacf.type.ids": "43,44,45,46,48,49,50",
"creditcards.oney.type.ids": "33,34,35",
"included.availabilityids": "999",
"included.warrantiestypeids.cacf": "19002,19005,19006,19009,19010,19011,19014,19016",
"dbIPAddress": "10.20.40.50",
"dbPort": "8050",
"dbConnectionString": "root:admin123 db22.paymentx.be:8050 paymentX_dev2",
"dbConnectionStringBackup": "root:admin123 db23.paymentx.be paymentX_dev2",
"paypal": "enabled",
"applePay": "disabled",
"ogone": "enabled"
}
}
}
CdmQuery - useCache(ブール useCache)
データベースにクエリを実行する代わりに、キャッシュからデータを取得するかどうかを指定できます。
| 名前 | タイプ | 説明 |
|---|---|---|
| useCache | ブーリアン | オプション。データベースに対してクエリを実行する代わりに、キャッシュからデータを取得するかどうかを示すフラグ。 有効な値:
デフォルト:true |
| タイプ | 説明 |
|---|---|
| なし |
次のコード例は、データの取得にキャッシュの使用をオフにする方法を示しています。
var cdmQuery = new sn_cdm.CdmQuery()
.snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
.decryptPassword(true)
.useCache(false)
.query();