|
|
@ -240,31 +240,27 @@ public class EventController extends BaseController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation(value = "Clear Events (clearEvents)", notes = "Clears events for specified entity.") |
|
|
@ApiOperation(value = "Clear Events (clearEvents)", notes = "Clears events by filter for specified entity.") |
|
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") |
|
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") |
|
|
@RequestMapping(value = "/events/{entityType}/{entityId}/clear", method = RequestMethod.POST) |
|
|
@RequestMapping(value = "/events/{entityType}/{entityId}/clear", method = RequestMethod.POST) |
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
public void clearEvents( |
|
|
public void clearEvents(@ApiParam(value = ENTITY_TYPE_PARAM_DESCRIPTION, required = true) |
|
|
@ApiParam(value = ENTITY_TYPE_PARAM_DESCRIPTION, required = true) |
|
|
@PathVariable(ENTITY_TYPE) String strEntityType, |
|
|
@PathVariable(ENTITY_TYPE) String strEntityType, |
|
|
@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) |
|
|
@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) |
|
|
@PathVariable(ENTITY_ID) String strEntityId, |
|
|
@PathVariable(ENTITY_ID) String strEntityId, |
|
|
@ApiParam(value = EVENT_START_TIME_DESCRIPTION) |
|
|
@ApiParam(value = EVENT_START_TIME_DESCRIPTION) |
|
|
@RequestParam(required = false) Long startTime, |
|
|
@RequestParam("tenantId") String strTenantId, |
|
|
@ApiParam(value = EVENT_END_TIME_DESCRIPTION) |
|
|
@ApiParam(value = "A string value representing event type", example = "STATS", required = true) |
|
|
@RequestParam(required = false) Long endTime, |
|
|
@RequestParam(required = false) Long startTime, |
|
|
@ApiParam(value = EVENT_FILTER_DEFINITION) |
|
|
@ApiParam(value = EVENT_END_TIME_DESCRIPTION) |
|
|
@RequestBody EventFilter eventFilter) throws ThingsboardException { |
|
|
@RequestParam(required = false) Long endTime, |
|
|
|
|
|
@RequestBody EventFilter eventFilter) throws ThingsboardException { |
|
|
|
|
|
checkParameter("EntityId", strEntityId); |
|
|
checkParameter("EntityId", strEntityId); |
|
|
checkParameter("EntityType", strEntityType); |
|
|
checkParameter("EntityType", strEntityType); |
|
|
try { |
|
|
try { |
|
|
TenantId tenantId = new TenantId(toUUID(strTenantId)); |
|
|
|
|
|
|
|
|
|
|
|
EntityId entityId = EntityIdFactory.getByTypeAndId(strEntityType, strEntityId); |
|
|
EntityId entityId = EntityIdFactory.getByTypeAndId(strEntityType, strEntityId); |
|
|
checkEntityId(entityId, Operation.DELETE); |
|
|
checkEntityId(entityId, Operation.WRITE); |
|
|
|
|
|
|
|
|
eventService.removeEvents(tenantId, entityId, eventFilter, startTime, endTime); |
|
|
eventService.removeEvents(getTenantId(), entityId, eventFilter, startTime, endTime); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw handleException(e); |
|
|
throw handleException(e); |
|
|
} |
|
|
} |
|
|
|