Search in sources :

Example 1 with TelecomEntity

use of uk.gov.hscic.telecom.TelecomEntity in project gpconnect-demonstrator by nhsconnect.

the class PatientDetailsToEntityTransformer method populateTelecoms.

/**
 * details to entity
 * there must be a better way ..
 * @param patientDetails
 * @param patientEntity
 */
private void populateTelecoms(PatientDetails patientDetails, PatientEntity patientEntity) {
    ArrayList<TelecomEntity> al = new ArrayList<>();
    if (patientDetails.getTelecoms() != null) {
        for (TelecomDetails telecomDetails : patientDetails.getTelecoms()) {
            TelecomEntity telecomEntity = new TelecomEntity();
            // this has to be populated even though its wrong and get ovewritten with the correct value later
            telecomEntity.setPatientId(1L);
            telecomEntity.setSystem(telecomDetails.getSystem());
            telecomEntity.setUseType(telecomDetails.getUseType());
            telecomEntity.setValue(telecomDetails.getValue());
            al.add(telecomEntity);
        }
    }
    patientEntity.setTelecoms(al);
}
Also used : TelecomDetails(uk.gov.hscic.model.telecom.TelecomDetails) TelecomEntity(uk.gov.hscic.telecom.TelecomEntity) ArrayList(java.util.ArrayList)

Example 2 with TelecomEntity

use of uk.gov.hscic.telecom.TelecomEntity in project gpconnect-demonstrator by nhsconnect.

the class PatientEntityToDetailsTransformer method populateTelecoms.

/**
 * entity to details
 * there must be a better way ..
 * @param patientDetails
 * @param patientEntity
 */
private void populateTelecoms(PatientDetails patientDetails, PatientEntity patientEntity) {
    ArrayList<TelecomDetails> al = new ArrayList<>();
    if (patientEntity.getTelecoms() != null) {
        for (TelecomEntity telecomEntity : patientEntity.getTelecoms()) {
            TelecomDetails telecomDetails = new TelecomDetails();
            telecomDetails.setSystem(telecomEntity.getSystem());
            telecomDetails.setUseType(telecomEntity.getUseType());
            telecomDetails.setValue(telecomEntity.getValue());
            al.add(telecomDetails);
        }
    }
    patientDetails.setTelecoms(al);
}
Also used : TelecomDetails(uk.gov.hscic.model.telecom.TelecomDetails) TelecomEntity(uk.gov.hscic.telecom.TelecomEntity) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 TelecomDetails (uk.gov.hscic.model.telecom.TelecomDetails)2 TelecomEntity (uk.gov.hscic.telecom.TelecomEntity)2