JpaAlarmDao debug log added
This commit is contained in:
parent
cb81c00057
commit
094f840f11
@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
import org.thingsboard.server.common.data.id.AlarmId;
|
import org.thingsboard.server.common.data.id.AlarmId;
|
||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
import org.thingsboard.server.common.data.id.EntityId;
|
import org.thingsboard.server.common.data.id.EntityId;
|
||||||
@ -53,9 +54,12 @@ public class AlarmCreateOrUpdateActiveRequest implements AlarmModificationReques
|
|||||||
private long startTs;
|
private long startTs;
|
||||||
@Schema(description = "Timestamp of the alarm end time(last time update), in milliseconds", example = "1634111163522")
|
@Schema(description = "Timestamp of the alarm end time(last time update), in milliseconds", example = "1634111163522")
|
||||||
private long endTs;
|
private long endTs;
|
||||||
|
|
||||||
|
@ToString.Exclude
|
||||||
@NoXss
|
@NoXss
|
||||||
@Schema(description = "JSON object with alarm details")
|
@Schema(description = "JSON object with alarm details")
|
||||||
private JsonNode details;
|
private JsonNode details;
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
@Schema(description = "JSON object with propagation details")
|
@Schema(description = "JSON object with propagation details")
|
||||||
private AlarmPropagationInfo propagation;
|
private AlarmPropagationInfo propagation;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
import org.thingsboard.server.common.data.id.AlarmId;
|
import org.thingsboard.server.common.data.id.AlarmId;
|
||||||
import org.thingsboard.server.common.data.id.TenantId;
|
import org.thingsboard.server.common.data.id.TenantId;
|
||||||
import org.thingsboard.server.common.data.id.UserId;
|
import org.thingsboard.server.common.data.id.UserId;
|
||||||
@ -47,9 +48,12 @@ public class AlarmUpdateRequest implements AlarmModificationRequest {
|
|||||||
private long startTs;
|
private long startTs;
|
||||||
@Schema(description = "Timestamp of the alarm end time(last time update), in milliseconds", example = "1634111163522")
|
@Schema(description = "Timestamp of the alarm end time(last time update), in milliseconds", example = "1634111163522")
|
||||||
private long endTs;
|
private long endTs;
|
||||||
|
|
||||||
|
@ToString.Exclude
|
||||||
@NoXss
|
@NoXss
|
||||||
@Schema(description = "JSON object with alarm details")
|
@Schema(description = "JSON object with alarm details")
|
||||||
private JsonNode details;
|
private JsonNode details;
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
@Schema(description = "JSON object with propagation details")
|
@Schema(description = "JSON object with propagation details")
|
||||||
private AlarmPropagationInfo propagation;
|
private AlarmPropagationInfo propagation;
|
||||||
|
|||||||
@ -342,9 +342,12 @@ public class JpaAlarmDao extends JpaAbstractDao<AlarmEntity, Alarm> implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlarmApiCallResult createOrUpdateActiveAlarm(AlarmCreateOrUpdateActiveRequest request, boolean alarmCreationEnabled) {
|
public AlarmApiCallResult createOrUpdateActiveAlarm(AlarmCreateOrUpdateActiveRequest request, boolean alarmCreationEnabled) {
|
||||||
|
UUID tenantUUID = request.getTenantId().getId();
|
||||||
|
log.debug("[{}] createOrUpdateActiveAlarm [{}] {}", tenantUUID, alarmCreationEnabled, request);
|
||||||
|
|
||||||
AlarmPropagationInfo ap = getSafePropagationInfo(request.getPropagation());
|
AlarmPropagationInfo ap = getSafePropagationInfo(request.getPropagation());
|
||||||
return toAlarmApiResult(alarmRepository.createOrUpdateActiveAlarm(
|
return toAlarmApiResult(alarmRepository.createOrUpdateActiveAlarm(
|
||||||
request.getTenantId().getId(),
|
tenantUUID,
|
||||||
request.getCustomerId() != null ? request.getCustomerId().getId() : CustomerId.NULL_UUID,
|
request.getCustomerId() != null ? request.getCustomerId().getId() : CustomerId.NULL_UUID,
|
||||||
request.getEdgeAlarmId() != null ? request.getEdgeAlarmId().getId() : UUID.randomUUID(),
|
request.getEdgeAlarmId() != null ? request.getEdgeAlarmId().getId() : UUID.randomUUID(),
|
||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
@ -364,10 +367,14 @@ public class JpaAlarmDao extends JpaAbstractDao<AlarmEntity, Alarm> implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlarmApiCallResult updateAlarm(AlarmUpdateRequest request) {
|
public AlarmApiCallResult updateAlarm(AlarmUpdateRequest request) {
|
||||||
|
UUID tenantUUID = request.getTenantId().getId();
|
||||||
|
UUID alarmUUID = request.getAlarmId().getId();
|
||||||
|
log.debug("[{}][{}] updateAlarm {}", tenantUUID, alarmUUID, request);
|
||||||
|
|
||||||
AlarmPropagationInfo ap = getSafePropagationInfo(request.getPropagation());
|
AlarmPropagationInfo ap = getSafePropagationInfo(request.getPropagation());
|
||||||
return toAlarmApiResult(alarmRepository.updateAlarm(
|
return toAlarmApiResult(alarmRepository.updateAlarm(
|
||||||
request.getTenantId().getId(),
|
tenantUUID,
|
||||||
request.getAlarmId().getId(),
|
alarmUUID,
|
||||||
request.getSeverity().name(),
|
request.getSeverity().name(),
|
||||||
request.getStartTs(), request.getEndTs(),
|
request.getStartTs(), request.getEndTs(),
|
||||||
getDetailsAsString(request.getDetails()),
|
getDetailsAsString(request.getDetails()),
|
||||||
@ -380,11 +387,13 @@ public class JpaAlarmDao extends JpaAbstractDao<AlarmEntity, Alarm> implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlarmApiCallResult acknowledgeAlarm(TenantId tenantId, AlarmId id, long ackTs) {
|
public AlarmApiCallResult acknowledgeAlarm(TenantId tenantId, AlarmId id, long ackTs) {
|
||||||
|
log.debug("[{}][{}] acknowledgeAlarm [{}]", tenantId, id, ackTs);
|
||||||
return toAlarmApiResult(alarmRepository.acknowledgeAlarm(tenantId.getId(), id.getId(), ackTs));
|
return toAlarmApiResult(alarmRepository.acknowledgeAlarm(tenantId.getId(), id.getId(), ackTs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlarmApiCallResult clearAlarm(TenantId tenantId, AlarmId id, long clearTs, JsonNode details) {
|
public AlarmApiCallResult clearAlarm(TenantId tenantId, AlarmId id, long clearTs, JsonNode details) {
|
||||||
|
log.debug("[{}][{}] clearAlarm [{}]", tenantId, id, clearTs);
|
||||||
return toAlarmApiResult(alarmRepository.clearAlarm(tenantId.getId(), id.getId(), clearTs, details != null ? getDetailsAsString(details) : null));
|
return toAlarmApiResult(alarmRepository.clearAlarm(tenantId.getId(), id.getId(), clearTs, details != null ? getDetailsAsString(details) : null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user