メインコンテンツまでスキップ

9. Path サービス

client.path() でアクセスします。資産またはタグの階層パス(Site > Area > Line > Equipment)を 1 回の呼び出しで取得できます。

9.1 メソッド一覧

メソッド戻り値の型HTTPエンドポイント
getByAsset(asset_id)PathResponseV5 または nullGET/api/v5/path/asset/{id}
getByTag(tag_id)PathResponseV5 または nullGET/api/v5/path/tag/{id}

9.2 PathResponseV5 DTO

フィールド説明
site_id / site_name所属サイト
area_id / area_nameエリア
line_id / line_nameライン
equipment_id / equipment_name設備

資産タイプによって一部のフィールドは null になる場合があります(例:Area のみを持つ資産では line_*equipment_* がいずれも null)。

9.3 使用例

設備の全体パス

import plantpulse.api.v5.dto.response.PathResponseV5;

PathResponseV5 path = client.path().getByAsset("ASSET_DJ_M_0001");
if (path != null) {
System.out.printf("%s > %s > %s > %s%n",
path.getSite_name(),
path.getArea_name(),
path.getLine_name(),
path.getEquipment_name());
}

出力例:

대전 1공장 > 조립구역 > 1라인 > CNC #1

タグの資産パス

PathResponseV5 tagPath = client.path().getByTag("TAG_EDGE_00303_90007");
if (tagPath != null) {
System.out.println("태그가 부착된 설비: " + tagPath.getEquipment_name());
System.out.println("라인: " + tagPath.getLine_name());
}

パス文字列生成ユーティリティ

static String formatPath(PathResponseV5 p) {
if (p == null) return "(경로 없음)";
StringBuilder sb = new StringBuilder();
if (p.getSite_name() != null) sb.append(p.getSite_name());
if (p.getArea_name() != null) sb.append(" > ").append(p.getArea_name());
if (p.getLine_name() != null) sb.append(" > ").append(p.getLine_name());
if (p.getEquipment_name() != null) sb.append(" > ").append(p.getEquipment_name());
return sb.toString();
}

9.4 活用シナリオ

シナリオ — アラーム発生資産のパス表示

import plantpulse.api.v5.dto.response.AlarmResponseV5;

for (AlarmResponseV5 a : client.alarm().list(20)) {
// AlarmResponseV5 에 tag_location 필드가 이미 있지만
// 더 구조화된 경로가 필요하면 Path 서비스로 재조회
if (a.getTag_id() != null) {
PathResponseV5 path = client.path().getByTag(a.getTag_id());
System.out.printf("[%s] %s @ %s%n",
a.getPriority(),
a.getDescription(),
formatPath(path));
}
}

次のステップ