Search in sources :

Example 1 with StateProvince

use of com.odysseusinc.arachne.portal.model.StateProvince in project ArachneCentralAPI by OHDSI.

the class BaseUserServiceImpl method baseUpdate.

private U baseUpdate(U forUpdate, U user) {
    final Date date = new Date();
    forUpdate.setId(user.getId());
    if (user.getFirstname() != null) {
        forUpdate.setFirstname(user.getFirstname());
    }
    if (user.getMiddlename() != null) {
        forUpdate.setMiddlename(user.getMiddlename());
    }
    if (user.getLastname() != null) {
        forUpdate.setLastname(user.getLastname());
    }
    forUpdate.setEnabled(user.getEnabled() != null ? user.getEnabled() : forUpdate.getEnabled());
    forUpdate.setUpdated(date);
    if (user.getProfessionalType() != null) {
        ProfessionalType professionalType = professionalTypeService.getById(user.getProfessionalType().getId());
        if (professionalType != null) {
            forUpdate.setProfessionalType(professionalType);
        }
    }
    if (user.getPhone() != null) {
        forUpdate.setPhone(user.getPhone());
    }
    if (user.getMobile() != null) {
        forUpdate.setMobile(user.getMobile());
    }
    if (user.getAddress1() != null) {
        forUpdate.setAddress1(user.getAddress1());
    }
    if (user.getAddress2() != null) {
        forUpdate.setAddress2(user.getAddress2());
    }
    if (user.getCity() != null) {
        forUpdate.setCity(user.getCity());
    }
    if (user.getZipCode() != null) {
        forUpdate.setZipCode(user.getZipCode());
    }
    if (user.getCountry() != null) {
        Country country = countryRepository.findOne(user.getCountry().getId());
        if (country != null) {
            forUpdate.setCountry(country);
        }
    }
    if (user.getStateProvince() != null) {
        StateProvince stateProvince = stateProvinceRepository.findOne(user.getStateProvince().getId());
        if (stateProvince != null) {
            forUpdate.setStateProvince(stateProvince);
        }
    }
    if (user.getAffiliation() != null) {
        forUpdate.setAffiliation(user.getAffiliation());
    }
    if (user.getPersonalSummary() != null) {
        forUpdate.setPersonalSummary(user.getPersonalSummary());
    }
    if (user.getContactEmail() != null) {
        forUpdate.setContactEmail(user.getContactEmail());
    }
    if (user.getTenants() != null) {
        forUpdate.setTenants(user.getTenants());
    }
    return forUpdate;
}
Also used : StateProvince(com.odysseusinc.arachne.portal.model.StateProvince) Country(com.odysseusinc.arachne.portal.model.Country) ProfessionalType(com.odysseusinc.arachne.portal.model.ProfessionalType) Date(java.util.Date)

Example 2 with StateProvince

use of com.odysseusinc.arachne.portal.model.StateProvince in project ArachneCentralAPI by OHDSI.

the class StateProvinceDTOToStateProvinceConverter method convert.

@Override
public StateProvince convert(StateProvinceDTO dto) {
    StateProvince stateProvince = new StateProvince();
    stateProvince.setId(dto.getId());
    stateProvince.setName(dto.getName());
    stateProvince.setIsoCode(dto.getIsoCode());
    return stateProvince;
}
Also used : StateProvince(com.odysseusinc.arachne.portal.model.StateProvince)

Aggregations

StateProvince (com.odysseusinc.arachne.portal.model.StateProvince)2 Country (com.odysseusinc.arachne.portal.model.Country)1 ProfessionalType (com.odysseusinc.arachne.portal.model.ProfessionalType)1 Date (java.util.Date)1