Search in sources :

Example 1 with AlarmId

use of org.thingsboard.server.common.data.alarm.AlarmId in project thingsboard by thingsboard.

the class AlarmEntity method toData.

@Override
public Alarm toData() {
    Alarm alarm = new Alarm(new AlarmId(UUIDConverter.fromString(id)));
    alarm.setCreatedTime(UUIDs.unixTimestamp(UUIDConverter.fromString(id)));
    if (tenantId != null) {
        alarm.setTenantId(new TenantId(UUIDConverter.fromString(tenantId)));
    }
    alarm.setOriginator(EntityIdFactory.getByTypeAndUuid(originatorType, UUIDConverter.fromString(originatorId)));
    alarm.setType(type);
    alarm.setSeverity(severity);
    alarm.setStatus(status);
    alarm.setPropagate(propagate);
    alarm.setStartTs(startTs);
    alarm.setEndTs(endTs);
    alarm.setAckTs(ackTs);
    alarm.setClearTs(clearTs);
    alarm.setDetails(details);
    return alarm;
}
Also used : AlarmId(org.thingsboard.server.common.data.alarm.AlarmId) TenantId(org.thingsboard.server.common.data.id.TenantId) Alarm(org.thingsboard.server.common.data.alarm.Alarm)

Example 2 with AlarmId

use of org.thingsboard.server.common.data.alarm.AlarmId in project thingsboard by thingsboard.

the class AlarmEntity method toData.

@Override
public Alarm toData() {
    Alarm alarm = new Alarm(new AlarmId(id));
    alarm.setCreatedTime(UUIDs.unixTimestamp(id));
    if (tenantId != null) {
        alarm.setTenantId(new TenantId(tenantId));
    }
    alarm.setOriginator(EntityIdFactory.getByTypeAndUuid(originatorType, originatorId));
    alarm.setType(type);
    alarm.setSeverity(severity);
    alarm.setStatus(status);
    alarm.setPropagate(propagate);
    alarm.setStartTs(startTs);
    alarm.setEndTs(endTs);
    alarm.setAckTs(ackTs);
    alarm.setClearTs(clearTs);
    alarm.setDetails(details);
    return alarm;
}
Also used : AlarmId(org.thingsboard.server.common.data.alarm.AlarmId) TenantId(org.thingsboard.server.common.data.id.TenantId) Alarm(org.thingsboard.server.common.data.alarm.Alarm)

Example 3 with AlarmId

use of org.thingsboard.server.common.data.alarm.AlarmId in project thingsboard by thingsboard.

the class JpaAlarmDaoTest method saveAlarm.

private void saveAlarm(UUID id, UUID tenantId, UUID deviceId, String type) {
    Alarm alarm = new Alarm();
    alarm.setId(new AlarmId(id));
    alarm.setTenantId(new TenantId(tenantId));
    alarm.setOriginator(new DeviceId(deviceId));
    alarm.setType(type);
    alarm.setPropagate(true);
    alarm.setStartTs(System.currentTimeMillis());
    alarm.setEndTs(System.currentTimeMillis());
    alarm.setStatus(AlarmStatus.ACTIVE_UNACK);
    alarmDao.save(alarm);
}
Also used : AlarmId(org.thingsboard.server.common.data.alarm.AlarmId) TenantId(org.thingsboard.server.common.data.id.TenantId) DeviceId(org.thingsboard.server.common.data.id.DeviceId) Alarm(org.thingsboard.server.common.data.alarm.Alarm)

Aggregations

Alarm (org.thingsboard.server.common.data.alarm.Alarm)3 AlarmId (org.thingsboard.server.common.data.alarm.AlarmId)3 TenantId (org.thingsboard.server.common.data.id.TenantId)3 DeviceId (org.thingsboard.server.common.data.id.DeviceId)1