use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter in project CzechIdMng by bcvsolutions.
the class IdmRoleRequestController method toFilter.
@Override
protected IdmRoleRequestFilter toFilter(MultiValueMap<String, Object> parameters) {
IdmRoleRequestFilter filter = new IdmRoleRequestFilter(parameters, getParameterConverter());
//
filter.setApplicant(getParameterConverter().toString(parameters, "applicant"));
filter.setApplicantId(getParameterConverter().toUuid(parameters, "applicantId"));
//
if (filter.getApplicant() != null) {
try {
// Applicant can be UUID (Username vs UUID identification schizma)
// TODO: replace with parameterConverter#toEntityUuid ...
filter.setApplicantId(UUID.fromString(filter.getApplicant()));
filter.setApplicant(null);
} catch (IllegalArgumentException ex) {
// Ok applicant is not UUID
}
}
// TODO: remove redundant state field
filter.setState(getParameterConverter().toEnum(parameters, "state", RoleRequestState.class));
filter.setStates(getParameterConverter().toEnums(parameters, "states", RoleRequestState.class));
filter.setSystemStates(getParameterConverter().toEnums(parameters, "systemStates", OperationState.class));
filter.setApplicants(getParameterConverter().toUuids(parameters, "applicants"));
filter.setCreatorId(getParameterConverter().toEntityUuid(parameters, IdmRoleRequestFilter.PARAMETER_CREATOR_ID, IdmIdentityDto.class));
filter.setExecuted(getParameterConverter().toBoolean(parameters, "executed"));
filter.setIncludeApprovers(getParameterConverter().toBoolean(parameters, "includeApprovers", false));
return filter;
}
use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleServiceIntegrationTest method testCreateConceptRoleWithoutRequiredValue.
@Test(expected = ResultCodeException.class)
public void testCreateConceptRoleWithoutRequiredValue() throws Exception {
IdmIdentityDto identity = getHelper().createIdentity();
IdmRoleDto role = createRoleWithAttributes();
IdmIdentityContractDto identityContact = getHelper().createContract(identity);
IdmRoleRequestDto roleRequest = getHelper().createRoleRequest(identityContact, role);
// Get request by id
String response = getMockMvc().perform(get(getDetailRoleRequestUrl(roleRequest.getId())).with(authentication(getAdminAuthentication())).contentType(TestHelper.HAL_CONTENT_TYPE)).andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
IdmRoleRequestDto createdDto = (IdmRoleRequestDto) getMapper().readValue(response, roleRequest.getClass());
// Request from REST doesn't contains concept (from version 9.7.0!)
assertTrue(createdDto.getConceptRoles().isEmpty());
roleRequestService.validate(createdDto);
roleRequestService.validate(roleRequestService.get(createdDto.getId(), new IdmRoleRequestFilter(true)));
}
Aggregations