Search in sources :

Example 1 with RoleType

use of eu.bcvsolutions.idm.core.api.domain.RoleType in project CzechIdMng by bcvsolutions.

the class IdmRoleController method toFilter.

@Override
protected IdmRoleFilter toFilter(MultiValueMap<String, Object> parameters) {
    IdmRoleFilter filter = new IdmRoleFilter(parameters);
    filter.setText(getParameterConverter().toString(parameters, "text"));
    filter.setRoleType(getParameterConverter().toEnum(parameters, "roleType", RoleType.class));
    filter.setRoleCatalogueId(getParameterConverter().toUuid(parameters, "roleCatalogue"));
    filter.setGuaranteeId(getParameterConverter().toEntityUuid(parameters, "guarantee", IdmIdentity.class));
    return filter;
}
Also used : IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) RoleType(eu.bcvsolutions.idm.core.api.domain.RoleType) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity)

Example 2 with RoleType

use of eu.bcvsolutions.idm.core.api.domain.RoleType in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleServiceIntegrationTest method typeFilterTest.

@Test
public void typeFilterTest() {
    IdmRoleDto role = helper.createRole();
    IdmRoleDto role2 = helper.createRole();
    IdmRoleDto role3 = helper.createRole();
    RoleType type = RoleType.LOGIN;
    RoleType type2 = RoleType.BUSINESS;
    role = roleService.get(role.getId());
    role.setRoleType(type);
    role = roleService.save(role);
    role2 = roleService.get(role2.getId());
    role2.setRoleType(type);
    role2 = roleService.save(role2);
    role3 = roleService.get(role3.getId());
    role3.setRoleType(type2);
    role3 = roleService.save(role3);
    IdmRoleFilter filter = new IdmRoleFilter();
    filter.setRoleType(type);
    Page<IdmRoleDto> result = roleService.find(filter, null);
    assertEquals("Wrong type #1", 2, result.getTotalElements());
    assertTrue("Wrong type #1 contains", result.getContent().contains(role));
    filter.setRoleType(type2);
    result = roleService.find(filter, null);
    assertEquals("Wrong type #2", 1, result.getTotalElements());
    assertTrue("Wrong type #2 contains", result.getContent().contains(role3));
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) RoleType(eu.bcvsolutions.idm.core.api.domain.RoleType) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

RoleType (eu.bcvsolutions.idm.core.api.domain.RoleType)2 IdmRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter)2 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)1 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)1 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)1 Test (org.junit.Test)1