Search in sources :

Example 31 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class SysProvisioningOperationFilterIntegrationTest method resultStateFilterTest.

@Test
public void resultStateFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system = createSystem();
    OperationResult resultState = new OperationResult();
    resultState.setState(OperationState.CREATED);
    SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system);
    SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system);
    provisioningOperation2.setResult(resultState);
    operationService.save(provisioningOperation2);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setResultState(OperationState.CREATED);
    filter.setSystemId(system.getId());
    Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningOperation2));
    assertFalse(result.getContent().contains(provisioningOperation1));
}
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) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 32 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class SysProvisioningOperationFilterIntegrationTest method operationTypeFilterTest.

@Test
public void operationTypeFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system = createSystem();
    SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system);
    SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system);
    provisioningOperation2.setOperationType(ProvisioningEventType.CANCEL);
    operationService.save(provisioningOperation2);
    SysProvisioningOperationDto provisioningOperation3 = createProvisioningOperation(entityType, system);
    provisioningOperation3.setOperationType(ProvisioningEventType.CANCEL);
    operationService.save(provisioningOperation3);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemId(system.getId());
    filter.setOperationType(ProvisioningEventType.CANCEL);
    Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
    assertEquals(2, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningOperation2));
    assertFalse(result.getContent().contains(provisioningOperation1));
}
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) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 33 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class SysProvisioningOperationFilterIntegrationTest method entityIdentifierFilterTest.

@Test
public void entityIdentifierFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system = createSystem();
    createProvisioningOperation(entityType, system);
    SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system);
    provisioningOperation1.setEntityIdentifier(UUID.randomUUID());
    operationService.save(provisioningOperation1);
    SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setEntityIdentifier(provisioningOperation1.getEntityIdentifier());
    filter.setSystemId(system.getId());
    Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(provisioningOperation1));
    assertFalse(result.getContent().contains(provisioningOperation2));
}
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) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 34 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemMappingService method saveInternal.

@Override
@Transactional
public SysSystemMappingDto saveInternal(SysSystemMappingDto dto) {
    SystemEntityType entityType = dto.getEntityType();
    if (SystemOperationType.PROVISIONING == dto.getOperationType() && !entityType.isSupportsProvisioning()) {
        throw new ResultCodeException(AccResultCode.PROVISIONING_NOT_SUPPORTS_ENTITY_TYPE, ImmutableMap.of("entityType", entityType));
    }
    // Validate all sub attributes
    getAttributeMappingService().findBySystemMapping(dto).forEach(attribute -> {
        getAttributeMappingService().validate(attribute, dto);
    });
    return super.saveInternal(dto);
}
Also used : SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 35 with SystemEntityType

use of eu.bcvsolutions.idm.acc.domain.SystemEntityType in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemMappingService method toPredicates.

@Override
protected List<Predicate> toPredicates(Root<SysSystemMapping> root, CriteriaQuery<?> query, CriteriaBuilder builder, SysSystemMappingFilter filter) {
    List<Predicate> predicates = super.toPredicates(root, query, builder, filter);
    // 
    String text = filter.getText();
    if (StringUtils.isNotEmpty(text)) {
        text = text.toLowerCase();
        List<Predicate> textPredicates = new ArrayList<>(2);
        // 
        textPredicates.add(builder.like(builder.lower(root.get(SysSystemMapping_.name)), "%" + text + "%"));
        textPredicates.add(builder.like(builder.lower(root.get(SysSystemMapping_.objectClass).get(SysSchemaObjectClass_.system).get(SysSystem_.name)), "%" + text + "%"));
        // 
        predicates.add(builder.or(textPredicates.toArray(new Predicate[textPredicates.size()])));
    }
    // 
    UUID systemId = filter.getSystemId();
    if (systemId != null) {
        predicates.add(builder.equal(root.get(SysSystemMapping_.objectClass).get(SysSchemaObjectClass_.system).get(SysSystem_.id), systemId));
    }
    UUID objectClassId = filter.getObjectClassId();
    if (objectClassId != null) {
        predicates.add(builder.equal(root.get(SysSystemMapping_.objectClass).get(SysSchemaObjectClass_.id), objectClassId));
    }
    SystemOperationType operationType = filter.getOperationType();
    if (operationType != null) {
        predicates.add(builder.equal(root.get(SysSystemMapping_.operationType), operationType));
    }
    UUID treeTypeId = filter.getTreeTypeId();
    if (treeTypeId != null) {
        predicates.add(builder.equal(root.get(SysSystemMapping_.treeType).get(IdmTreeType_.id), treeTypeId));
    }
    // 
    SystemEntityType entityType = filter.getEntityType();
    if (entityType != null) {
        predicates.add(builder.equal(root.get(SysSystemMapping_.entityType), entityType));
    }
    // 
    return predicates;
}
Also used : SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) ArrayList(java.util.ArrayList) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) UUID(java.util.UUID) Predicate(javax.persistence.criteria.Predicate)

Aggregations

SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)71 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)51 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)36 Test (org.junit.Test)36 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)28 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)28 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)26 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)21 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)17 UUID (java.util.UUID)17 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)15 SysSyncActionLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto)15 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)15 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)15 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)13 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)11 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)11 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)11 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)10 SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)10