use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class SynchronizationItemProcessor method process.
@Override
public EventResult<SysSyncItemLogDto> process(EntityEvent<SysSyncItemLogDto> event) {
LOG.info("Synchronization item event");
SynchronizationContext itemWrapper = (SynchronizationContext) event.getProperties().get(SynchronizationService.WRAPPER_SYNC_ITEM);
// Do synchronization for one item (produces event)
// Start in new Transaction
boolean result = synchronizationService.doItemSynchronization(itemWrapper);
event.getProperties().put(SynchronizationService.RESULT_SYNC_ITEM, result);
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class SynchronizationStartProcessor method process.
@Override
public EventResult<AbstractSysSyncConfigDto> process(EntityEvent<AbstractSysSyncConfigDto> event) {
LOG.info("Synchronization event start");
AbstractSysSyncConfigDto config = event.getContent();
synchronizationService.startSynchronization(config);
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class ContractGuaranteeSaveProcessor method process.
@Override
public EventResult<IdmContractGuaranteeDto> process(EntityEvent<IdmContractGuaranteeDto> event) {
IdmContractGuaranteeDto dto = event.getContent();
//
dto = contractGuaranteeService.saveInternal(dto);
//
event.setContent(dto);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class IdentityContractAutomaticRoleProcessor method process.
@Override
public EventResult<IdmIdentityContractDto> process(EntityEvent<IdmIdentityContractDto> event) {
IdmIdentityContractDto identityContract = event.getContent();
UUID contractId = identityContract.getId();
//
AutomaticRoleAttributeRuleType type = AutomaticRoleAttributeRuleType.CONTRACT;
// get original event type
if (CoreEventType.EAV_SAVE.name().equals(event.getProperties().get(EntityEventManager.EVENT_PROPERTY_PARENT_EVENT_TYPE))) {
type = AutomaticRoleAttributeRuleType.CONTRACT_EAV;
}
//
// resolve automatic role by attribute
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);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class IdentityContractSaveProcessor method process.
@Override
public EventResult<IdmIdentityContractDto> process(EntityEvent<IdmIdentityContractDto> event) {
IdmIdentityContractDto contract = event.getContent();
contract = service.saveInternal(contract);
event.setContent(contract);
//
// check identity state
IdmIdentityContractDto previousContract = event.getOriginalSource();
IdmIdentityDto identity = DtoUtils.getEmbedded(contract, IdmIdentityContract_.identity.getName(), IdmIdentityDto.class);
if ((identity.getState() == IdentityState.CREATED || identity.isDisabled()) && contractChanged(previousContract, contract)) {
// synchronize identity states, which has no effect on HR processes
identity = identityService.get(contract.getIdentity());
IdentityState newState = identityService.evaluateState(identity.getId());
if (newState.isDisabled() && identity.getState() != newState) {
identity.setState(newState);
// publish new save event for identity with skip recalculation
IdentityEvent identityEvent = new IdentityEvent(IdentityEventType.UPDATE, identity);
identityEvent.getProperties().put(IdmAutomaticRoleAttributeService.SKIP_RECALCULATION, true);
identityService.publish(identityEvent);
}
}
//
return new DefaultEventResult<>(event, this);
}
Aggregations