public static ims.clinical.domain.objects.PerfProcAndSignOutIntraOp
      extractPerfProcAndSignOutIntraOp(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.clinical.vo.PerformedProcAndSignOutIntraOpVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_PerfProcAndSignOutIntraOp();
    ims.clinical.domain.objects.PerfProcAndSignOutIntraOp domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.clinical.domain.objects.PerfProcAndSignOutIntraOp) domMap.get(valueObject);
      }
      // ims.clinical.vo.PerformedProcAndSignOutIntraOpVo ID_PerfProcAndSignOutIntraOp field is
      // unknown
      domainObject = new ims.clinical.domain.objects.PerfProcAndSignOutIntraOp();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_PerfProcAndSignOutIntraOp());
      if (domMap.get(key) != null) {
        return (ims.clinical.domain.objects.PerfProcAndSignOutIntraOp) domMap.get(key);
      }
      domainObject =
          (ims.clinical.domain.objects.PerfProcAndSignOutIntraOp)
              domainFactory.getDomainObject(
                  ims.clinical.domain.objects.PerfProcAndSignOutIntraOp.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_PerfProcAndSignOutIntraOp());

    ims.scheduling.domain.objects.Booking_Appointment value1 = null;
    if (null != valueObject.getTheatreAppointment()) {
      if (valueObject.getTheatreAppointment().getBoId() == null) {
        if (domMap.get(valueObject.getTheatreAppointment()) != null) {
          value1 =
              (ims.scheduling.domain.objects.Booking_Appointment)
                  domMap.get(valueObject.getTheatreAppointment());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
                 // BO field
      {
        value1 = domainObject.getTheatreAppointment();
      } else {
        value1 =
            (ims.scheduling.domain.objects.Booking_Appointment)
                domainFactory.getDomainObject(
                    ims.scheduling.domain.objects.Booking_Appointment.class,
                    valueObject.getTheatreAppointment().getBoId());
      }
    }
    domainObject.setTheatreAppointment(value1);
    domainObject.setUnplannedreturntotheatre(valueObject.getUnplannedreturntotheatre());
    domainObject.setConfirmedCountsComplete(valueObject.getConfirmedCountsComplete());
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value4 = null;
    if (null != valueObject.getAntibioticsAfterKnifeToSkin()) {
      value4 =
          domainFactory.getLookupInstance(valueObject.getAntibioticsAfterKnifeToSkin().getID());
    }
    domainObject.setAntibioticsAfterKnifeToSkin(value4);
    ims.framework.utils.DateTime dateTime5 = valueObject.getTimeIntraOpAntibioticsGiven();
    java.util.Date value5 = null;
    if (dateTime5 != null) {
      value5 = dateTime5.getJavaDate();
    }
    domainObject.setTimeIntraOpAntibioticsGiven(value5);
    domainObject.setAdministrationRecordCompleted(valueObject.getAdministrationRecordCompleted());
    domainObject.setAnySpecimensHaveBeenLabelled(valueObject.getAnySpecimensHaveBeenLabelled());
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value8 = null;
    if (null != valueObject.getAnyEquipmentProblemsAddressed()) {
      value8 =
          domainFactory.getLookupInstance(valueObject.getAnyEquipmentProblemsAddressed().getID());
    }
    domainObject.setAnyEquipmentProblemsAddressed(value8);
    domainObject.setKeyConcernsDocumented(valueObject.getKeyConcernsDocumented());
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.resource.people.domain.objects.Hcp value10 = null;
    if (null != valueObject.getSignatureByRegisteredPractitioner()) {
      if (valueObject.getSignatureByRegisteredPractitioner().getBoId() == null) {
        if (domMap.get(valueObject.getSignatureByRegisteredPractitioner()) != null) {
          value10 =
              (ims.core.resource.people.domain.objects.Hcp)
                  domMap.get(valueObject.getSignatureByRegisteredPractitioner());
        }
      } else {
        value10 =
            (ims.core.resource.people.domain.objects.Hcp)
                domainFactory.getDomainObject(
                    ims.core.resource.people.domain.objects.Hcp.class,
                    valueObject.getSignatureByRegisteredPractitioner().getBoId());
      }
    }
    domainObject.setSignatureByRegisteredPractitioner(value10);

    return domainObject;
  }