use of eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto in project CzechIdMng by bcvsolutions.
the class TreeSynchronizationExecutor method findByAttribute.
@Override
protected IdmTreeNodeDto findByAttribute(String idmAttributeName, String value) {
CorrelationFilter filter = getEntityFilter();
filter.setProperty(idmAttributeName);
filter.setValue(value);
List<IdmTreeNodeDto> entities = treeNodeService.find((IdmTreeNodeFilter) 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.core.api.dto.IdmTreeNodeDto in project CzechIdMng by bcvsolutions.
the class TreeSynchronizationExecutor method doDeleteEntity.
/**
* Delete entity linked with given account
*
* @param account
* @param entityType
* @param log
* @param logItem
* @param actionLogs
*/
@Override
protected void doDeleteEntity(AccAccountDto account, SystemEntityType entityType, SysSyncLogDto log, SysSyncItemLogDto logItem, List<SysSyncActionLogDto> actionLogs) {
UUID entityId = getEntityByAccount(account.getId());
IdmTreeNodeDto treeNode = null;
if (entityId != null) {
treeNode = treeNodeService.get(entityId);
}
if (treeNode == null) {
addToItemLog(logItem, "Tree account relation (with ownership = true) was not found!");
initSyncActionLog(SynchronizationActionType.DELETE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
return;
}
logItem.setDisplayName(treeNode.getName());
// Delete entity (recursively)
deleteChildrenRecursively(treeNode, logItem);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto in project CzechIdMng by bcvsolutions.
the class TreeSynchronizationExecutor method doUpdateAccount.
/**
* Call provisioning for given account
*
* @param account
* @param entityType
* @param log
* @param logItem
* @param actionLogs
*/
@Override
protected void doUpdateAccount(AccAccountDto account, SystemEntityType entityType, SysSyncLogDto log, SysSyncItemLogDto logItem, List<SysSyncActionLogDto> actionLogs) {
UUID entityId = getEntityByAccount(account.getId());
IdmTreeNodeDto treeNode = null;
if (entityId != null) {
treeNode = treeNodeService.get(entityId);
}
if (treeNode == null) {
addToItemLog(logItem, "Tree account relation (with ownership = true) was not found!");
initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
return;
}
// Call provisioning for this entity
callProvisioningForEntity(treeNode, entityType, logItem);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestSchedulerTest method createAndSaveTreeNode.
private IdmTreeNodeDto createAndSaveTreeNode(IdmTreeTypeDto treeType) {
IdmTreeNodeDto entity = new IdmTreeNodeDto();
entity.setCode("valid_tree_node_" + System.currentTimeMillis());
entity.setName("valid_tree_node_" + System.currentTimeMillis());
entity.setTreeType(treeType.getId());
return saveInTransaction(entity, treeNodeService);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestSchedulerTest method createValidRole.
@Test
public void createValidRole() {
IdmIdentityDto identity = createAndSaveIdentity();
IdmRoleDto role = createAndSaveRole();
createAndSaveRoleSystem(role, system);
IdmTreeTypeDto treeType = createAndSaveTreeType();
IdmTreeNodeDto treeNode = createAndSaveTreeNode(treeType);
IdmIdentityContractDto identityContract = createAndSaveIdentityContract(identity, treeNode);
LocalDate validFrom = new LocalDate();
// set minus days
validFrom = validFrom.minusDays(5);
// provisioning is not executed
createAndSaveIdentityRole(identityContract, role, null, validFrom);
AccIdentityAccountFilter filter = new AccIdentityAccountFilter();
filter.setIdentityId(identity.getId());
AccIdentityAccountDto accountIdentity = identityAccountService.find(filter, null).getContent().get(0);
// it must exists
assertNotNull(accountIdentity);
}
Aggregations