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));
}
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));
}
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));
}
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);
}
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;
}
Aggregations