use of org.thingsboard.server.common.data.id.EntityId in project thingsboard by thingsboard.
the class BaseAlarmService method updateRelations.
private void updateRelations(Alarm alarm, AlarmStatus oldStatus, AlarmStatus newStatus) {
try {
List<EntityRelation> relations = relationService.findByToAsync(alarm.getId(), RelationTypeGroup.ALARM).get();
Set<EntityId> parents = relations.stream().map(EntityRelation::getFrom).collect(Collectors.toSet());
for (EntityId parentId : parents) {
updateAlarmRelation(parentId, alarm.getId(), oldStatus, newStatus);
}
} catch (ExecutionException | InterruptedException e) {
log.warn("[{}] Failed to update relations. Old status: [{}], New status: [{}]", alarm.getId(), oldStatus, newStatus);
throw new RuntimeException(e);
}
}
use of org.thingsboard.server.common.data.id.EntityId in project thingsboard by thingsboard.
the class JpaBaseEventDaoTest method getEvent.
private Event getEvent(UUID eventId, UUID tenantId, UUID entityId) {
Event event = new Event();
event.setId(new EventId(eventId));
event.setTenantId(new TenantId(tenantId));
EntityId deviceId = new DeviceId(entityId);
event.setEntityId(deviceId);
event.setUid(event.getId().getId().toString());
event.setType(STATS);
ObjectMapper mapper = new ObjectMapper();
try {
JsonNode jsonNode = mapper.readTree("{\"key\":\"value\"}");
event.setBody(jsonNode);
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return event;
}
Aggregations