コード例 #1
0
  /**
   * Create the ValueObject collection to hold the set of DomainObjects.
   *
   * @param map - maps DomainObjects to created ValueObjects
   * @param domainObjectSet - Set of ims.scheduling.domain.objects.Booking_Appointment objects.
   */
  public static ims.scheduling.vo.AppointmentOutcomeDetailsVoCollection
      createAppointmentOutcomeDetailsVoCollectionFromBooking_Appointment(
          DomainObjectMap map, java.util.Set domainObjectSet) {
    ims.scheduling.vo.AppointmentOutcomeDetailsVoCollection voList =
        new ims.scheduling.vo.AppointmentOutcomeDetailsVoCollection();
    if (null == domainObjectSet) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    java.util.Iterator iterator = domainObjectSet.iterator();
    while (iterator.hasNext()) {
      ims.scheduling.domain.objects.Booking_Appointment domainObject =
          (ims.scheduling.domain.objects.Booking_Appointment) iterator.next();
      ims.scheduling.vo.AppointmentOutcomeDetailsVo vo = create(map, domainObject);

      if (vo != null) voList.add(vo);

      if (domainObject != null) {
        if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true)
          rieCount++;
        else activeCount++;
      }
    }
    voList.setRieCount(rieCount);
    voList.setActiveCount(activeCount);
    return voList;
  }
コード例 #2
0
  /**
   * Create the ValueObject collection to hold the list of DomainObjects.
   *
   * @param map - maps DomainObjects to created ValueObjects
   * @param domainObjectList - List of ims.scheduling.domain.objects.Booking_Appointment objects.
   */
  public static ims.scheduling.vo.AppointmentOutcomeDetailsVoCollection
      createAppointmentOutcomeDetailsVoCollectionFromBooking_Appointment(
          DomainObjectMap map, java.util.List domainObjectList) {
    ims.scheduling.vo.AppointmentOutcomeDetailsVoCollection voList =
        new ims.scheduling.vo.AppointmentOutcomeDetailsVoCollection();
    if (null == domainObjectList) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    for (int i = 0; i < domainObjectList.size(); i++) {
      ims.scheduling.domain.objects.Booking_Appointment domainObject =
          (ims.scheduling.domain.objects.Booking_Appointment) domainObjectList.get(i);
      ims.scheduling.vo.AppointmentOutcomeDetailsVo vo = create(map, domainObject);

      if (vo != null) voList.add(vo);

      if (domainObject != null) {
        if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true)
          rieCount++;
        else activeCount++;
      }
    }

    voList.setRieCount(rieCount);
    voList.setActiveCount(activeCount);
    return voList;
  }
コード例 #3
0
  /**
   * Create the ValueObject from the ims.scheduling.domain.objects.Booking_Appointment object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param domainObject
   */
  public static ims.scheduling.vo.AppointmentOutcomeDetailsVo create(
      DomainObjectMap map, ims.scheduling.domain.objects.Booking_Appointment domainObject) {
    if (null == domainObject) {
      return null;
    }
    // check if the domainObject already has a valueObject created for it
    ims.scheduling.vo.AppointmentOutcomeDetailsVo valueObject =
        (ims.scheduling.vo.AppointmentOutcomeDetailsVo)
            map.getValueObject(domainObject, ims.scheduling.vo.AppointmentOutcomeDetailsVo.class);
    if (null == valueObject) {
      valueObject =
          new ims.scheduling.vo.AppointmentOutcomeDetailsVo(
              domainObject.getId(), domainObject.getVersion());
      map.addValueObject(domainObject, valueObject);

      valueObject = insert(map, valueObject, domainObject);
    }
    return valueObject;
  }
コード例 #4
0
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.icps.instantiation.domain.objects.PatientICP
   */
  public static ims.icp.vo.PatientICPVo insert(
      DomainObjectMap map,
      ims.icp.vo.PatientICPVo valueObject,
      ims.icps.instantiation.domain.objects.PatientICP domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_PatientICP(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()));
      }
    }
    // 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()));
      }
    }
    // 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()));
      }
    }
    // PasEvent
    if (domainObject.getPasEvent() != null) {
      if (domainObject.getPasEvent()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPasEvent();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPasEvent(new ims.core.admin.pas.vo.PASEventRefVo(id, -1));
      } else {
        valueObject.setPasEvent(
            new ims.core.admin.pas.vo.PASEventRefVo(
                domainObject.getPasEvent().getId(), domainObject.getPasEvent().getVersion()));
      }
    }
    // ICP
    valueObject.setICP(ims.icp.vo.domain.ICPLiteVoAssembler.create(map, domainObject.getICP()));
    // AuthoringInformation
    valueObject.setAuthoringInformation(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getAuthoringInformation()));
    // Stages
    valueObject.setStages(
        ims.icp.vo.domain.PatientICPStageVoAssembler
            .createPatientICPStageVoCollectionFromPatientICPStage(map, domainObject.getStages()));
    // hasOutstandingAdminActions
    valueObject.setHasOutstandingAdminActions(domainObject.isHasOutstandingAdminActions());
    // hasOutstandingNursingActions
    valueObject.setHasOutstandingNursingActions(domainObject.isHasOutstandingNursingActions());
    // hasOutstandingPhysioActions
    valueObject.setHasOutstandingPhysioActions(domainObject.isHasOutstandingPhysioActions());
    // hasOutstandingClinicalActions
    valueObject.setHasOutstandingClinicalActions(domainObject.isHasOutstandingClinicalActions());
    // Appointments
    ims.scheduling.vo.Booking_AppointmentRefVoCollection Appointments =
        new ims.scheduling.vo.Booking_AppointmentRefVoCollection();
    for (java.util.Iterator iterator = domainObject.getAppointments().iterator();
        iterator.hasNext(); ) {
      ims.scheduling.domain.objects.Booking_Appointment tmp =
          (ims.scheduling.domain.objects.Booking_Appointment) iterator.next();
      if (tmp != null)
        Appointments.add(
            new ims.scheduling.vo.Booking_AppointmentRefVo(tmp.getId(), tmp.getVersion()));
    }
    valueObject.setAppointments(Appointments);
    // CriticalEvents
    ims.icps.instantiation.vo.PatientCriticalEventsRefVoCollection CriticalEvents =
        new ims.icps.instantiation.vo.PatientCriticalEventsRefVoCollection();
    for (java.util.Iterator iterator = domainObject.getCriticalEvents().iterator();
        iterator.hasNext(); ) {
      ims.icps.instantiation.domain.objects.PatientCriticalEvents tmp =
          (ims.icps.instantiation.domain.objects.PatientCriticalEvents) iterator.next();
      if (tmp != null)
        CriticalEvents.add(
            new ims.icps.instantiation.vo.PatientCriticalEventsRefVo(
                tmp.getId(), tmp.getVersion()));
    }
    valueObject.setCriticalEvents(CriticalEvents);
    // StartedDateTime
    java.util.Date StartedDateTime = domainObject.getStartedDateTime();
    if (null != StartedDateTime) {
      valueObject.setStartedDateTime(new ims.framework.utils.DateTime(StartedDateTime));
    }
    // CompletedDateTime
    java.util.Date CompletedDateTime = domainObject.getCompletedDateTime();
    if (null != CompletedDateTime) {
      valueObject.setCompletedDateTime(new ims.framework.utils.DateTime(CompletedDateTime));
    }
    // EvaluationNotes
    ims.icps.instantiation.vo.PatientICPEvaluationNoteRefVoCollection EvaluationNotes =
        new ims.icps.instantiation.vo.PatientICPEvaluationNoteRefVoCollection();
    for (java.util.Iterator iterator = domainObject.getEvaluationNotes().iterator();
        iterator.hasNext(); ) {
      ims.icps.instantiation.domain.objects.PatientICPEvaluationNote tmp =
          (ims.icps.instantiation.domain.objects.PatientICPEvaluationNote) iterator.next();
      if (tmp != null)
        EvaluationNotes.add(
            new ims.icps.instantiation.vo.PatientICPEvaluationNoteRefVo(
                tmp.getId(), tmp.getVersion()));
    }
    valueObject.setEvaluationNotes(EvaluationNotes);
    return valueObject;
  }
コード例 #5
0
  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;
  }
コード例 #6
0
  /**
   * 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;
  }
  public static ims.scheduling.domain.objects.Booking_Appointment extractBooking_Appointment(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.scheduling.vo.AppointmentForOutpatientClinicListManualCustomClassVo 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.AppointmentForOutpatientClinicListManualCustomClassVo
      // 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);
    domainObject.setIsCABBooking(valueObject.getIsCABBooking());
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.patient.domain.objects.Patient value4 = null;
    if (null != valueObject.getPatient()) {
      if (valueObject.getPatient().getBoId() == null) {
        if (domMap.get(valueObject.getPatient()) != null) {
          value4 = (ims.core.patient.domain.objects.Patient) domMap.get(valueObject.getPatient());
        }
      } else {
        value4 =
            (ims.core.patient.domain.objects.Patient)
                domainFactory.getDomainObject(
                    ims.core.patient.domain.objects.Patient.class,
                    valueObject.getPatient().getBoId());
      }
    }
    domainObject.setPatient(value4);
    // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty
    // string correctly
    // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them
    // consistent at least.
    if (valueObject.getOutcomeComments() != null && valueObject.getOutcomeComments().equals("")) {
      valueObject.setOutcomeComments(null);
    }
    domainObject.setOutcomeComments(valueObject.getOutcomeComments());
    domainObject.setHasElectiveList(valueObject.getHasElectiveList());
    domainObject.setWasPrinted(valueObject.getWasPrinted());
    // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty
    // string correctly
    // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them
    // consistent at least.
    if (valueObject.getComments() != null && valueObject.getComments().equals("")) {
      valueObject.setComments(null);
    }
    domainObject.setComments(valueObject.getComments());
    ims.RefMan.domain.objects.PatientElectiveList value9 = null;
    if (null != valueObject.getElectiveList()) {
      if (valueObject.getElectiveList().getBoId() == null) {
        if (domMap.get(valueObject.getElectiveList()) != null) {
          value9 =
              (ims.RefMan.domain.objects.PatientElectiveList)
                  domMap.get(valueObject.getElectiveList());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
      // BO field
      {
        value9 = domainObject.getElectiveList();
      } else {
        value9 =
            (ims.RefMan.domain.objects.PatientElectiveList)
                domainFactory.getDomainObject(
                    ims.RefMan.domain.objects.PatientElectiveList.class,
                    valueObject.getElectiveList().getBoId());
      }
    }
    domainObject.setElectiveList(value9);

    return domainObject;
  }
  /**
   * 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.AppointmentForOutpatientClinicListManualCustomClassVo insert(
      DomainObjectMap map,
      ims.scheduling.vo.AppointmentForOutpatientClinicListManualCustomClassVo 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));
    }
    // isCABBooking
    valueObject.setIsCABBooking(domainObject.isIsCABBooking());
    // Patient
    valueObject.setPatient(
        ims.core.vo.domain.PatientManuallyAssembledVoAssembler.create(
            map, domainObject.getPatient()));
    // OutcomeComments
    valueObject.setOutcomeComments(domainObject.getOutcomeComments());
    // HasElectiveList
    valueObject.setHasElectiveList(domainObject.isHasElectiveList());
    // wasPrinted
    valueObject.setWasPrinted(domainObject.isWasPrinted());
    // Comments
    valueObject.setComments(domainObject.getComments());
    // ElectiveList
    if (domainObject.getElectiveList() != null) {
      if (domainObject.getElectiveList()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getElectiveList();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setElectiveList(new ims.RefMan.vo.PatientElectiveListRefVo(id, -1));
      } else {
        valueObject.setElectiveList(
            new ims.RefMan.vo.PatientElectiveListRefVo(
                domainObject.getElectiveList().getId(),
                domainObject.getElectiveList().getVersion()));
      }
    }
    return valueObject;
  }
  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;
  }
  /**
   * 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;
  }
  /**
   * 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.domain.objects.TransportBooking
   */
  public static ims.RefMan.vo.TransportBookingShortVo insert(
      DomainObjectMap map,
      ims.RefMan.vo.TransportBookingShortVo valueObject,
      ims.core.domain.objects.TransportBooking domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Appointments
    ims.scheduling.vo.Booking_AppointmentRefVoCollection Appointments =
        new ims.scheduling.vo.Booking_AppointmentRefVoCollection();
    for (java.util.Iterator iterator = domainObject.getAppointments().iterator();
        iterator.hasNext(); ) {
      ims.scheduling.domain.objects.Booking_Appointment tmp =
          (ims.scheduling.domain.objects.Booking_Appointment) iterator.next();
      if (tmp != null)
        Appointments.add(
            new ims.scheduling.vo.Booking_AppointmentRefVo(tmp.getId(), tmp.getVersion()));
    }
    valueObject.setAppointments(Appointments);
    // DateBooked
    java.util.Date DateBooked = domainObject.getDateBooked();
    if (null != DateBooked) {
      valueObject.setDateBooked(new ims.framework.utils.Date(DateBooked));
    }
    // BookingReference
    valueObject.setBookingReference(domainObject.getBookingReference());
    // SysInfo
    // set system information
    valueObject.setSysInfo(
        ims.vo.domain.SystemInformationAssembler.create(domainObject.getSystemInformation()));
    // 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;
  }