9. Path 서비스
client.path() 으로 접근합니다. 자산 또는 태그의 계층 경로(Site > Area > Line > Equipment)를 한 번의 호출로 조회할 수 있습니다.
9.1 메서드 일람
| 메서드 | 반환 타입 | HTTP | 엔드포인트 |
|---|---|---|---|
getByAsset(asset_id) | PathResponseV5 또는 null | GET | /api/v5/path/asset/{id} |
getByTag(tag_id) | PathResponseV5 또는 null | GET | /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));
}
}