Search in sources :

Example 16 with SysProvisioningArchiveDto

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

the class DefaultSysProvisioningArchiveServiceTest method systemEntityUidFilterTest.

@Test
public void systemEntityUidFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system = createRoleSystem();
    SysProvisioningArchiveDto provisioningArchive1 = createProvisioningArchive(entityType, system);
    SysProvisioningArchiveDto provisioningArchive2 = createProvisioningArchive(entityType, system);
    SysProvisioningArchiveDto provisioningArchive3 = createProvisioningArchive(entityType, system);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemEntityUid(provisioningArchive1.getSystemEntityUid());
    Page<SysProvisioningArchiveDto> result = archiveService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningArchive1));
    assertFalse(result.getContent().contains(provisioningArchive2));
    assertFalse(result.getContent().contains(provisioningArchive3));
}
Also used : SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 17 with SysProvisioningArchiveDto

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

the class DefaultSysProvisioningArchiveService method archive.

@Override
// we want log in archive always
@Transactional(propagation = Propagation.REQUIRES_NEW)
public SysProvisioningArchiveDto archive(SysProvisioningOperationDto provisioningOperation) {
    Builder builder = new SysProvisioningArchiveDto.Builder(provisioningOperation);
    if (provisioningOperation.getSystemEntity() != null) {
        SysSystemEntityDto systemEntity = systemEntityService.get(provisioningOperation.getSystemEntity());
        builder.setSystemEntityUid(systemEntity.getUid());
    }
    SysProvisioningArchiveDto archive = builder.build();
    // preserve original operation creator
    archive.setCreator(provisioningOperation.getCreator());
    archive.setCreatorId(provisioningOperation.getCreatorId());
    archive.setOriginalCreator(provisioningOperation.getOriginalCreator());
    archive.setOriginalCreatorId(provisioningOperation.getOriginalCreatorId());
    return save(archive);
}
Also used : Builder(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto.Builder) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)17 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)15 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)14 Test (org.junit.Test)14 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)12 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)8 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)6 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)6 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)6 IdmContractGuaranteeDto (eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto)4 ProvisioningContext (eu.bcvsolutions.idm.acc.domain.ProvisioningContext)3 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)3 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)2 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)2 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)2 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)2 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)2 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)2 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)2 ArrayList (java.util.ArrayList)2