Search in sources :

Example 51 with SysSystemMappingFilter

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());
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 52 with SysSystemMappingFilter

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));
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) IdmRoleTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleTreeNodeDto) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) HashMap(java.util.HashMap) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) IdmContractPositionDto(eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncConfigDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 53 with SysSystemMappingFilter

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);
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 54 with SysSystemMappingFilter

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();
}
Also used : SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)

Example 55 with SysSystemMappingFilter

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();
}
Also used : SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)

Aggregations

SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)91 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)84 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)67 Test (org.junit.Test)62 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)55 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)51 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)49 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)25 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)23 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)20 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)14 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)11 ConnectorType (eu.bcvsolutions.idm.acc.service.api.ConnectorType)11 ConnectorTypeDto (eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto)10 SysSyncIdentityConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto)10 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)8 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)8 Transactional (org.springframework.transaction.annotation.Transactional)8 SysSyncRoleConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto)7 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)7