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

    valueObject.setID_PerfProcAndSignOutIntraOp(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;

    // TheatreAppointment
    if (domainObject.getTheatreAppointment() != null) {
      if (domainObject.getTheatreAppointment()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getTheatreAppointment();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setTheatreAppointment(new ims.scheduling.vo.Booking_AppointmentRefVo(id, -1));
      } else {
        valueObject.setTheatreAppointment(
            new ims.scheduling.vo.Booking_AppointmentRefVo(
                domainObject.getTheatreAppointment().getId(),
                domainObject.getTheatreAppointment().getVersion()));
      }
    }
    // Unplannedreturntotheatre
    valueObject.setUnplannedreturntotheatre(domainObject.isUnplannedreturntotheatre());
    // ConfirmedCountsComplete
    valueObject.setConfirmedCountsComplete(domainObject.isConfirmedCountsComplete());
    // AntibioticsAfterKnifeToSkin
    ims.domain.lookups.LookupInstance instance4 = domainObject.getAntibioticsAfterKnifeToSkin();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.YesNoNotApplicable voLookup4 =
          new ims.core.vo.lookups.YesNoNotApplicable(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.core.vo.lookups.YesNoNotApplicable parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.core.vo.lookups.YesNoNotApplicable(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setAntibioticsAfterKnifeToSkin(voLookup4);
    }
    // TimeIntraOpAntibioticsGiven
    java.util.Date TimeIntraOpAntibioticsGiven = domainObject.getTimeIntraOpAntibioticsGiven();
    if (null != TimeIntraOpAntibioticsGiven) {
      valueObject.setTimeIntraOpAntibioticsGiven(
          new ims.framework.utils.DateTime(TimeIntraOpAntibioticsGiven));
    }
    // AdministrationRecordCompleted
    valueObject.setAdministrationRecordCompleted(domainObject.isAdministrationRecordCompleted());
    // AnySpecimensHaveBeenLabelled
    valueObject.setAnySpecimensHaveBeenLabelled(domainObject.isAnySpecimensHaveBeenLabelled());
    // AnyEquipmentProblemsAddressed
    ims.domain.lookups.LookupInstance instance8 = domainObject.getAnyEquipmentProblemsAddressed();
    if (null != instance8) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance8.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance8.getImage().getImageId(), instance8.getImage().getImagePath());
      }
      color = instance8.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.YesNoNotApplicable voLookup8 =
          new ims.core.vo.lookups.YesNoNotApplicable(
              instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color);
      ims.core.vo.lookups.YesNoNotApplicable parentVoLookup8 = voLookup8;
      ims.domain.lookups.LookupInstance parent8 = instance8.getParent();
      while (parent8 != null) {
        if (parent8.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent8.getImage().getImageId(), parent8.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent8.getColor();
        if (color != null) color.getValue();
        parentVoLookup8.setParent(
            new ims.core.vo.lookups.YesNoNotApplicable(
                parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color));
        parentVoLookup8 = parentVoLookup8.getParent();
        parent8 = parent8.getParent();
      }
      valueObject.setAnyEquipmentProblemsAddressed(voLookup8);
    }
    // KeyConcernsDocumented
    valueObject.setKeyConcernsDocumented(domainObject.isKeyConcernsDocumented());
    // SignatureByRegisteredPractitioner
    valueObject.setSignatureByRegisteredPractitioner(
        ims.core.vo.domain.HcpLiteVoAssembler.create(
            map, domainObject.getSignatureByRegisteredPractitioner()));
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.core.admin.domain.objects.Referral
   */
  public static ims.core.vo.PASReferralVo insert(
      DomainObjectMap map,
      ims.core.vo.PASReferralVo valueObject,
      ims.core.admin.domain.objects.Referral domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_Referral(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;

    // Details
    valueObject.setDetails(domainObject.getDetails());
    // ReferralReceivedDate
    java.util.Date ReferralReceivedDate = domainObject.getReferralReceivedDate();
    if (null != ReferralReceivedDate) {
      valueObject.setReferralReceivedDate(new ims.framework.utils.Date(ReferralReceivedDate));
    }
    // OriginalReferralDate
    java.util.Date OriginalReferralDate = domainObject.getOriginalReferralDate();
    if (null != OriginalReferralDate) {
      valueObject.setOriginalReferralDate(new ims.framework.utils.Date(OriginalReferralDate));
    }
    // FirstApptDate
    java.util.Date FirstApptDate = domainObject.getFirstApptDate();
    if (null != FirstApptDate) {
      valueObject.setFirstApptDate(new ims.framework.utils.DateTime(FirstApptDate));
    }
    // SourceOfReferral
    ims.domain.lookups.LookupInstance instance5 = domainObject.getSourceOfReferral();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.SourceOfReferral voLookup5 =
          new ims.core.vo.lookups.SourceOfReferral(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.core.vo.lookups.SourceOfReferral parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.core.vo.lookups.SourceOfReferral(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setSourceOfReferral(voLookup5);
    }
    // ReferringGP
    valueObject.setReferringGP(
        ims.core.vo.domain.GpLiteVoAssembler.create(map, domainObject.getReferringGP()));
    // ReferringClinician
    valueObject.setReferringClinician(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getReferringClinician()));
    // ReferredTo
    valueObject.setReferredTo(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getReferredTo()));
    // ReferralDetails
    valueObject.setReferralDetails(domainObject.getReferralDetails());
    // DateOfReferral
    java.util.Date DateOfReferral = domainObject.getDateOfReferral();
    if (null != DateOfReferral) {
      valueObject.setDateOfReferral(new ims.framework.utils.Date(DateOfReferral));
    }
    // ReferralLocation
    valueObject.setReferralLocation(domainObject.getReferralLocation());
    // ReferralType
    ims.domain.lookups.LookupInstance instance12 = domainObject.getReferralType();
    if (null != instance12) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance12.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance12.getImage().getImageId(), instance12.getImage().getImagePath());
      }
      color = instance12.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.ReferralType voLookup12 =
          new ims.core.vo.lookups.ReferralType(
              instance12.getId(), instance12.getText(), instance12.isActive(), null, img, color);
      ims.core.vo.lookups.ReferralType parentVoLookup12 = voLookup12;
      ims.domain.lookups.LookupInstance parent12 = instance12.getParent();
      while (parent12 != null) {
        if (parent12.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent12.getImage().getImageId(), parent12.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent12.getColor();
        if (color != null) color.getValue();
        parentVoLookup12.setParent(
            new ims.core.vo.lookups.ReferralType(
                parent12.getId(), parent12.getText(), parent12.isActive(), null, img, color));
        parentVoLookup12 = parentVoLookup12.getParent();
        parent12 = parent12.getParent();
      }
      valueObject.setReferralType(voLookup12);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.oncology.domain.objects.PathologyDetails
   */
  public static ims.clinicaladmin.vo.PathologyDetailsVo insert(
      DomainObjectMap map,
      ims.clinicaladmin.vo.PathologyDetailsVo valueObject,
      ims.oncology.domain.objects.PathologyDetails domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_PathologyDetails(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;

    // InvasiveLesionSize
    valueObject.setInvasiveLesionSize(domainObject.getInvasiveLesionSize());
    // SynchronousTumourIndicator
    ims.domain.lookups.LookupInstance instance2 = domainObject.getSynchronousTumourIndicator();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.SynchronousTumourIndicator voLookup2 =
          new ims.oncology.vo.lookups.SynchronousTumourIndicator(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.oncology.vo.lookups.SynchronousTumourIndicator parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.oncology.vo.lookups.SynchronousTumourIndicator(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setSynchronousTumourIndicator(voLookup2);
    }
    // Histology
    valueObject.setHistology(
        ims.clinicaladmin.vo.domain.TumourHistologyLiteVoAssembler
            .createTumourHistologyLiteVoCollectionFromTumourHistology(
                map, domainObject.getHistology()));
    // VascularLymphInvasion
    ims.domain.lookups.LookupInstance instance4 = domainObject.getVascularLymphInvasion();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.VascularLymphInvasion voLookup4 =
          new ims.oncology.vo.lookups.VascularLymphInvasion(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.oncology.vo.lookups.VascularLymphInvasion parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.oncology.vo.lookups.VascularLymphInvasion(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setVascularLymphInvasion(voLookup4);
    }
    // ExcisionMargin
    ims.domain.lookups.LookupInstance instance5 = domainObject.getExcisionMargin();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.ExcisionMargin voLookup5 =
          new ims.oncology.vo.lookups.ExcisionMargin(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.oncology.vo.lookups.ExcisionMargin parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.oncology.vo.lookups.ExcisionMargin(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setExcisionMargin(voLookup5);
    }
    // NumberNodesExamined
    valueObject.setNumberNodesExamined(domainObject.getNumberNodesExamined());
    // NodesPositiveNumber
    valueObject.setNodesPositiveNumber(domainObject.getNodesPositiveNumber());
    // PathologicalTVal
    valueObject.setPathologicalTVal(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler.create(
            map, domainObject.getPathologicalTVal()));
    // PathologicalNVal
    valueObject.setPathologicalNVal(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler.create(
            map, domainObject.getPathologicalNVal()));
    // PathologicalMVal
    valueObject.setPathologicalMVal(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler.create(
            map, domainObject.getPathologicalMVal()));
    // PathologicalOverall
    valueObject.setPathologicalOverall(
        ims.clinicaladmin.vo.domain.TumourGroupSiteOverallStagingVoAssembler.create(
            map, domainObject.getPathologicalOverall()));
    // ServiceReportId
    valueObject.setServiceReportId(domainObject.getServiceReportId());
    // ServiceReportStatus
    ims.domain.lookups.LookupInstance instance13 = domainObject.getServiceReportStatus();
    if (null != instance13) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance13.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance13.getImage().getImageId(), instance13.getImage().getImagePath());
      }
      color = instance13.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.ServiceReportStatus voLookup13 =
          new ims.oncology.vo.lookups.ServiceReportStatus(
              instance13.getId(), instance13.getText(), instance13.isActive(), null, img, color);
      ims.oncology.vo.lookups.ServiceReportStatus parentVoLookup13 = voLookup13;
      ims.domain.lookups.LookupInstance parent13 = instance13.getParent();
      while (parent13 != null) {
        if (parent13.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent13.getImage().getImageId(), parent13.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent13.getColor();
        if (color != null) color.getValue();
        parentVoLookup13.setParent(
            new ims.oncology.vo.lookups.ServiceReportStatus(
                parent13.getId(), parent13.getText(), parent13.isActive(), null, img, color));
        parentVoLookup13 = parentVoLookup13.getParent();
        parent13 = parent13.getParent();
      }
      valueObject.setServiceReportStatus(voLookup13);
    }
    // SpecimenNature
    ims.domain.lookups.LookupInstance instance14 = domainObject.getSpecimenNature();
    if (null != instance14) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance14.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance14.getImage().getImageId(), instance14.getImage().getImagePath());
      }
      color = instance14.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.SpecimenNature voLookup14 =
          new ims.oncology.vo.lookups.SpecimenNature(
              instance14.getId(), instance14.getText(), instance14.isActive(), null, img, color);
      ims.oncology.vo.lookups.SpecimenNature parentVoLookup14 = voLookup14;
      ims.domain.lookups.LookupInstance parent14 = instance14.getParent();
      while (parent14 != null) {
        if (parent14.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent14.getImage().getImageId(), parent14.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent14.getColor();
        if (color != null) color.getValue();
        parentVoLookup14.setParent(
            new ims.oncology.vo.lookups.SpecimenNature(
                parent14.getId(), parent14.getText(), parent14.isActive(), null, img, color));
        parentVoLookup14 = parentVoLookup14.getParent();
        parent14 = parent14.getParent();
      }
      valueObject.setSpecimenNature(voLookup14);
    }
    // OrgaCodeRequester
    valueObject.setOrgaCodeRequester(
        ims.core.vo.domain.OrgLiteVoAssembler.create(map, domainObject.getOrgaCodeRequester()));
    // CareProfCodeRequester
    valueObject.setCareProfCodeRequester(
        (ims.core.vo.HcpLiteVo)
            ims.core.vo.domain.HcpLiteVoAssembler.create(
                map, domainObject.getCareProfCodeRequester()));
    // TCategoryExtended
    valueObject.setTCategoryExtended(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler
            .createTumourGroupSiteTNMValueVoCollectionFromTumourGroupSiteTNMValue(
                map, domainObject.getTCategoryExtended()));
    // MCategoryExtended
    valueObject.setMCategoryExtended(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler
            .createTumourGroupSiteTNMValueVoCollectionFromTumourGroupSiteTNMValue(
                map, domainObject.getMCategoryExtended()));
    // Status
    ims.domain.lookups.LookupInstance instance19 = domainObject.getStatus();
    if (null != instance19) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance19.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance19.getImage().getImageId(), instance19.getImage().getImagePath());
      }
      color = instance19.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.HistopathologyReportStatus voLookup19 =
          new ims.oncology.vo.lookups.HistopathologyReportStatus(
              instance19.getId(), instance19.getText(), instance19.isActive(), null, img, color);
      ims.oncology.vo.lookups.HistopathologyReportStatus parentVoLookup19 = voLookup19;
      ims.domain.lookups.LookupInstance parent19 = instance19.getParent();
      while (parent19 != null) {
        if (parent19.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent19.getImage().getImageId(), parent19.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent19.getColor();
        if (color != null) color.getValue();
        parentVoLookup19.setParent(
            new ims.oncology.vo.lookups.HistopathologyReportStatus(
                parent19.getId(), parent19.getText(), parent19.isActive(), null, img, color));
        parentVoLookup19 = parentVoLookup19.getParent();
        parent19 = parent19.getParent();
      }
      valueObject.setStatus(voLookup19);
    }
    // AuthoringInformation
    valueObject.setAuthoringInformation(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getAuthoringInformation()));
    // AssociatedQuestions
    valueObject.setAssociatedQuestions(
        ims.assessment.vo.domain.PatientAssessmentVoAssembler.create(
            map, domainObject.getAssociatedQuestions()));
    // AssociatiatedTumourDetails
    valueObject.setAssociatiatedTumourDetails(
        ims.oncology.vo.domain.PrimaryTumourDetailsShortVoAssembler.create(
            map, domainObject.getAssociatiatedTumourDetails()));
    // GradeOfDifferentation
    valueObject.setGradeOfDifferentation(
        ims.clinicaladmin.vo.domain.TumourGroupHistopathologyGradeVoAssembler.create(
            map, domainObject.getGradeOfDifferentation()));
    // InvestigationType
    ims.domain.lookups.LookupInstance instance24 = domainObject.getInvestigationType();
    if (null != instance24) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance24.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance24.getImage().getImageId(), instance24.getImage().getImagePath());
      }
      color = instance24.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.InvestigationType voLookup24 =
          new ims.oncology.vo.lookups.InvestigationType(
              instance24.getId(), instance24.getText(), instance24.isActive(), null, img, color);
      ims.oncology.vo.lookups.InvestigationType parentVoLookup24 = voLookup24;
      ims.domain.lookups.LookupInstance parent24 = instance24.getParent();
      while (parent24 != null) {
        if (parent24.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent24.getImage().getImageId(), parent24.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent24.getColor();
        if (color != null) color.getValue();
        parentVoLookup24.setParent(
            new ims.oncology.vo.lookups.InvestigationType(
                parent24.getId(), parent24.getText(), parent24.isActive(), null, img, color));
        parentVoLookup24 = parentVoLookup24.getParent();
        parent24 = parent24.getParent();
      }
      valueObject.setInvestigationType(voLookup24);
    }
    // SampleReceiptDate
    java.util.Date SampleReceiptDate = domainObject.getSampleReceiptDate();
    if (null != SampleReceiptDate) {
      valueObject.setSampleReceiptDate(new ims.framework.utils.Date(SampleReceiptDate));
    }
    // InvestigationResultDate
    java.util.Date InvestigationResultDate = domainObject.getInvestigationResultDate();
    if (null != InvestigationResultDate) {
      valueObject.setInvestigationResultDate(new ims.framework.utils.Date(InvestigationResultDate));
    }
    // ReportingConsultantCode
    valueObject.setReportingConsultantCode(
        (ims.core.vo.HcpLiteVo)
            ims.core.vo.domain.HcpLiteVoAssembler.create(
                map, domainObject.getReportingConsultantCode()));
    // ReportingOrganisation
    valueObject.setReportingOrganisation(
        ims.core.vo.domain.OrgLiteVoAssembler.create(map, domainObject.getReportingOrganisation()));
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    // PreviousVersion
    if (domainObject.getPreviousVersion() != null) {
      if (domainObject.getPreviousVersion()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPreviousVersion();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPreviousVersion(new ims.oncology.vo.PathologyDetailsRefVo(id, -1));
      } else {
        valueObject.setPreviousVersion(
            new ims.oncology.vo.PathologyDetailsRefVo(
                domainObject.getPreviousVersion().getId(),
                domainObject.getPreviousVersion().getVersion()));
      }
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.ocrr.orderingresults.domain.objects.OcsOrderSession
   */
  public static ims.ocrr.vo.OcsOrderVo insert(
      DomainObjectMap map,
      ims.ocrr.vo.OcsOrderVo valueObject,
      ims.ocrr.orderingresults.domain.objects.OcsOrderSession domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_OcsOrderSession(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;

    // ClinicalTrial
    valueObject.setClinicalTrial(domainObject.isClinicalTrial());
    // ClinicalTrialTxt
    valueObject.setClinicalTrialTxt(domainObject.getClinicalTrialTxt());
    // PatMobility
    ims.domain.lookups.LookupInstance instance3 = domainObject.getPatMobility();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.OrderPatMobility voLookup3 =
          new ims.ocrr.vo.lookups.OrderPatMobility(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.ocrr.vo.lookups.OrderPatMobility parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.ocrr.vo.lookups.OrderPatMobility(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setPatMobility(voLookup3);
    }
    // OrderCategory
    ims.domain.lookups.LookupInstance instance4 = domainObject.getOrderCategory();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.OrderCategory voLookup4 =
          new ims.ocrr.vo.lookups.OrderCategory(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.ocrr.vo.lookups.OrderCategory parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.ocrr.vo.lookups.OrderCategory(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setOrderCategory(voLookup4);
    }
    // specimens
    valueObject.setSpecimens(
        ims.ocrr.vo.domain.OrderSpecimenVoAssembler
            .createOrderSpecimenVoCollectionFromOrderSpecimen(map, domainObject.getSpecimens()));
    // Investigations
    valueObject.setInvestigations(
        ims.ocrr.vo.domain.OrderInvestigationVoAssembler
            .createOrderInvestigationVoCollectionFromOrderInvestigation(
                map, domainObject.getInvestigations()));
    // wasProcessed
    valueObject.setWasProcessed(domainObject.isWasProcessed());
    // ClinicalInfo
    valueObject.setClinicalInfo(
        ims.ocrr.vo.domain.OcsQASessionVoAssembler.create(map, domainObject.getClinicalInfo()));
    // ReportTo
    valueObject.setReportTo(
        ims.ocrr.vo.domain.OcsReportToVoAssembler.createOcsReportToVoCollectionFromOcsReportTo(
            map, domainObject.getReportTo()));
    // SummaryClinicalInformation
    valueObject.setSummaryClinicalInformation(domainObject.getSummaryClinicalInformation());
    // BleepExtNumber
    valueObject.setBleepExtNumber(domainObject.getBleepExtNumber());
    // ClinicalContact
    if (domainObject.getClinicalContact() != null) {
      if (domainObject.getClinicalContact()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1));
      } else {
        valueObject.setClinicalContact(
            new ims.core.admin.vo.ClinicalContactRefVo(
                domainObject.getClinicalContact().getId(),
                domainObject.getClinicalContact().getVersion()));
      }
    }
    // Patient
    valueObject.setPatient(
        ims.core.vo.domain.PatientShortAssembler.create(map, domainObject.getPatient()));
    // OrderedBy
    valueObject.setOrderedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getOrderedBy()));
    // ResponsibleClinician
    valueObject.setResponsibleClinician(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getResponsibleClinician()));
    // ResponsibleGp
    valueObject.setResponsibleGp(
        ims.core.vo.domain.GpLiteVoAssembler.create(map, domainObject.getResponsibleGp()));
    // PatientLocation
    valueObject.setPatientLocation(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getPatientLocation()));
    // PatientClinic
    valueObject.setPatientClinic(
        ims.core.vo.domain.ClinicLiteVoAssembler.create(map, domainObject.getPatientClinic()));
    // AdditClinNotes
    valueObject.setAdditClinNotes(domainObject.getAdditClinNotes());
    // SysInfo
    // set system information
    valueObject.setSysInfo(
        ims.vo.domain.SystemInformationAssembler.create(domainObject.getSystemInformation()));
    // CareContext
    valueObject.setCareContext(
        ims.core.vo.domain.CareContextPasVoAssembler.create(map, domainObject.getCareContext()));
    // OrderingHospital
    if (domainObject.getOrderingHospital() != null) {
      if (domainObject.getOrderingHospital()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getOrderingHospital();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setOrderingHospital(new ims.core.resource.place.vo.LocSiteRefVo(id, -1));
      } else {
        valueObject.setOrderingHospital(
            new ims.core.resource.place.vo.LocSiteRefVo(
                domainObject.getOrderingHospital().getId(),
                domainObject.getOrderingHospital().getVersion()));
      }
    }
    // OutpatientDept
    valueObject.setOutpatientDept(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getOutpatientDept()));
    // AuthorisationOrderStatus
    ims.domain.lookups.LookupInstance instance24 = domainObject.getAuthorisationOrderStatus();
    if (null != instance24) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance24.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance24.getImage().getImageId(), instance24.getImage().getImagePath());
      }
      color = instance24.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.AuthorisationOrderStatus voLookup24 =
          new ims.ocrr.vo.lookups.AuthorisationOrderStatus(
              instance24.getId(), instance24.getText(), instance24.isActive(), null, img, color);
      ims.ocrr.vo.lookups.AuthorisationOrderStatus parentVoLookup24 = voLookup24;
      ims.domain.lookups.LookupInstance parent24 = instance24.getParent();
      while (parent24 != null) {
        if (parent24.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent24.getImage().getImageId(), parent24.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent24.getColor();
        if (color != null) color.getValue();
        parentVoLookup24.setParent(
            new ims.ocrr.vo.lookups.AuthorisationOrderStatus(
                parent24.getId(), parent24.getText(), parent24.isActive(), null, img, color));
        parentVoLookup24 = parentVoLookup24.getParent();
        parent24 = parent24.getParent();
      }
      valueObject.setAuthorisationOrderStatus(voLookup24);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment
   */
  public static ims.nursing.vo.NutritionalRiskAssessmentVo insert(
      DomainObjectMap map,
      ims.nursing.vo.NutritionalRiskAssessmentVo valueObject,
      ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_Assessment(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;

    // AssessmentDetails
    valueObject.setAssessmentDetails(
        ims.nursing.vo.domain.NutritionalRiskAssessmentDetailsVoAssembler
            .createNutritionalRiskAssessmentDetailsVoCollectionFromNutritionalRiskAssessmentDetails(
                map, domainObject.getAssessmentDetails()));
    // HcpInitiated
    valueObject.setHcpInitiated(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getHcpInitiated()));
    // DateTimeInitiated
    java.util.Date DateTimeInitiated = domainObject.getDateTimeInitiated();
    if (null != DateTimeInitiated) {
      valueObject.setDateTimeInitiated(new ims.framework.utils.DateTime(DateTimeInitiated));
    }
    // ClinicalContact
    if (domainObject.getClinicalContact() != null) {
      if (domainObject.getClinicalContact()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1));
      } else {
        valueObject.setClinicalContact(
            new ims.core.admin.vo.ClinicalContactRefVo(
                domainObject.getClinicalContact().getId(),
                domainObject.getClinicalContact().getVersion()));
      }
    }
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.ocrr.orderingresults.domain.objects.OcsOrderSession
   */
  public static ims.ocs_if.vo.IfOcsOrderShortVo insert(
      DomainObjectMap map,
      ims.ocs_if.vo.IfOcsOrderShortVo valueObject,
      ims.ocrr.orderingresults.domain.objects.OcsOrderSession domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_OcsOrderSession(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;

    // Patient
    if (domainObject.getPatient() != null) {
      if (domainObject.getPatient()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPatient();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPatient(new ims.core.patient.vo.PatientRefVo(id, -1));
      } else {
        valueObject.setPatient(
            new ims.core.patient.vo.PatientRefVo(
                domainObject.getPatient().getId(), domainObject.getPatient().getVersion()));
      }
    }
    // OrderedBy
    valueObject.setOrderedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getOrderedBy()));
    // ResponsibleClinician
    valueObject.setResponsibleClinician(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getResponsibleClinician()));
    // ResponsibleGp
    valueObject.setResponsibleGp(
        ims.core.vo.domain.GpLiteVoAssembler.create(map, domainObject.getResponsibleGp()));
    // PatientLocation
    if (domainObject.getPatientLocation() != null) {
      if (domainObject.getPatientLocation()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPatientLocation();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPatientLocation(new ims.core.resource.place.vo.LocationRefVo(id, -1));
      } else {
        valueObject.setPatientLocation(
            new ims.core.resource.place.vo.LocationRefVo(
                domainObject.getPatientLocation().getId(),
                domainObject.getPatientLocation().getVersion()));
      }
    }
    // PatientClinic
    if (domainObject.getPatientClinic() != null) {
      if (domainObject.getPatientClinic()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPatientClinic();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPatientClinic(new ims.core.resource.place.vo.ClinicRefVo(id, -1));
      } else {
        valueObject.setPatientClinic(
            new ims.core.resource.place.vo.ClinicRefVo(
                domainObject.getPatientClinic().getId(),
                domainObject.getPatientClinic().getVersion()));
      }
    }
    // AdditClinNotes
    valueObject.setAdditClinNotes(domainObject.getAdditClinNotes());
    // SendNumber
    valueObject.setSendNumber(domainObject.isSendNumber());
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.core.clinical.domain.objects.IntraOperativeCareRecord
   */
  public static ims.clinical.vo.IntraOperativeCareRecordShortVo insert(
      DomainObjectMap map,
      ims.clinical.vo.IntraOperativeCareRecordShortVo valueObject,
      ims.core.clinical.domain.objects.IntraOperativeCareRecord domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_IntraOperativeCareRecord(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;

    // IntraOperativeDetails
    valueObject.setIntraOperativeDetails(
        ims.clinical.vo.domain.IntraOperativeDetailsLiteVoAssembler.create(
            map, domainObject.getIntraOperativeDetails()));
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    // ActualProcedure
    valueObject.setActualProcedure(
        ims.core.vo.domain.PatientProcedureForSurgicalOperationNotesVoAssembler.create(
            map, domainObject.getActualProcedure()));
    // ProcedureDate
    java.util.Date ProcedureDate = domainObject.getProcedureDate();
    if (null != ProcedureDate) {
      valueObject.setProcedureDate(new ims.framework.utils.Date(ProcedureDate));
    }
    // Theatre
    valueObject.setTheatre(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getTheatre()));
    // Surgeon
    valueObject.setSurgeon(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getSurgeon()));
    return valueObject;
  }