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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations