|
|
@ -196,7 +196,7 @@ public class AlarmController extends BaseController { |
|
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
|
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
|
|
@RequestMapping(value = "/alarm/{alarmId}/assign/{assigneeId}", method = RequestMethod.POST) |
|
|
@RequestMapping(value = "/alarm/{alarmId}/assign/{assigneeId}", method = RequestMethod.POST) |
|
|
@ResponseStatus(value = HttpStatus.OK) |
|
|
@ResponseStatus(value = HttpStatus.OK) |
|
|
public void assignAlarm(@ApiParam(value = ALARM_ID_PARAM_DESCRIPTION) |
|
|
public Alarm assignAlarm(@ApiParam(value = ALARM_ID_PARAM_DESCRIPTION) |
|
|
@PathVariable(ALARM_ID) String strAlarmId, |
|
|
@PathVariable(ALARM_ID) String strAlarmId, |
|
|
@ApiParam(value = ASSIGN_ID_PARAM_DESCRIPTION) |
|
|
@ApiParam(value = ASSIGN_ID_PARAM_DESCRIPTION) |
|
|
@PathVariable(ASSIGNEE_ID) String strAssigneeId |
|
|
@PathVariable(ASSIGNEE_ID) String strAssigneeId |
|
|
@ -214,7 +214,7 @@ public class AlarmController extends BaseController { |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw new ThingsboardException("Assignee user doesn't have permission for alarm originator", ThingsboardErrorCode.PERMISSION_DENIED); |
|
|
throw new ThingsboardException("Assignee user doesn't have permission for alarm originator", ThingsboardErrorCode.PERMISSION_DENIED); |
|
|
} |
|
|
} |
|
|
tbAlarmService.assign(alarm, getCurrentUser(), assigneeId).get(); |
|
|
return tbAlarmService.assign(alarm, getCurrentUser(), assigneeId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation(value = "Unassign Alarm (unassignAlarm)", |
|
|
@ApiOperation(value = "Unassign Alarm (unassignAlarm)", |
|
|
@ -224,13 +224,13 @@ public class AlarmController extends BaseController { |
|
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
|
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
|
|
@RequestMapping(value = "/alarm/{alarmId}/assign", method = RequestMethod.DELETE) |
|
|
@RequestMapping(value = "/alarm/{alarmId}/assign", method = RequestMethod.DELETE) |
|
|
@ResponseStatus(value = HttpStatus.OK) |
|
|
@ResponseStatus(value = HttpStatus.OK) |
|
|
public void assignAlarm(@ApiParam(value = ALARM_ID_PARAM_DESCRIPTION) |
|
|
public Alarm assignAlarm(@ApiParam(value = ALARM_ID_PARAM_DESCRIPTION) |
|
|
@PathVariable(ALARM_ID) String strAlarmId |
|
|
@PathVariable(ALARM_ID) String strAlarmId |
|
|
) throws Exception { |
|
|
) throws Exception { |
|
|
checkParameter(ALARM_ID, strAlarmId); |
|
|
checkParameter(ALARM_ID, strAlarmId); |
|
|
AlarmId alarmId = new AlarmId(toUUID(strAlarmId)); |
|
|
AlarmId alarmId = new AlarmId(toUUID(strAlarmId)); |
|
|
Alarm alarm = checkAlarmId(alarmId, Operation.WRITE); |
|
|
Alarm alarm = checkAlarmId(alarmId, Operation.WRITE); |
|
|
tbAlarmService.unassign(alarm, getCurrentUser()).get(); |
|
|
return tbAlarmService.unassign(alarm, getCurrentUser()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation(value = "Get Alarms (getAlarms)", |
|
|
@ApiOperation(value = "Get Alarms (getAlarms)", |
|
|
|