Search in sources :

Example 1 with IcObjectClass

use of eu.bcvsolutions.idm.ic.api.IcObjectClass in project CzechIdMng by bcvsolutions.

the class AbstractProvisioningProcessor method process.

/**
 * Prepare provisioning operation execution
 */
@Override
public EventResult<SysProvisioningOperationDto> process(EntityEvent<SysProvisioningOperationDto> event) {
    SysProvisioningOperationDto provisioningOperation = event.getContent();
    SysSystemDto system = systemService.get(provisioningOperation.getSystem());
    IcConnectorObject connectorObject = provisioningOperation.getProvisioningContext().getConnectorObject();
    IcObjectClass objectClass = connectorObject.getObjectClass();
    String uid = systemEntityService.getByProvisioningOperation(provisioningOperation).getUid();
    LOG.debug("Start provisioning operation [{}] for object with uid [{}] and connector object [{}]", provisioningOperation.getOperationType(), uid, objectClass.getType());
    // Find connector identification persisted in system
    if (system.getConnectorKey() == null) {
        throw new ProvisioningException(AccResultCode.CONNECTOR_KEY_FOR_SYSTEM_NOT_FOUND, ImmutableMap.of("system", system.getName()));
    }
    // load connector configuration
    IcConnectorConfiguration connectorConfig = systemService.getConnectorConfiguration(systemService.get(provisioningOperation.getSystem()));
    if (connectorConfig == null) {
        throw new ProvisioningException(AccResultCode.CONNECTOR_CONFIGURATION_FOR_SYSTEM_NOT_FOUND, ImmutableMap.of("system", system.getName()));
    }
    // 
    try {
        provisioningOperation = provisioningOperationService.save(provisioningOperation);
        // convert confidential string to guarded strings before provisioning realization
        connectorObject = provisioningOperationService.getFullConnectorObject(provisioningOperation);
        provisioningOperation.getProvisioningContext().setConnectorObject(connectorObject);
        // 
        IcUidAttribute resultUid = processInternal(provisioningOperation, connectorConfig);
        // update system entity, when identifier on target system differs
        if (resultUid != null && resultUid.getUidValue() != null) {
            SysSystemEntityDto systemEntity = systemEntityService.getByProvisioningOperation(provisioningOperation);
            // If system entity was not found, we try found system entity by returned UID
            if (systemEntity == null) {
                systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, provisioningOperation.getEntityType(), resultUid.getUidValue());
            }
            Asserts.notNull(systemEntity, "Systeme entity cannot be null!");
            if (!systemEntity.getUid().equals(resultUid.getUidValue()) || systemEntity.isWish()) {
                systemEntity.setUid(resultUid.getUidValue());
                systemEntity.setWish(false);
                systemEntity = systemEntityService.save(systemEntity);
                LOG.info("UID was changed. System entity with uid [{}] was updated", systemEntity.getUid());
            }
        }
        provisioningOperationService.handleSuccessful(provisioningOperation);
    } catch (Exception ex) {
        provisioningOperationService.handleFailed(provisioningOperation, ex);
    }
    // set operation back to content
    event.setContent(provisioningOperation);
    return new DefaultEventResult<>(event, this);
}
Also used : IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException)

Example 2 with IcObjectClass

use of eu.bcvsolutions.idm.ic.api.IcObjectClass in project CzechIdMng by bcvsolutions.

the class PrepareConnectorObjectProcessor method processUpdate.

@SuppressWarnings("unchecked")
private void processUpdate(SysProvisioningOperationDto provisioningOperation, IcConnectorConfiguration connectorConfig, IcConnectorObject existsConnectorObject) {
    SysSystemDto system = systemService.get(provisioningOperation.getSystem());
    String systemEntityUid = provisioningOperationService.getByProvisioningOperation(provisioningOperation).getUid();
    ProvisioningContext provisioningContext = provisioningOperation.getProvisioningContext();
    IcConnectorObject connectorObject = provisioningContext.getConnectorObject();
    IcObjectClass objectClass = connectorObject.getObjectClass();
    // 
    IcConnectorObject updateConnectorObject;
    if (provisioningContext.getAccountObject() == null) {
        updateConnectorObject = connectorObject;
    } else {
        Map<ProvisioningAttributeDto, Object> fullAccountObject = provisioningOperationService.getFullAccountObject(provisioningOperation);
        updateConnectorObject = new IcConnectorObjectImpl(systemEntityUid, objectClass, null);
        SysSystemMappingDto mapping = getMapping(system, provisioningOperation.getEntityType());
        SysSchemaObjectClassDto schemaObjectClassDto = schemaObjectClassService.get(mapping.getObjectClass());
        List<SysSchemaAttributeDto> schemaAttributes = findSchemaAttributes(system, schemaObjectClassDto);
        SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
        filter.setEntityIdentifier(provisioningOperation.getEntityIdentifier());
        filter.setEntityType(provisioningOperation.getEntityType());
        filter.setResultState(OperationState.EXECUTED);
        SysProvisioningArchiveDto lastSuccessEntity = null;
        for (Entry<ProvisioningAttributeDto, Object> entry : fullAccountObject.entrySet()) {
            ProvisioningAttributeDto provisioningAttribute = entry.getKey();
            Optional<SysSchemaAttributeDto> schemaAttributeOptional = schemaAttributes.stream().filter(schemaAttribute -> {
                return provisioningAttribute.getSchemaAttributeName().equals(schemaAttribute.getName());
            }).findFirst();
            if (!schemaAttributeOptional.isPresent()) {
                throw new ProvisioningException(AccResultCode.PROVISIONING_SCHEMA_ATTRIBUTE_IS_FOUND, ImmutableMap.of("attribute", provisioningAttribute.getSchemaAttributeName()));
            }
            SysSchemaAttributeDto schemaAttribute = schemaAttributeOptional.get();
            if (schemaAttribute.isUpdateable()) {
                if (schemaAttribute.isReturnedByDefault()) {
                    Object idmValue = fullAccountObject.get(provisioningAttribute);
                    IcAttribute attribute = existsConnectorObject.getAttributeByName(schemaAttribute.getName());
                    Object connectorValue = attribute != null ? (attribute.isMultiValue() ? attribute.getValues() : attribute.getValue()) : null;
                    Object resultValue = idmValue;
                    if (AttributeMappingStrategyType.CREATE == provisioningAttribute.getStrategyType()) {
                        // We do update, attributes with create strategy will be skipped
                        continue;
                    }
                    if (provisioningAttribute.isSendOnlyIfNotNull()) {
                        if (this.isValueEmpty(idmValue)) {
                            // Skip this attribute (marked with flag sendOnlyIfNotNull), because idm value is null
                            continue;
                        }
                    }
                    if (AttributeMappingStrategyType.WRITE_IF_NULL == provisioningAttribute.getStrategyType()) {
                        boolean existSetAttribute = fullAccountObject.keySet().stream().filter(provisioningAttributeKey -> {
                            return provisioningAttributeKey.getSchemaAttributeName().equals(schemaAttribute.getName()) && AttributeMappingStrategyType.SET == provisioningAttributeKey.getStrategyType();
                        }).findFirst().isPresent();
                        boolean existMergeAttribute = fullAccountObject.keySet().stream().filter(provisioningAttributeKey -> {
                            return provisioningAttributeKey.getSchemaAttributeName().equals(schemaAttribute.getName()) && AttributeMappingStrategyType.MERGE == provisioningAttributeKey.getStrategyType();
                        }).findFirst().isPresent();
                        boolean existAuthMergeAttribute = fullAccountObject.keySet().stream().filter(provisioningAttributeKey -> {
                            return provisioningAttributeKey.getSchemaAttributeName().equals(schemaAttribute.getName()) && AttributeMappingStrategyType.AUTHORITATIVE_MERGE == provisioningAttributeKey.getStrategyType();
                        }).findFirst().isPresent();
                        if (AttributeMappingStrategyType.WRITE_IF_NULL == provisioningAttribute.getStrategyType()) {
                            List<IcAttribute> icAttributes = existsConnectorObject.getAttributes();
                            // 
                            Optional<IcAttribute> icAttributeOptional = icAttributes.stream().filter(ica -> {
                                return schemaAttribute.getName().equals(ica.getName());
                            }).findFirst();
                            IcAttribute icAttribute = null;
                            if (icAttributeOptional.isPresent()) {
                                icAttribute = icAttributeOptional.get();
                            }
                            // We need do transform from resource first
                            Object transformedConnectorValue = this.transformValueFromResource(provisioningAttribute.getTransformValueFromResourceScript(), schemaAttribute, icAttribute, icAttributes, system);
                            if (transformedConnectorValue != null || existSetAttribute || existAuthMergeAttribute || existMergeAttribute) {
                                // or exists same attribute with  SET/MERGE/AUTH_MERGE strategy (this strategies has higher priority)
                                continue;
                            }
                        }
                    }
                    if (AttributeMappingStrategyType.MERGE == provisioningAttribute.getStrategyType()) {
                        // Load last provisioning history
                        if (lastSuccessEntity == null) {
                            List<SysProvisioningArchiveDto> lastSuccessEntities = provisioningArchiveService.find(filter, new PageRequest(0, 1, new Sort(Direction.DESC, MODIFIED_FIELD_NAME))).getContent();
                            if (!lastSuccessEntities.isEmpty()) {
                                lastSuccessEntity = lastSuccessEntities.get(0);
                            }
                        }
                        // Merge IdM values with connector values
                        if (connectorValue instanceof List) {
                            List<Object> connectorValues = new ArrayList<>((List<Object>) connectorValue);
                            List<Object> idmValues = null;
                            if (idmValue instanceof List) {
                                idmValues = (List<Object>) idmValue;
                            }
                            if (idmValues != null) {
                                idmValues.stream().forEach(value -> {
                                    if (!connectorValues.contains(value)) {
                                        connectorValues.add(value);
                                    }
                                });
                            }
                            resultValue = connectorValues;
                        }
                        // Delete missing values by last provisioning history
                        if (lastSuccessEntity != null && lastSuccessEntity.getProvisioningContext() != null && lastSuccessEntity.getProvisioningContext().getAccountObject() != null && lastSuccessEntity.getProvisioningContext().getAccountObject().containsKey(provisioningAttribute)) {
                            Object oldValue = lastSuccessEntity.getProvisioningContext().getAccountObject().get(provisioningAttribute);
                            if (oldValue instanceof List) {
                                if (!oldValue.equals(idmValue)) {
                                    // Search all deleted values (managed by IdM) by founded last provisioning values
                                    List<?> deletedValues = ((List<?>) oldValue).stream().filter(value -> {
                                        List<?> idmValues = null;
                                        if (idmValue instanceof List) {
                                            idmValues = (List<?>) idmValue;
                                        }
                                        if (idmValues != null && idmValues.contains(value)) {
                                            return false;
                                        }
                                        return true;
                                    }).collect(Collectors.toList());
                                    if (resultValue instanceof List) {
                                        List<?> resultValues = new ArrayList<>((List<Object>) resultValue);
                                        // Remove all deleted values (managed by IdM)
                                        resultValues.removeAll(deletedValues);
                                        resultValue = resultValues;
                                    }
                                }
                            }
                        }
                    }
                    // Update attribute on resource by given mapping
                    // attribute and mapped value in entity
                    IcAttribute updatedAttribute = updateAttribute(systemEntityUid, resultValue, schemaAttribute, existsConnectorObject, system, provisioningAttribute);
                    if (updatedAttribute != null) {
                        updateConnectorObject.getAttributes().add(updatedAttribute);
                    }
                } else {
                    // filled values only
                    if (fullAccountObject.get(provisioningAttribute) != null) {
                        IcAttribute createdAttribute = createAttribute(schemaAttribute, fullAccountObject.get(provisioningAttribute));
                        if (createdAttribute != null) {
                            updateConnectorObject.getAttributes().add(createdAttribute);
                        }
                    }
                }
            }
        }
    }
    // 
    provisioningOperation.getProvisioningContext().setConnectorObject(updateConnectorObject);
    provisioningOperation.setOperationType(ProvisioningEventType.UPDATE);
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) NotificationManager(eu.bcvsolutions.idm.core.notification.api.service.NotificationManager) Autowired(org.springframework.beans.factory.annotation.Autowired) Enabled(eu.bcvsolutions.idm.core.security.api.domain.Enabled) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SysSchemaAttribute(eu.bcvsolutions.idm.acc.entity.SysSchemaAttribute) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Map(java.util.Map) ProvisioningConfiguration(eu.bcvsolutions.idm.acc.config.domain.ProvisioningConfiguration) Sort(org.springframework.data.domain.Sort) AbstractEntityEventProcessor(eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor) ImmutableMap(com.google.common.collect.ImmutableMap) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) Collection(java.util.Collection) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) PageRequest(org.springframework.data.domain.PageRequest) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) CollectionUtils(org.springframework.util.CollectionUtils) Entry(java.util.Map.Entry) Optional(java.util.Optional) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) ProvisioningEventType(eu.bcvsolutions.idm.acc.domain.ProvisioningEventType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Strings(com.google.common.base.Strings) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) IcUidAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcUidAttributeImpl) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) EventResult(eu.bcvsolutions.idm.core.api.event.EventResult) Direction(org.springframework.data.domain.Sort.Direction) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) Description(org.springframework.context.annotation.Description) AccModuleDescriptor(eu.bcvsolutions.idm.acc.AccModuleDescriptor) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) Component(org.springframework.stereotype.Component) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) ResultModel(eu.bcvsolutions.idm.core.api.dto.ResultModel) Assert(org.springframework.util.Assert) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ArrayList(java.util.ArrayList) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) PageRequest(org.springframework.data.domain.PageRequest) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) Sort(org.springframework.data.domain.Sort) List(java.util.List) ArrayList(java.util.ArrayList) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)

Example 3 with IcObjectClass

use of eu.bcvsolutions.idm.ic.api.IcObjectClass in project CzechIdMng by bcvsolutions.

the class AbstractSynchronizationExecutor method process.

@Override
public AbstractSysSyncConfigDto process(UUID synchronizationConfigId) {
    // Clear cache
    this.clearCache();
    // Validate and create basic context
    SynchronizationContext context = this.validate(synchronizationConfigId);
    AbstractSysSyncConfigDto config = context.getConfig();
    SystemEntityType entityType = context.getEntityType();
    SysSystemDto system = context.getSystem();
    IcConnectorConfiguration connectorConfig = context.getConnectorConfig();
    SysSystemMappingDto systemMapping = systemMappingService.get(config.getSystemMapping());
    SysSchemaObjectClassDto schemaObjectClassDto = schemaObjectClassService.get(systemMapping.getObjectClass());
    IcObjectClass objectClass = new IcObjectClassImpl(schemaObjectClassDto.getObjectClassName());
    // Load last token
    Object lastToken = config.isReconciliation() ? null : config.getToken();
    IcSyncToken lastIcToken = lastToken != null ? new IcSyncTokenImpl(lastToken) : null;
    // Create basic synchronization log
    SysSyncLogDto log = new SysSyncLogDto();
    log.setSynchronizationConfig(config.getId());
    log.setStarted(LocalDateTime.now());
    log.setRunning(true);
    log.setToken(lastToken != null ? lastToken.toString() : null);
    log.addToLog(MessageFormat.format("Synchronization was started in {0}.", log.getStarted()));
    // List of all accounts keys (used in reconciliation)
    Set<String> systemAccountsList = new HashSet<>();
    // TODO: Export is not fully implemented (FE, configuration and Groovy
    // part missing)
    boolean export = false;
    longRunningTaskExecutor.setCounter(0L);
    try {
        log = synchronizationLogService.save(log);
        List<SysSyncActionLogDto> actionsLog = new ArrayList<>();
        // add logs to context
        context.addLog(log).addActionLogs(actionsLog);
        if (export) {
            // Start exporting entities to resource
            log.addToLog("Exporting entities to resource started...");
            this.startExport(entityType, config, context.getMappedAttributes(), log, actionsLog);
        } else if (config.isCustomFilter() || config.isReconciliation()) {
            // Custom filter Sync
            log.addToLog("Synchronization will use custom filter (not synchronization implemented in connector).");
            AttributeMapping tokenAttribute = null;
            if (config.getTokenAttribute() != null) {
                tokenAttribute = systemAttributeMappingService.get(config.getTokenAttribute());
            }
            if (tokenAttribute == null && !config.isReconciliation()) {
                throw new ProvisioningException(AccResultCode.SYNCHRONIZATION_TOKEN_ATTRIBUTE_NOT_FOUND);
            }
            context.addTokenAttribute(tokenAttribute);
            // Resolve filter for custom search
            IcFilter filter = resolveSynchronizationFilter(config);
            log.addToLog(MessageFormat.format("Start search with filter {0}.", filter != null ? filter : "NONE"));
            connectorFacade.search(system.getConnectorInstance(), connectorConfig, objectClass, filter, new DefaultResultHandler(context, systemAccountsList));
        } else {
            // Inner Sync
            log.addToLog("Synchronization will use inner connector synchronization implementation.");
            DefalutSyncResultHandler syncResultsHandler = new DefalutSyncResultHandler(context, systemAccountsList);
            connectorFacade.synchronization(system.getConnectorInstance(), connectorConfig, objectClass, lastIcToken, syncResultsHandler);
        }
        // We do reconciliation (find missing account)
        if (config.isReconciliation() && log.isRunning()) {
            startReconciliation(entityType, systemAccountsList, config, system, log, actionsLog);
        }
        // Sync is correctly ends if wasn't cancelled
        if (log.isRunning()) {
            log = syncCorrectlyEnded(log, context);
        }
        config = synchronizationConfigService.save(config);
    } catch (Exception e) {
        String message = "Error during synchronization";
        log.addToLog(message);
        log.setContainsError(true);
        log.addToLog(Throwables.getStackTraceAsString(e));
        LOG.error(message, e);
    } finally {
        log.setRunning(false);
        log.setEnded(LocalDateTime.now());
        log = synchronizationLogService.save(log);
        // 
        longRunningTaskExecutor.setCount(longRunningTaskExecutor.getCounter());
        longRunningTaskExecutor.updateState();
        // Clear cache
        this.clearCache();
    }
    return config;
}
Also used : IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) ArrayList(java.util.ArrayList) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) IcSyncTokenImpl(eu.bcvsolutions.idm.ic.impl.IcSyncTokenImpl) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) HashSet(java.util.HashSet) IcSyncToken(eu.bcvsolutions.idm.ic.api.IcSyncToken) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IntrospectionException(java.beans.IntrospectionException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) IcFilter(eu.bcvsolutions.idm.ic.filter.api.IcFilter)

Example 4 with IcObjectClass

use of eu.bcvsolutions.idm.ic.api.IcObjectClass in project CzechIdMng by bcvsolutions.

the class ConnIdIcConvertUtil method convertConnIdConnectorObject.

public static IcConnectorObject convertConnIdConnectorObject(ConnectorObject connObject) {
    if (connObject == null) {
        return null;
    }
    IcObjectClass icClass = ConnIdIcConvertUtil.convertConnIdObjectClass(connObject.getObjectClass());
    Set<Attribute> attributes = connObject.getAttributes();
    List<IcAttribute> icAttributes = new ArrayList<>();
    if (attributes != null) {
        for (Attribute a : attributes) {
            icAttributes.add(ConnIdIcConvertUtil.convertConnIdAttribute(a));
        }
    }
    return new IcConnectorObjectImpl(connObject.getUid().getUidValue(), icClass, icAttributes);
}
Also used : IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcEnabledAttribute(eu.bcvsolutions.idm.ic.api.IcEnabledAttribute) IcPasswordAttribute(eu.bcvsolutions.idm.ic.api.IcPasswordAttribute) Attribute(org.identityconnectors.framework.common.objects.Attribute) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) IcLoginAttribute(eu.bcvsolutions.idm.ic.api.IcLoginAttribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) ArrayList(java.util.ArrayList) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)

Example 5 with IcObjectClass

use of eu.bcvsolutions.idm.ic.api.IcObjectClass in project CzechIdMng by bcvsolutions.

the class ConnIdIcConnectorService method createObject.

@Override
public IcUidAttribute createObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, List<IcAttribute> attributes) {
    Assert.notNull(connectorInstance);
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    Assert.notNull(attributes);
    LOG.debug("Create object - ConnId ({} {})", connectorInstance.getConnectorKey().toString(), attributes.toString());
    ConnectorFacade conn = getConnectorFacade(connectorInstance, connectorConfiguration);
    Set<Attribute> connIdAttributes = new HashSet<>();
    for (IcAttribute icAttribute : attributes) {
        connIdAttributes.add(ConnIdIcConvertUtil.convertIcAttribute(icAttribute));
    }
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    Uid uid = conn.create(objectClassConnId, connIdAttributes, null);
    LOG.debug("Created object - ConnId ({} {}) Uid= {}", connectorInstance.getConnectorKey().toString(), attributes.toString(), uid);
    return ConnIdIcConvertUtil.convertConnIdUid(uid);
}
Also used : Uid(org.identityconnectors.framework.common.objects.Uid) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) Attribute(org.identityconnectors.framework.common.objects.Attribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade) HashSet(java.util.HashSet)

Aggregations

IcObjectClass (eu.bcvsolutions.idm.ic.api.IcObjectClass)22 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)16 IcUidAttribute (eu.bcvsolutions.idm.ic.api.IcUidAttribute)13 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)11 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)8 IcConnectorFacade (eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade)8 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)7 ConnectorFacade (org.identityconnectors.framework.api.ConnectorFacade)7 ObjectClass (org.identityconnectors.framework.common.objects.ObjectClass)7 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)6 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)6 IcConnectorConfiguration (eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration)6 IcObjectClassImpl (eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl)6 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)5 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)5 IcAttribute (eu.bcvsolutions.idm.ic.api.IcAttribute)5 IcUidAttributeImpl (eu.bcvsolutions.idm.ic.impl.IcUidAttributeImpl)5 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)4 IcConnectorObjectImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)4 ArrayList (java.util.ArrayList)4