public static ims.core.clinical.domain.objects.IntraOperativeCareRecord
      extractIntraOperativeCareRecord(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.clinical.vo.IntraOperativeCareRecordShortVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_IntraOperativeCareRecord();
    ims.core.clinical.domain.objects.IntraOperativeCareRecord domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.clinical.domain.objects.IntraOperativeCareRecord) domMap.get(valueObject);
      }
      // ims.clinical.vo.IntraOperativeCareRecordShortVo ID_IntraOperativeCareRecord field is
      // unknown
      domainObject = new ims.core.clinical.domain.objects.IntraOperativeCareRecord();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_IntraOperativeCareRecord());
      if (domMap.get(key) != null) {
        return (ims.core.clinical.domain.objects.IntraOperativeCareRecord) domMap.get(key);
      }
      domainObject =
          (ims.core.clinical.domain.objects.IntraOperativeCareRecord)
              domainFactory.getDomainObject(
                  ims.core.clinical.domain.objects.IntraOperativeCareRecord.class, id);

      // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception,
      // but maybe should be handled as that further up.
      if (domainObject == null) return null;

      domMap.put(key, domainObject);
    }
    domainObject.setVersion(valueObject.getVersion_IntraOperativeCareRecord());

    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.clinical.domain.objects.IntraOperativeDetails value1 = null;
    if (null != valueObject.getIntraOperativeDetails()) {
      if (valueObject.getIntraOperativeDetails().getBoId() == null) {
        if (domMap.get(valueObject.getIntraOperativeDetails()) != null) {
          value1 =
              (ims.core.clinical.domain.objects.IntraOperativeDetails)
                  domMap.get(valueObject.getIntraOperativeDetails());
        }
      } else {
        value1 =
            (ims.core.clinical.domain.objects.IntraOperativeDetails)
                domainFactory.getDomainObject(
                    ims.core.clinical.domain.objects.IntraOperativeDetails.class,
                    valueObject.getIntraOperativeDetails().getBoId());
      }
    }
    domainObject.setIntraOperativeDetails(value1);
    ims.core.admin.domain.objects.CareContext value2 = null;
    if (null != valueObject.getCareContext()) {
      if (valueObject.getCareContext().getBoId() == null) {
        if (domMap.get(valueObject.getCareContext()) != null) {
          value2 =
              (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
      // BO field
      {
        value2 = domainObject.getCareContext();
      } else {
        value2 =
            (ims.core.admin.domain.objects.CareContext)
                domainFactory.getDomainObject(
                    ims.core.admin.domain.objects.CareContext.class,
                    valueObject.getCareContext().getBoId());
      }
    }
    domainObject.setCareContext(value2);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.clinical.domain.objects.PatientProcedure value3 = null;
    if (null != valueObject.getActualProcedure()) {
      if (valueObject.getActualProcedure().getBoId() == null) {
        if (domMap.get(valueObject.getActualProcedure()) != null) {
          value3 =
              (ims.core.clinical.domain.objects.PatientProcedure)
                  domMap.get(valueObject.getActualProcedure());
        }
      } else {
        value3 =
            (ims.core.clinical.domain.objects.PatientProcedure)
                domainFactory.getDomainObject(
                    ims.core.clinical.domain.objects.PatientProcedure.class,
                    valueObject.getActualProcedure().getBoId());
      }
    }
    domainObject.setActualProcedure(value3);
    java.util.Date value4 = null;
    ims.framework.utils.Date date4 = valueObject.getProcedureDate();
    if (date4 != null) {
      value4 = date4.getDate();
    }
    domainObject.setProcedureDate(value4);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.resource.place.domain.objects.Location value5 = null;
    if (null != valueObject.getTheatre()) {
      if (valueObject.getTheatre().getBoId() == null) {
        if (domMap.get(valueObject.getTheatre()) != null) {
          value5 =
              (ims.core.resource.place.domain.objects.Location)
                  domMap.get(valueObject.getTheatre());
        }
      } else {
        value5 =
            (ims.core.resource.place.domain.objects.Location)
                domainFactory.getDomainObject(
                    ims.core.resource.place.domain.objects.Location.class,
                    valueObject.getTheatre().getBoId());
      }
    }
    domainObject.setTheatre(value5);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.resource.people.domain.objects.Hcp value6 = null;
    if (null != valueObject.getSurgeon()) {
      if (valueObject.getSurgeon().getBoId() == null) {
        if (domMap.get(valueObject.getSurgeon()) != null) {
          value6 =
              (ims.core.resource.people.domain.objects.Hcp) domMap.get(valueObject.getSurgeon());
        }
      } else {
        value6 =
            (ims.core.resource.people.domain.objects.Hcp)
                domainFactory.getDomainObject(
                    ims.core.resource.people.domain.objects.Hcp.class,
                    valueObject.getSurgeon().getBoId());
      }
    }
    domainObject.setSurgeon(value6);

    return domainObject;
  }