use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class EntityEventDeleteProcessor method process.
@Override
public EventResult<IdmEntityEventDto> process(EntityEvent<IdmEntityEventDto> event) {
IdmEntityEventDto role = event.getContent();
//
service.deleteInternal(role);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class EntityEventExecuteProcessor method process.
@Override
public EventResult<IdmEntityEventDto> process(EntityEvent<IdmEntityEventDto> event) {
IdmEntityEventDto entityEvent = event.getContent();
//
EntityEvent<Identifiable> resurectedEvent;
try {
resurectedEvent = entityEventManager.toEvent(entityEvent);
// execute
EventContext<Identifiable> context = entityEventManager.process(resurectedEvent);
entityEvent.setProcessedOrder(context.getProcessedOrder());
entityEvent.setResult(new OperationResultDto.Builder(OperationState.EXECUTED).build());
} catch (EventContentDeletedException ex) {
// content was deleted - log state
LOG.warn("Event content was deleted, event cannot be executed.", ex);
entityEvent.setResult(new OperationResultDto.Builder(// it's expected ex, lower level
OperationState.NOT_EXECUTED).setException(ex).build());
}
//
event.setContent(entityEvent);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class EntityStateDeleteProcessor method process.
@Override
public EventResult<IdmEntityStateDto> process(EntityEvent<IdmEntityStateDto> event) {
IdmEntityStateDto entityState = event.getContent();
//
service.deleteInternal(entityState);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class AbstractIdentityPasswordProcessor method process.
@Override
public EventResult<IdmIdentityDto> process(EntityEvent<IdmIdentityDto> event) {
IdmIdentityDto identity = event.getContent();
PasswordChangeDto passwordChangeDto = (PasswordChangeDto) event.getProperties().get(PROPERTY_PASSWORD_CHANGE_DTO);
Assert.notNull(passwordChangeDto);
//
if (passwordChangeDto.isIdm()) {
// change identity's password
savePassword(identity, passwordChangeDto);
Map<String, Object> parameters = new LinkedHashMap<>();
parameters.put("account", new IdmAccountDto(identity.getId(), true, identity.getUsername()));
return new DefaultEventResult.Builder<>(event, this).setResult(new OperationResult.Builder(OperationState.EXECUTED).setModel(new DefaultResultModel(CoreResultCode.PASSWORD_CHANGE_ACCOUNT_SUCCESS, parameters)).build()).build();
}
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class IdentityAutomaticRoleProcessor method process.
@Override
public EventResult<IdmIdentityDto> process(EntityEvent<IdmIdentityDto> event) {
//
IdmIdentityDto identity = event.getContent();
UUID identityId = identity.getId();
//
AutomaticRoleAttributeRuleType type = AutomaticRoleAttributeRuleType.IDENTITY;
if (CoreEventType.EAV_SAVE.name().equals(event.getProperties().get(EntityEventManager.EVENT_PROPERTY_PARENT_EVENT_TYPE))) {
type = AutomaticRoleAttributeRuleType.IDENTITY_EAV;
}
//
for (IdmIdentityContractDto contract : identityContractService.findAllByIdentity(identityId)) {
UUID contractId = contract.getId();
Set<AbstractIdmAutomaticRoleDto> allNewPassedAutomaticRoleForContract = automaticRoleAttributeService.getRulesForContract(true, type, contractId);
Set<AbstractIdmAutomaticRoleDto> allNotPassedAutomaticRoleForContract = automaticRoleAttributeService.getRulesForContract(false, type, contractId);
automaticRoleAttributeService.processAutomaticRolesForContract(contractId, allNewPassedAutomaticRoleForContract, allNotPassedAutomaticRoleForContract);
}
//
return new DefaultEventResult<>(event, this);
}
Aggregations