use of eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl in project CzechIdMng by bcvsolutions.
the class DefaultProvisioningExecutorIntegrationTest method createProvisioningOperation.
/**
* Prepare provisioning context and operation
*
* @param system
* @return
*/
private SysProvisioningOperationDto createProvisioningOperation(SysSystemDto system, String firstname) {
ProvisioningContext context = new ProvisioningContext();
SysSystemEntityDto systemEntity = helper.createSystemEntity(system);
Map<ProvisioningAttributeDto, Object> accoutObject = createAccountObject(systemEntity, firstname);
context.setAccountObject(accoutObject);
//
// prepare provisioning operation
SysSystemMappingDto systemMapping = helper.getDefaultMapping(system);
IcObjectClass objectClass = new IcObjectClassImpl(schemaObjectClassService.get(systemMapping.getObjectClass()).getObjectClassName());
IcConnectorObject connectorObject = new IcConnectorObjectImpl(null, objectClass, null);
SysProvisioningOperationDto.Builder operationBuilder = new SysProvisioningOperationDto.Builder().setOperationType(ProvisioningOperationType.CREATE).setSystemEntity(systemEntity).setProvisioningContext(new ProvisioningContext(accoutObject, connectorObject));
return operationBuilder.build();
}
use of eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl in project CzechIdMng by bcvsolutions.
the class DefaultProvisioningExecutorIntegrationTest method updateProvisioningOperation.
private SysProvisioningOperationDto updateProvisioningOperation(SysSystemEntityDto systemEntity, String firstname) {
ProvisioningContext context = new ProvisioningContext();
Map<ProvisioningAttributeDto, Object> accoutObject = createAccountObject(systemEntity, firstname);
context.setAccountObject(accoutObject);
//
// prepare provisioning operation
SysSystemMappingDto systemMapping = helper.getDefaultMapping(systemEntity.getSystem());
IcObjectClass objectClass = new IcObjectClassImpl(schemaObjectClassService.get(systemMapping.getObjectClass()).getObjectClassName());
IcConnectorObject connectorObject = new IcConnectorObjectImpl(null, objectClass, null);
SysProvisioningOperationDto.Builder operationBuilder = new SysProvisioningOperationDto.Builder().setOperationType(ProvisioningOperationType.UPDATE).setSystemEntity(systemEntity).setProvisioningContext(new ProvisioningContext(accoutObject, connectorObject));
return operationBuilder.build();
}
use of eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl in project CzechIdMng by bcvsolutions.
the class DefaultSynchronizationService method resolveLinkedSituation.
@Override
public SysSyncItemLogDto resolveLinkedSituation(String uid, SystemEntityType entityType, List<IcAttribute> icAttributes, UUID accountId, UUID configId, String actionType) {
Assert.notNull(uid);
Assert.notNull(entityType);
Assert.notNull(icAttributes);
Assert.notNull(configId);
Assert.notNull(actionType);
Assert.notNull(accountId);
SysSyncItemLogDto itemLog = new SysSyncItemLogDto();
AbstractSysSyncConfigDto config = synchronizationConfigService.get(configId);
SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
AccAccountDto account = accountService.get(accountId);
SysSystemAttributeMappingFilter attributeHandlingFilter = new SysSystemAttributeMappingFilter();
attributeHandlingFilter.setSystemMappingId(mapping.getId());
List<SysSystemAttributeMappingDto> mappedAttributes = attributeHandlingService.find(attributeHandlingFilter, null).getContent();
// Little workaround, we have only IcAttributes ... we create IcObject manually
IcConnectorObjectImpl icObject = new IcConnectorObjectImpl();
icObject.setAttributes(icAttributes);
icObject.setUidValue(uid);
SynchronizationContext context = new SynchronizationContext();
context.addUid(uid).addAccount(account).addConfig(config).addEntityType(entityType).addLogItem(itemLog).addMappedAttributes(mappedAttributes).addIcObject(icObject);
getSyncExecutor(entityType).resolveLinkedSituation(SynchronizationLinkedActionType.valueOf(actionType), context);
return itemLog;
}
use of eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl in project CzechIdMng by bcvsolutions.
the class BasicVirtualConnector method read.
@Override
public IcConnectorObject read(IcUidAttribute uid, IcObjectClass objectClass) {
Assert.notNull(objectClass, "Object class cannot be null!");
Assert.notNull(uid, "UID cannot be null!");
if (!IcObjectClassInfo.ACCOUNT.equals(objectClass.getType())) {
throw new IcException("Only ACCOUNT object class is supported now!");
}
String uidValue = uid.getUidValue();
if (uidValue == null) {
throw new IcException("UID value cannot be null!");
}
// Find account by UID and System ID
VsAccountDto account = accountService.findByUidSystem(uidValue, systemId);
// All attributes from VS account
List<IcAttribute> vsAttributes = new ArrayList<>();
// Create uid attribute
IcAttributeImpl uidAttribute = new IcAttributeImpl(IcAttributeInfo.NAME, uidValue);
vsAttributes.add(uidAttribute);
if (account != null) {
// Create enable attribute
if (this.virtualConfiguration.isDisableSupported()) {
IcAttributeImpl enableAttribute = new IcAttributeImpl(IcAttributeInfo.ENABLE, account.isEnable());
vsAttributes.add(enableAttribute);
}
// Attributes from definition and configuration
UUID accountId = account.getId();
Arrays.asList(virtualConfiguration.getAttributes()).forEach(virtualAttirbute -> {
IcAttribute attribute = accountService.getIcAttribute(accountId, virtualAttirbute, formDefinition);
if (attribute == null) {
return;
}
vsAttributes.add(attribute);
});
}
// Overwrite attributes form VS account with attributes from unresloved
// requests
List<IcAttribute> attributes = this.overwriteAttributesByUnresolvedRequests(account, uidValue, vsAttributes);
if (attributes == null) {
return null;
}
IcConnectorObjectImpl connectorObject = new IcConnectorObjectImpl();
connectorObject.setUidValue(uidValue);
connectorObject.setObjectClass(new IcObjectClassImpl(IcObjectClassInfo.ACCOUNT));
connectorObject.setAttributes(attributes);
return connectorObject;
}
Aggregations