Search in sources :

Example 11 with EntityAccountDto

use of eu.bcvsolutions.idm.acc.dto.EntityAccountDto in project CzechIdMng by bcvsolutions.

the class TreeSynchronizationExecutor method doCreateEntity.

/**
 * Create and persist new entity by data from IC attributes
 *
 * @param entityType
 * @param mappedAttributes
 * @param logItem
 * @param uid
 * @param icAttributes
 * @param account
 */
@SuppressWarnings("unchecked")
@Override
protected void doCreateEntity(SystemEntityType entityType, List<SysSystemAttributeMappingDto> mappedAttributes, SysSyncItemLogDto logItem, String uid, List<IcAttribute> icAttributes, AccAccountDto account, SynchronizationContext context) {
    // We will create new TreeNode
    addToItemLog(logItem, "Missing entity action is CREATE_ENTITY, we will create a new entity.");
    IdmTreeNodeDto treeNode = new IdmTreeNodeDto();
    // Fill entity by mapped attribute
    treeNode = fillEntity(mappedAttributes, uid, icAttributes, treeNode, true, context);
    treeNode.setTreeType(this.getSystemMapping(mappedAttributes).getTreeType());
    // Create new Entity
    treeNode = this.save(treeNode, true);
    // Update extended attribute (entity must be persisted first)
    updateExtendedAttributes(mappedAttributes, uid, icAttributes, treeNode, true, context);
    // Update confidential attribute (entity must be persisted first)
    updateConfidentialAttributes(mappedAttributes, uid, icAttributes, treeNode, true, context);
    // Create new Entity account relation
    EntityAccountDto entityAccount = this.createEntityAccountDto();
    entityAccount.setAccount(account.getId());
    entityAccount.setEntity(treeNode.getId());
    entityAccount.setOwnership(true);
    this.getEntityAccountService().save(entityAccount);
    // Call provisioning for entity
    this.callProvisioningForEntity(treeNode, entityType, logItem);
    // Entity Created
    addToItemLog(logItem, MessageFormat.format("Tree node with id {0} was created", treeNode.getId()));
    if (logItem != null) {
        logItem.setDisplayName(treeNode.getName());
    }
}
Also used : EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)

Aggregations

EntityAccountDto (eu.bcvsolutions.idm.acc.dto.EntityAccountDto)11 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)5 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)4 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)4 UUID (java.util.UUID)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 AccResultCode (eu.bcvsolutions.idm.acc.domain.AccResultCode)3 SysRoleSystemAttributeDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)3 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)3 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)3 EntityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter)3 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)3 AccAccountService (eu.bcvsolutions.idm.acc.service.api.AccAccountService)3 ProvisioningExecutor (eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor)3 SysRoleSystemAttributeService (eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService)3 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)3 ImmutableList (com.google.common.collect.ImmutableList)2 AccountType (eu.bcvsolutions.idm.acc.domain.AccountType)2 AttributeMapping (eu.bcvsolutions.idm.acc.domain.AttributeMapping)2 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)2