public static ims.scheduling.domain.objects.Booking_Appointment extractBooking_Appointment(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.scheduling.vo.AppointmentOutcomeDetailsVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Booking_Appointment();
    ims.scheduling.domain.objects.Booking_Appointment domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.scheduling.domain.objects.Booking_Appointment) domMap.get(valueObject);
      }
      // ims.scheduling.vo.AppointmentOutcomeDetailsVo ID_Booking_Appointment field is unknown
      domainObject = new ims.scheduling.domain.objects.Booking_Appointment();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_Booking_Appointment());
      if (domMap.get(key) != null) {
        return (ims.scheduling.domain.objects.Booking_Appointment) domMap.get(key);
      }
      domainObject =
          (ims.scheduling.domain.objects.Booking_Appointment)
              domainFactory.getDomainObject(
                  ims.scheduling.domain.objects.Booking_Appointment.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_Booking_Appointment());

    java.util.Date value1 = null;
    ims.framework.utils.Date date1 = valueObject.getAppointmentDate();
    if (date1 != null) {
      value1 = date1.getDate();
    }
    domainObject.setAppointmentDate(value1);
    ims.framework.utils.Time time2 = valueObject.getApptStartTime();
    String value2 = null;
    if (time2 != null) {
      value2 = time2.toString();
    }
    domainObject.setApptStartTime(value2);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.scheduling.domain.objects.Sch_Session value3 = null;
    if (null != valueObject.getSession()) {
      if (valueObject.getSession().getBoId() == null) {
        if (domMap.get(valueObject.getSession()) != null) {
          value3 = (ims.scheduling.domain.objects.Sch_Session) domMap.get(valueObject.getSession());
        }
      } else {
        value3 =
            (ims.scheduling.domain.objects.Sch_Session)
                domainFactory.getDomainObject(
                    ims.scheduling.domain.objects.Sch_Session.class,
                    valueObject.getSession().getBoId());
      }
    }
    domainObject.setSession(value3);
    ims.pathways.domain.objects.PathwaysRTTClockImpact value4 = null;
    if (null != valueObject.getRTTClockImpact()) {
      if (valueObject.getRTTClockImpact().getBoId() == null) {
        if (domMap.get(valueObject.getRTTClockImpact()) != null) {
          value4 =
              (ims.pathways.domain.objects.PathwaysRTTClockImpact)
                  domMap.get(valueObject.getRTTClockImpact());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
                 // BO field
      {
        value4 = domainObject.getRTTClockImpact();
      } else {
        value4 =
            (ims.pathways.domain.objects.PathwaysRTTClockImpact)
                domainFactory.getDomainObject(
                    ims.pathways.domain.objects.PathwaysRTTClockImpact.class,
                    valueObject.getRTTClockImpact().getBoId());
      }
    }
    domainObject.setRTTClockImpact(value4);

    return domainObject;
  }
  public static ims.scheduling.domain.objects.Booking_Appointment extractBooking_Appointment(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.RefMan.vo.BookingAppointmentForClinicalNotesVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Booking_Appointment();
    ims.scheduling.domain.objects.Booking_Appointment domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.scheduling.domain.objects.Booking_Appointment) domMap.get(valueObject);
      }
      // ims.RefMan.vo.BookingAppointmentForClinicalNotesVo ID_Booking_Appointment field is unknown
      domainObject = new ims.scheduling.domain.objects.Booking_Appointment();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_Booking_Appointment());
      if (domMap.get(key) != null) {
        return (ims.scheduling.domain.objects.Booking_Appointment) domMap.get(key);
      }
      domainObject =
          (ims.scheduling.domain.objects.Booking_Appointment)
              domainFactory.getDomainObject(
                  ims.scheduling.domain.objects.Booking_Appointment.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_Booking_Appointment());

    java.util.Date value1 = null;
    ims.framework.utils.Date date1 = valueObject.getAppointmentDate();
    if (date1 != null) {
      value1 = date1.getDate();
    }
    domainObject.setAppointmentDate(value1);
    ims.framework.utils.Time time2 = valueObject.getApptStartTime();
    String value2 = null;
    if (time2 != null) {
      value2 = time2.toString();
    }
    domainObject.setApptStartTime(value2);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value3 = null;
    if (null != valueObject.getApptStatus()) {
      value3 = domainFactory.getLookupInstance(valueObject.getApptStatus().getID());
    }
    domainObject.setApptStatus(value3);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.scheduling.domain.objects.Sch_Session value4 = null;
    if (null != valueObject.getSession()) {
      if (valueObject.getSession().getBoId() == null) {
        if (domMap.get(valueObject.getSession()) != null) {
          value4 = (ims.scheduling.domain.objects.Sch_Session) domMap.get(valueObject.getSession());
        }
      } else {
        value4 =
            (ims.scheduling.domain.objects.Sch_Session)
                domainFactory.getDomainObject(
                    ims.scheduling.domain.objects.Sch_Session.class,
                    valueObject.getSession().getBoId());
      }
    }
    domainObject.setSession(value4);

    return domainObject;
  }