use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserDTO in project ArachneCentralAPI by OHDSI.
the class BaseExpertFinderController method get.
@ApiOperation("Get user by id")
@RequestMapping(value = "/api/v1/user-management/users/{id}", method = GET)
public JsonResult<CommonUserDTO> get(@PathVariable("id") Long id) {
JsonResult<CommonUserDTO> result;
U user = userService.getByIdInAnyTenant(id);
CommonUserDTO userDTO = conversionService.convert(user, CommonUserDTO.class);
result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
result.setResult(userDTO);
return result;
}
use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserDTO in project ArachneCentralAPI by OHDSI.
the class BaseUserController method create.
@ApiOperation("Create new user")
@RequestMapping(value = "/api/v1/admin/users", method = POST)
public CommonUserDTO create(@RequestBody @Valid CommonUserRegistrationDTO dto) throws PasswordValidationException {
CommonUserDTO result;
U user = convertRegistrationDTO(dto);
user.setEmailConfirmed(false);
user = userService.create(user);
result = conversionService.convert(user, CommonUserDTO.class);
return result;
}
use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserDTO in project ArachneCentralAPI by OHDSI.
the class BaseExpertFinderController method buildResponse.
private JsonResult<CommonUserDTO> buildResponse(U user) {
CommonUserDTO userDTO = conversionService.convert(user, CommonUserDTO.class);
JsonResult<CommonUserDTO> result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
result.setResult(userDTO);
return result;
}
use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserDTO in project ArachneCentralAPI by OHDSI.
the class UserToCommonUserDTOConverter method convert.
@Override
public CommonUserDTO convert(IUser user) {
CommonUserDTO dto = new CommonUserDTO();
dto.setId(UserIdUtils.idToUuid(user.getId()));
dto.setPassword("");
dto.setEmail(user.getEmail());
dto.setFirstname(user.getFirstname());
dto.setMiddlename(user.getMiddlename());
dto.setLastname(user.getLastname());
dto.setUsername(user.getUsername());
dto.setEmailConfirmed(user.getEmailConfirmed());
dto.setEnabled(user.getEnabled());
dto.setCreated(user.getCreated());
dto.setUpdated(user.getUpdated());
if (user.getProfessionalType() != null) {
if (conversionService.canConvert(ProfessionalType.class, CommonProfessionalTypeDTO.class)) {
dto.setProfessionalType(conversionService.convert(user.getProfessionalType(), CommonProfessionalTypeDTO.class));
} else {
throw new NoDTOConverterException("cannot convert ProfessionalType to ProfessionaltypeDTO");
}
}
return dto;
}
Aggregations