use of com.odysseusinc.arachne.portal.exception.NoDTOConverterException in project ArachneCentralAPI by OHDSI.
the class BaseUserToCommonUserDTOConverter method convert.
@Override
public DTO convert(IUser user) {
final DTO dto = createResultObject();
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;
}
use of com.odysseusinc.arachne.portal.exception.NoDTOConverterException 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;
}
use of com.odysseusinc.arachne.portal.exception.NoDTOConverterException in project ArachneCentralAPI by OHDSI.
the class UserToUserProfileGeneralDTOConverter method convert.
@Override
public UserProfileGeneralDTO convert(IUser user) {
UserProfileGeneralDTO dto = new UserProfileGeneralDTO();
dto.setFirstname(user.getFirstname());
dto.setMiddlename(user.getMiddlename());
dto.setLastname(user.getLastname());
dto.setPersonalSummary(user.getPersonalSummary());
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");
}
}
dto.setPhone(user.getPhone());
dto.setMobile(user.getMobile());
dto.setAddress1(user.getAddress1());
dto.setAddress2(user.getAddress2());
dto.setCity(user.getCity());
if (user.getStateProvince() != null) {
dto.setStateProvinceId(user.getStateProvince().getId());
}
dto.setZipCode(user.getZipCode());
if (user.getCountry() != null) {
dto.setCountry(conversionService.convert(user.getCountry(), CountryDTO.class));
}
dto.setAffiliation(user.getAffiliation());
dto.setContactEmail(user.getContactEmail());
return dto;
}
Aggregations