use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class MonitoringExecuteAfterSaveProcessor method conditional.
@Override
public boolean conditional(EntityEvent<IdmMonitoringDto> event) {
IdmMonitoringDto monitoring = event.getContent();
ZonedDateTime executeDate = monitoring.getExecuteDate();
//
return super.conditional(event) && // ~ same instance only
configurationService.getInstanceId().equals(monitoring.getInstanceId()) && // ~ from FE only
event.hasPriority(PriorityType.HIGH) && !monitoring.isDisabled() && (executeDate == null || executeDate.isBefore(ZonedDateTime.now()));
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class MonitoringSaveProcessor method process.
@Override
public EventResult<IdmMonitoringDto> process(EntityEvent<IdmMonitoringDto> event) {
IdmMonitoringDto entity = event.getContent();
entity = service.saveInternal(entity);
event.setContent(entity);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class IdmMonitoringResultController method execute.
/**
* Execute related monitoring evaluator with setting from result again synchronously.
*
* @since 11.2.0
*/
@ResponseBody
@RequestMapping(method = RequestMethod.PUT, value = "/{backendId}/execute")
@PreAuthorize("hasAuthority('" + MonitoringGroupPermission.MONITORINGRESULT_EXECUTE + "')")
@ApiOperation(value = "Execute monitoring evaluator", nickname = "executeMonitoring", tags = { IdmMonitoringController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = MonitoringGroupPermission.MONITORINGRESULT_EXECUTE, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = MonitoringGroupPermission.MONITORINGRESULT_EXECUTE, description = "") }) }, notes = "Execute related monitoring evaluator with setting from result again synchronously..")
public ResponseEntity<?> execute(@ApiParam(value = "Monitoring result identifier.", required = true) @PathVariable @NotNull String backendId) {
IdmMonitoringResultDto monitoringResult = getDto(backendId);
if (monitoringResult == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", backendId));
}
IdmMonitoringDto monitoring = getLookupService().lookupEmbeddedDto(monitoringResult, IdmMonitoringResult_.monitoring);
//
monitoring.setEvaluatorProperties(monitoringResult.getEvaluatorProperties());
IdmMonitoringResultDto currentResult = monitoringManager.execute(monitoring, IdmBasePermission.EXECUTE);
// without result
if (currentResult == null) {
new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
// return current result
return new ResponseEntity<>(toResource(currentResult), HttpStatus.CREATED);
}
Aggregations