use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class SystemMappingDeleteBulkActionTest method processBulkActionByFilter.
@Test
public void processBulkActionByFilter() {
SysSystemDto system = helper.createTestResourceSystem(true, getHelper().createName());
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setSystemId(system.getId());
List<SysSystemMappingDto> mapping = mappingService.find(filter, null).getContent();
// Contains only one created system mapping
assertEquals(1, mapping.size());
IdmBulkActionDto bulkAction = findBulkAction(SysSystemMapping.class, SystemMappingDeleteBulkAction.NAME);
bulkAction.setTransformedFilter(filter);
bulkAction.setFilter(toMap(filter));
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
mapping = mappingService.find(filter, null).getContent();
// Contains no system mapping after deletion
assertEquals(0, mapping.size());
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class TreeTypeDeleteBulkActionIntegrationTest method testForceDelete.
@Test
public void testForceDelete() {
logout();
loginAsAdmin();
// create sub tree nodes, automatic roles, contract, contract positions, system mapping and sync
IdmTreeTypeDto treeType = getHelper().createTreeType();
SysSystemDto system = getHelper().createTestResourceSystem(true, getHelper().createName());
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setSystemId(system.getId());
SysSystemMappingDto mapping = systemMappingService.find(filter, null).getContent().get(0);
mapping.setTreeType(treeType.getId());
mapping = systemMappingService.save(mapping);
SysSyncConfigDto syncConfig = new SysSyncConfigDto();
syncConfig.setName(getHelper().createName());
syncConfig.setSystemMapping(mapping.getId());
// finds mapped attributes in existing system
SysSystemAttributeMappingFilter attributeFilter = new SysSystemAttributeMappingFilter();
attributeFilter.setSystemId(system.getId());
attributeFilter.setName(TestHelper.ATTRIBUTE_MAPPING_NAME);
SysSystemAttributeMappingDto attribute = attributeMappingService.find(attributeFilter, null).getContent().get(0);
syncConfig.setCorrelationAttribute(attribute.getId());
syncConfig = (SysSyncConfigDto) syncService.save(syncConfig);
IdmRoleDto role = getHelper().createRole();
getHelper().createRoleSystem(role, system);
//
IdmTreeNodeDto treeNode = getHelper().createTreeNode(treeType, null, null);
IdmTreeNodeDto subTreeNode = getHelper().createTreeNode(treeType, (String) null, treeNode);
IdmTreeNodeDto subSubTreeNode = getHelper().createTreeNode(treeType, (String) null, subTreeNode);
IdmTreeNodeDto otherTreeNode = getHelper().createTreeNode();
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
IdmIdentityContractDto contract = getHelper().createContract(identity, subTreeNode);
IdmContractPositionDto contractPosition = getHelper().createContractPosition(contract, subSubTreeNode);
IdmIdentityRoleDto assignedRoleOne = getHelper().createIdentityRole(contract, role);
IdmIdentityRoleDto assignedRoleTwo = getHelper().createIdentityRole(contractPosition, role);
IdmIdentityRoleDto assignedRoleOther = getHelper().createIdentityRole(getHelper().getPrimeContract(identity), role);
IdmRoleTreeNodeDto automaticRole = getHelper().createRoleTreeNode(role, treeNode, RecursionType.DOWN, false);
//
// 3 manual, 2 automatic
Assert.assertEquals(5, identityRoleService.findAllByIdentity(identity.getId()).size());
//
// remove tree type
Map<String, Object> properties = new HashMap<>();
properties.put(EntityEventProcessor.PROPERTY_FORCE_DELETE, Boolean.TRUE);
// delete by bulk action
IdmBulkActionDto bulkAction = this.findBulkAction(IdmTreeType.class, TreeTypeDeleteBulkAction.NAME);
bulkAction.setIdentifiers(Sets.newHashSet(treeType.getId()));
bulkAction.setProperties(properties);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
//
checkResultLrt(processAction, 1l, 0l, 0l);
//
Assert.assertNull(treeTypeService.get(treeType));
Assert.assertNull(treeNodeService.get(treeNode));
Assert.assertNull(treeNodeService.get(subTreeNode));
Assert.assertNull(treeNodeService.get(subSubTreeNode));
Assert.assertNull(treeNodeService.get(subSubTreeNode));
Assert.assertNotNull(identityRoleService.get(assignedRoleOne));
Assert.assertNotNull(identityRoleService.get(assignedRoleTwo));
Assert.assertNull(identityContractService.get(contract).getWorkPosition());
Assert.assertNull(contractPositionService.get(contractPosition).getWorkPosition());
Assert.assertNull(roleTreeNodeService.get(automaticRole));
Assert.assertNull(systemMappingService.get(mapping));
Assert.assertNull(attributeMappingService.get(attribute));
Assert.assertNull(syncService.get(syncConfig));
//
Assert.assertNotNull(treeNodeService.get(otherTreeNode));
Assert.assertNotNull(getHelper().getPrimeContract(identity));
Assert.assertNotNull(identityRoleService.get(assignedRoleOther));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class TreeTypeDeleteBulkActionIntegrationTest method testWithoutForceDelete.
@Test(expected = TreeTypeException.class)
public void testWithoutForceDelete() {
// create sub tree nodes, automatic roles, contract, contract positions, system mapping and sync
IdmTreeTypeDto treeType = getHelper().createTreeType();
SysSystemDto system = getHelper().createTestResourceSystem(true, getHelper().createName());
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setSystemId(system.getId());
SysSystemMappingDto mapping = systemMappingService.find(filter, null).getContent().get(0);
mapping.setTreeType(treeType.getId());
mapping = systemMappingService.save(mapping);
//
treeTypeService.delete(treeType);
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemMappingService method findByObjectClass.
@Override
public List<SysSystemMappingDto> findByObjectClass(SysSchemaObjectClassDto objectClass, SystemOperationType operation, SystemEntityType entityType) {
Assert.notNull(objectClass, "Object class is required.");
//
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setObjectClassId(objectClass.getId());
filter.setOperationType(operation);
filter.setEntityType(entityType);
//
return find(filter, null).getContent();
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemMappingService method findBySystemId.
@Override
public List<SysSystemMappingDto> findBySystemId(UUID systemId, SystemOperationType operation, SystemEntityType entityType) {
Assert.notNull(systemId, "System identifier is required.");
//
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setSystemId(systemId);
filter.setOperationType(operation);
filter.setEntityType(entityType);
//
return find(filter, null).getContent();
}
Aggregations