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

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

    // AppointmentDate
    java.util.Date AppointmentDate = domainObject.getAppointmentDate();
    if (null != AppointmentDate) {
      valueObject.setAppointmentDate(new ims.framework.utils.Date(AppointmentDate));
    }
    // ApptStartTime
    String ApptStartTime = domainObject.getApptStartTime();
    if (null != ApptStartTime) {
      valueObject.setApptStartTime(new ims.framework.utils.Time(ApptStartTime));
    }
    // Session
    valueObject.setSession(
        ims.scheduling.vo.domain.SessionForClinicNameVoAssembler.create(
            map, domainObject.getSession()));
    // RTTClockImpact
    if (domainObject.getRTTClockImpact() != null) {
      if (domainObject.getRTTClockImpact()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getRTTClockImpact();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setRTTClockImpact(new ims.pathways.vo.PathwaysRTTClockImpactRefVo(id, -1));
      } else {
        valueObject.setRTTClockImpact(
            new ims.pathways.vo.PathwaysRTTClockImpactRefVo(
                domainObject.getRTTClockImpact().getId(),
                domainObject.getRTTClockImpact().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.scheduling.domain.objects.Booking_Appointment
   */
  public static ims.RefMan.vo.BookingAppointmentForClinicalNotesVo insert(
      DomainObjectMap map,
      ims.RefMan.vo.BookingAppointmentForClinicalNotesVo valueObject,
      ims.scheduling.domain.objects.Booking_Appointment domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // AppointmentDate
    java.util.Date AppointmentDate = domainObject.getAppointmentDate();
    if (null != AppointmentDate) {
      valueObject.setAppointmentDate(new ims.framework.utils.Date(AppointmentDate));
    }
    // ApptStartTime
    String ApptStartTime = domainObject.getApptStartTime();
    if (null != ApptStartTime) {
      valueObject.setApptStartTime(new ims.framework.utils.Time(ApptStartTime));
    }
    // ApptStatus
    ims.domain.lookups.LookupInstance instance3 = domainObject.getApptStatus();
    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.scheduling.vo.lookups.Status_Reason voLookup3 =
          new ims.scheduling.vo.lookups.Status_Reason(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.scheduling.vo.lookups.Status_Reason 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.scheduling.vo.lookups.Status_Reason(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setApptStatus(voLookup3);
    }
    // Session
    valueObject.setSession(
        ims.RefMan.vo.domain.SessionForClinicalNotesVoAssembler.create(
            map, domainObject.getSession()));
    return valueObject;
  }