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());
}
}
Aggregations