use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class PasswordPolicySaveProcessor method process.
@Override
public EventResult<IdmPasswordPolicyDto> process(EntityEvent<IdmPasswordPolicyDto> event) {
IdmPasswordPolicyDto dto = event.getContent();
//
if (validatePasswordPolicyAttributes(dto)) {
if (dto.isDefaultPolicy()) {
this.passwordPolicyRepository.updateDefaultPolicyByType(dto.getType(), dto.getId());
}
} else {
throw new ResultCodeException(CoreResultCode.PASSWORD_POLICY_DEFAULT_TYPE, ImmutableMap.of("name", dto.getName()));
}
//
dto = passwordPolicyService.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 AutomaticRoleAttributeRuleConceptProcessor method process.
@Override
public EventResult<IdmAutomaticRoleAttributeRuleDto> process(EntityEvent<IdmAutomaticRoleAttributeRuleDto> event) {
IdmAutomaticRoleAttributeRuleDto dto = event.getContent();
IdmAutomaticRoleAttributeDto automaticRole = automactiRoleAttributeService.get(dto.getAutomaticRoleAttribute());
//
if (automaticRole == null) {
throw new IllegalStateException("Automatic role [" + dto.getAutomaticRoleAttribute() + "] is null. Please check this rule: " + dto.getId());
}
// set concept
if (!automaticRole.isConcept()) {
automaticRole.setConcept(true);
automaticRole = automactiRoleAttributeService.save(automaticRole);
}
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class AutomaticRoleRequestRealizationProcessor method process.
@Override
public EventResult<IdmAutomaticRoleRequestDto> process(EntityEvent<IdmAutomaticRoleRequestDto> event) {
AbstractRequestDto dto = event.getContent();
event.setContent(service.executeRequest(dto.getId()));
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.api.event.DefaultEventResult in project CzechIdMng by bcvsolutions.
the class RoleCatalogueSaveProcessor method process.
@Override
public EventResult<IdmRoleCatalogueDto> process(EntityEvent<IdmRoleCatalogueDto> event) {
IdmRoleCatalogueDto dto = event.getContent();
dto = service.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 TreeNodeDeleteProcessor method process.
@Override
public EventResult<IdmTreeNodeDto> process(EntityEvent<IdmTreeNodeDto> event) {
IdmTreeNodeDto treeNode = event.getContent();
//
if (identityContractRepository.countByWorkPosition_Id(treeNode.getId()) > 0) {
throw new TreeNodeException(CoreResultCode.TREE_NODE_DELETE_FAILED_HAS_CONTRACTS, ImmutableMap.of("treeNode", treeNode.getName()));
}
// remove related automatic roles
IdmRoleTreeNodeFilter filter = new IdmRoleTreeNodeFilter();
filter.setTreeNodeId(treeNode.getId());
roleTreeNodeService.find(filter, null).forEach(roleTreeNode -> {
try {
roleTreeNodeService.delete(roleTreeNode);
} catch (AcceptedException ex) {
throw new TreeNodeException(CoreResultCode.TREE_NODE_DELETE_FAILED_HAS_ROLE, ImmutableMap.of("treeNode", treeNode.getName(), "roleTreeNode", roleTreeNode.getId()));
}
});
//
service.deleteInternal(treeNode);
//
return new DefaultEventResult<>(event, this);
}
Aggregations