Search in sources :

Example 36 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class LogIdentityDeleteProcessor method process.

@Override
public EventResult<IdmIdentityDto> process(EntityEvent<IdmIdentityDto> event) {
    // event content - identity
    IdmIdentityDto deletedIdentity = event.getContent();
    // log
    LOG.info("Identity [{},{}] was deleted.", deletedIdentity.getUsername(), deletedIdentity.getId());
    // result
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Example 37 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class LogIdentityUpdateAsyncProcessor method process.

@Override
public EventResult<IdmIdentityDto> process(EntityEvent<IdmIdentityDto> event) {
    // event content - identity
    IdmIdentityDto updateddIdentity = event.getContent();
    // log
    LOG.info("Identity [{},{}] was updated.", updateddIdentity.getUsername(), updateddIdentity.getId());
    // result
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Example 38 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class ReportGenerateEndProcessor method process.

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

Example 39 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class ReportGenerateEndSendNotificationProcessor method process.

@Override
public EventResult<RptReportDto> process(EntityEvent<RptReportDto> event) {
    RptReportDto report = event.getContent();
    // TODO: can be improved by some configuration (specially for LRT)
    if (report.getCreatorId() != null && report.getResult() != null) {
        boolean success = report.getResult().getState() == OperationState.EXECUTED;
        notificationManager.send(success ? RptModuleDescriptor.TOPIC_REPORT_GENERATE_SUCCESS : RptModuleDescriptor.TOPIC_REPORT_GENERATE_FAILED, new IdmMessageDto.Builder(success ? NotificationLevel.SUCCESS : NotificationLevel.WARNING).addParameter("url", configurationService.getFrontendUrl(String.format("report/reports?id=%s", report.getId()))).addParameter("report", report).setModel(new DefaultResultModel(success ? RptResultCode.REPORT_GENERATE_SUCCESS : RptResultCode.REPORT_GENERATE_FAILED, ImmutableMap.of("reportName", report.getName()))).build(), identityService.get(report.getCreatorId()));
    }
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) RptReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptReportDto)

Example 40 with DefaultEventResult

use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.

the class SystemDeleteProcessor method process.

@Override
public EventResult<SysSystemDto> process(EntityEvent<SysSystemDto> event) {
    SysSystemDto system = event.getContent();
    Assert.notNull(system);
    // 
    // If exists unresolved vs request, then is not possible to delete
    // system
    VsRequestFilter requestFilter = new VsRequestFilter();
    requestFilter.setSystemId(system.getId());
    requestFilter.setState(VsRequestState.IN_PROGRESS);
    if (requestService.find(requestFilter, null).getTotalElements() > 0) {
        throw new ResultCodeException(VsResultCode.VS_SYSTEM_DELETE_FAILED_HAS_REQUEST, ImmutableMap.of("system", system.getName()));
    }
    // Delete archived vs requests
    requestFilter = new VsRequestFilter();
    requestFilter.setSystemId(system.getId());
    requestFilter.setOnlyArchived(Boolean.TRUE);
    requestService.find(requestFilter, null).forEach(entity -> {
        requestService.delete(entity);
    });
    // Delete vs account
    VsAccountFilter accountFilter = new VsAccountFilter();
    accountFilter.setSystemId(system.getId());
    accountService.find(accountFilter, null).forEach(entity -> {
        accountService.delete(entity);
    });
    // Delete vs account form definition
    if (system.getConnectorKey() != null) {
        String virtualSystemKey = MessageFormat.format("{0}:systemId={1}", system.getConnectorKey().getFullName(), system.getId());
        IdmFormDefinitionDto definition = this.formDefinitionService.findOneByTypeAndCode(VsAccount.class.getName(), virtualSystemKey);
        if (definition != null) {
            formDefinitionService.delete(definition);
        }
    }
    // Delete vs implementers
    VsSystemImplementerFilter implementerFilter = new VsSystemImplementerFilter();
    implementerFilter.setSystemId(system.getId());
    systemImplementerService.find(implementerFilter, null).forEach(entity -> {
        systemImplementerService.delete(entity);
    });
    return new DefaultEventResult<>(event, this);
}
Also used : VsAccount(eu.bcvsolutions.idm.vs.entity.VsAccount) VsSystemImplementerFilter(eu.bcvsolutions.idm.vs.dto.filter.VsSystemImplementerFilter) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) VsAccountFilter(eu.bcvsolutions.idm.vs.dto.filter.VsAccountFilter) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) VsRequestFilter(eu.bcvsolutions.idm.vs.dto.filter.VsRequestFilter) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Aggregations

DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)91 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)20 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)12 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)11 UUID (java.util.UUID)11 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)10 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)7 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)7 PasswordChangeDto (eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto)6 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)5 IdmEntityEventDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto)5 IdmPasswordPolicyDto (eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto)5 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)5 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)5 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)4 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)4 DefaultResultModel (eu.bcvsolutions.idm.core.api.dto.DefaultResultModel)4 IdmMessageDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto)4 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)4 ArrayList (java.util.ArrayList)4