Search in sources :

Example 61 with IdmMonitoringResultDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto in project CzechIdMng by bcvsolutions.

the class MonitoringResultDeleteProcessor method process.

@Override
public EventResult<IdmMonitoringResultDto> process(EntityEvent<IdmMonitoringResultDto> event) {
    IdmMonitoringResultDto monitoringResult = event.getContent();
    // 
    service.deleteInternal(monitoringResult);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto)

Example 62 with IdmMonitoringResultDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto in project CzechIdMng by bcvsolutions.

the class MonitoringResultSaveProcessor method process.

@Override
public EventResult<IdmMonitoringResultDto> process(EntityEvent<IdmMonitoringResultDto> event) {
    IdmMonitoringResultDto entity = event.getContent();
    entity = service.saveInternal(entity);
    event.setContent(entity);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto)

Example 63 with IdmMonitoringResultDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto 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);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

IdmMonitoringResultDto (eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto)63 IdmMonitoringDto (eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto)47 Test (org.junit.Test)39 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)21 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)18 IdmMonitoringResultFilter (eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringResultFilter)13 UUID (java.util.UUID)13 ResultModel (eu.bcvsolutions.idm.core.api.dto.ResultModel)12 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)12 DefaultResultModel (eu.bcvsolutions.idm.core.api.dto.DefaultResultModel)10 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)7 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)6 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)6 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)6 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)6 SysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncConfigDto)5 AbstractReadWriteDtoControllerRestTest (eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest)5 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)5 SysSyncActionLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto)4 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)4