9. Path-Service
Der Zugriff erfolgt über client.path(). Der Hierarchiepfad (Site > Area > Line > Equipment) eines Assets oder Tags lässt sich mit einem einzigen Aufruf abfragen.
9.1 Methodenübersicht
| Methode | Rückgabetyp | HTTP | Endpunkt |
|---|---|---|---|
getByAsset(asset_id) | PathResponseV5 oder null | GET | /api/v5/path/asset/{id} |
getByTag(tag_id) | PathResponseV5 oder null | GET | /api/v5/path/tag/{id} |
9.2 PathResponseV5 DTO
| Feld | Beschreibung |
|---|---|
site_id / site_name | Zugehörige Site |
area_id / area_name | Bereich |
line_id / line_name | Linie |
equipment_id / equipment_name | Anlage |
Je nach Asset-Typ können einzelne Felder
nullsein (z. B. sind bei einem Asset, das nur eine Area besitzt,line_*undequipment_*jeweilsnull).
9.3 Anwendungsbeispiele
Vollständiger Pfad einer Anlage
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());
}
Beispielausgabe:
대전 1공장 > 조립구역 > 1라인 > CNC #1
Asset-Pfad eines Tags
PathResponseV5 tagPath = client.path().getByTag("TAG_EDGE_00303_90007");
if (tagPath != null) {
System.out.println("태그가 부착된 설비: " + tagPath.getEquipment_name());
System.out.println("라인: " + tagPath.getLine_name());
}
Hilfsfunktion zum Erzeugen des Pfad-Strings
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 Einsatzszenarien
Szenario — Pfad des Assets mit ausgelöstem Alarm anzeigen
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));
}
}
Nächste Schritte
- Asset-Service — Asset-Hierarchie direkt bearbeiten
- Alarm-Service — Assets mit ausgelösten Alarmen nachverfolgen