use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.
the class DefaultSynchronizationService method process.
/**
* Called from long running task
*/
@Override
public AbstractSysSyncConfigDto process() {
AbstractSysSyncConfigDto config = synchronizationConfigService.get(synchronizationConfigId);
//
if (config == null) {
throw new ProvisioningException(AccResultCode.SYNCHRONIZATION_NOT_FOUND, ImmutableMap.of("id", synchronizationConfigId));
}
SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
Assert.notNull(mapping);
SystemEntityType entityType = mapping.getEntityType();
SynchronizationEntityExecutor executor = getSyncExecutor(entityType);
executor.setLongRunningTaskExecutor(this);
return executor.process(synchronizationConfigId);
}
use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningBreakConfigService method save.
@Override
public SysProvisioningBreakConfigDto save(SysProvisioningBreakConfigDto dto, BasePermission... permission) {
// check global configuration
if (dto.getGlobalConfiguration() != null && dto.getGlobalConfiguration()) {
throw new ProvisioningException(AccResultCode.PROVISIONING_BREAK_GLOBAL_CONFIG_SAVE, ImmutableMap.of("operationType", dto.getOperationType()));
}
// check if for same system doesn't exist same operation type
SysProvisioningBreakConfigFilter filter = new SysProvisioningBreakConfigFilter();
filter.setSystemId(dto.getSystem());
filter.setOperationType(dto.getOperationType());
List<SysProvisioningBreakConfigDto> similarConfigs = this.find(filter, null).getContent();
boolean existSimilar = similarConfigs.stream().filter(config -> !config.getId().equals(dto.getId())).findFirst().isPresent();
if (!existSimilar) {
return super.save(dto, permission);
}
throw new ProvisioningException(AccResultCode.PROVISIONING_BREAK_OPERATION_EXISTS, ImmutableMap.of("operationType", dto.getOperationType(), "systemId", dto.getSystem()));
}
use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingService method getUidValueFromResource.
@Override
public String getUidValueFromResource(List<IcAttribute> icAttributes, List<SysSystemAttributeMappingDto> mappedAttributes, SysSystemDto system) {
SysSystemAttributeMappingDto uidAttribute = this.getUidAttribute(mappedAttributes, system);
Object uid = this.getValueByMappedAttribute(uidAttribute, icAttributes);
if (uid == null) {
SysSystemDto systemEntity = getSystemFromAttributeMapping(uidAttribute);
throw new ProvisioningException(AccResultCode.PROVISIONING_GENERATED_UID_IS_NULL, ImmutableMap.of("system", systemEntity.getName()));
}
if (!(uid instanceof String)) {
SysSystemDto systemEntity = getSystemFromAttributeMapping(uidAttribute);
throw new ProvisioningException(AccResultCode.PROVISIONING_ATTRIBUTE_UID_IS_NOT_STRING, ImmutableMap.of("uid", uid.getClass(), "system", systemEntity.getName()));
}
return (String) uid;
}
use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.
the class IdentitySynchronizationExecutor method findByAttribute.
@Override
protected IdmIdentityDto findByAttribute(String idmAttributeName, String value) {
CorrelationFilter filter = getEntityFilter();
filter.setProperty(idmAttributeName);
filter.setValue(value);
List<IdmIdentityDto> entities = identityService.find((IdmIdentityFilter) filter, null).getContent();
if (CollectionUtils.isEmpty(entities)) {
return null;
}
if (entities.size() > 1) {
throw new ProvisioningException(AccResultCode.SYNCHRONIZATION_CORRELATION_TO_MANY_RESULTS, ImmutableMap.of("correlationAttribute", idmAttributeName, "value", value));
}
if (entities.size() == 1) {
return entities.get(0);
}
return null;
}
use of eu.bcvsolutions.idm.acc.exception.ProvisioningException in project CzechIdMng by bcvsolutions.
the class RoleCatalogueProvisioningExecutor method getAttributeValue.
@Override
protected Object getAttributeValue(String uid, IdmRoleCatalogueDto dto, AttributeMapping attribute) {
Object idmValue = super.getAttributeValue(uid, dto, attribute);
if (attribute.isEntityAttribute() && TreeSynchronizationExecutor.PARENT_FIELD.equals(attribute.getIdmPropertyName())) {
// parent format (UID of parent)
if (idmValue instanceof UUID) {
// Generally we expect IdmRoleCatalogue as parent (we will do
// transform)
AccRoleCatalogueAccountFilter catalogueAccountFilter = new AccRoleCatalogueAccountFilter();
catalogueAccountFilter.setSystemId(this.getSytemFromSchemaAttribute(attribute.getSchemaAttribute()).getId());
catalogueAccountFilter.setEntityId((UUID) idmValue);
List<AccRoleCatalogueAccountDto> treeAccounts = catalogueAccountService.find(catalogueAccountFilter, null).getContent();
if (treeAccounts.isEmpty()) {
throw new ProvisioningException(AccResultCode.PROVISIONING_TREE_PARENT_ACCOUNT_NOT_FOUND, ImmutableMap.of("parentNode", idmValue));
}
if (treeAccounts.size() != 1) {
throw new ProvisioningException(AccResultCode.PROVISIONING_TREE_TOO_MANY_PARENT_ACCOUNTS, ImmutableMap.of("parentNode", idmValue));
}
AccRoleCatalogueAccountDto treeAccount = treeAccounts.get(0);
String parentUid = accountService.get(treeAccount.getAccount()).getUid();
return parentUid;
} else {
// without any transform
return idmValue;
}
}
return idmValue;
}
Aggregations