@Override
    public AlarmApiCallResult createOrUpdateActiveAlarm(AlarmCreateOrUpdateActiveRequest request, boolean alarmCreationEnabled) {
        UUID tenantUUID = request.getTenantId().getId();
        log.debug("[{}] createOrUpdateActiveAlarm [{}] {}", tenantUUID, alarmCreationEnabled, request);

        AlarmPropagationInfo ap = getSafePropagationInfo(request.getPropagation());
        return toAlarmApiResult(alarmRepository.createOrUpdateActiveAlarm(
                tenantUUID,
                request.getCustomerId() != null ? request.getCustomerId().getId() : CustomerId.NULL_UUID,
                request.getEdgeAlarmId() != null ? request.getEdgeAlarmId().getId() : UUID.randomUUID(),
                System.currentTimeMillis(),
                request.getOriginator().getId(),
                request.getOriginator().getEntityType().ordinal(),
                request.getType(),
                request.getSeverity().name(),
                request.getStartTs(), request.getEndTs(),
                getDetailsAsString(request.getDetails()),
                ap.isPropagate(),
                ap.isPropagateToOwner(),
                ap.isPropagateToTenant(),
                getPropagationTypes(ap),
                alarmCreationEnabled
        ));
    }
@Test
    public void testCantCreateAlarmIfCreateIsDisabled() {
        TenantId tenantId = TenantId.fromUUID(UUID.randomUUID());
        DeviceId deviceId = new DeviceId(UUID.randomUUID());

        AlarmCreateOrUpdateActiveRequest request = AlarmCreateOrUpdateActiveRequest.builder()
                .tenantId(tenantId)
                .originator(deviceId)
                .type("ALARM_TYPE")
                .severity(AlarmSeverity.MAJOR)
                .build();
        AlarmApiCallResult result = alarmDao.createOrUpdateActiveAlarm(request, false);
        assertFalse(result.isSuccessful());
    }