/**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.RefMan.domain.objects.ConsultationClinicalNotes
   */
  public static ims.RefMan.vo.ConsultationClinicalNotesVo insert(
      DomainObjectMap map,
      ims.RefMan.vo.ConsultationClinicalNotesVo valueObject,
      ims.RefMan.domain.objects.ConsultationClinicalNotes domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_ConsultationClinicalNotes(domainObject.getId());
    valueObject.setIsRIE(domainObject.getIsRIE());

    // If this is a recordedInError record, and the domainObject
    // value isIncludeRecord has not been set, then we return null and
    // not the value object
    if (valueObject.getIsRIE() != null
        && valueObject.getIsRIE().booleanValue() == true
        && !domainObject.isIncludeRecord()) return null;

    // If this is not a recordedInError record, and the domainObject
    // value isIncludeRecord has been set, then we return null and
    // not the value object
    if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false)
        && domainObject.isIncludeRecord()) return null;

    // HistoryPresentingComplaint
    valueObject.setHistoryPresentingComplaint(domainObject.getHistoryPresentingComplaint());
    // RelevantPMH
    valueObject.setRelevantPMH(domainObject.getRelevantPMH());
    // OtherRelevantHistory
    valueObject.setOtherRelevantHistory(domainObject.getOtherRelevantHistory());
    // RelevantMedication
    valueObject.setRelevantMedication(domainObject.getRelevantMedication());
    // Examination
    valueObject.setExamination(domainObject.getExamination());
    // hasNoKnownAllergies
    valueObject.setHasNoKnownAllergies(domainObject.isHasNoKnownAllergies());
    // Allergies
    valueObject.setAllergies(
        ims.core.vo.domain.PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(
            map, domainObject.getAllergies()));
    // seeScannedNotes
    valueObject.setSeeScannedNotes(domainObject.isSeeScannedNotes());
    // NotesDictated
    valueObject.setNotesDictated(domainObject.isNotesDictated());
    // IncludeNotesInGpReport
    valueObject.setIncludeNotesInGpReport(domainObject.isIncludeNotesInGpReport());
    // ClinicalImpression
    valueObject.setClinicalImpression(domainObject.getClinicalImpression());
    // HealthQuestionnaireCompleted
    valueObject.setHealthQuestionnaireCompleted(domainObject.isHealthQuestionnaireCompleted());
    // CatsReferral
    if (domainObject.getCatsReferral() != null) {
      if (domainObject.getCatsReferral()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCatsReferral();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCatsReferral(new ims.RefMan.vo.CatsReferralRefVo(id, -1));
      } else {
        valueObject.setCatsReferral(
            new ims.RefMan.vo.CatsReferralRefVo(
                domainObject.getCatsReferral().getId(),
                domainObject.getCatsReferral().getVersion()));
      }
    }
    // RecordingInformation
    valueObject.setRecordingInformation(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getRecordingInformation()));
    // LastUpdatingHCP
    valueObject.setLastUpdatingHCP(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getLastUpdatingHCP()));
    // InitiallySeenBy
    valueObject.setInitiallySeenBy(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getInitiallySeenBy()));
    return valueObject;
  }