示例#1
0
  private void getAppointments(Date date) throws PresentationLogicException {
    form.AppointmentsGrid().getRows().clear();
    EnableArrivalControls(false);
    // Clear the arrival controls
    ClearArrivalControls();

    if (date == null) return;

    String pkey = getPkey();

    Sd_appt_dts appDetails;
    try {
      appDetails = domain.listAppointmentDetails(pkey, date.toString(DateFormat.ISO));
    } catch (DomainInterfaceException e) {
      engine.showMessage(e.getMessage());
      return;
    }

    Result result = appDetails.list();
    if (result != null) {
      engine.showMessage(result.getMessage());
      return;
    }

    for (int i = 0; i < appDetails.DataCollection.count(); ++i) {
      GenForm.AppointmentsGridRow row = form.AppointmentsGrid().getRows().newRow();

      if (appDetails.DataCollection.get(i).First_appt_id
          == appDetails.DataCollection.get(i).Appt_id)
        row.setBooking(form.getImages().CcoSched.First);
      else if (appDetails.DataCollection.get(i).Last_appt_id
          == appDetails.DataCollection.get(i).Appt_id)
        row.setBooking(form.getImages().CcoSched.Last);
      Time dt = getTimeFromString(appDetails.DataCollection.get(i).Stm);
      row.setAppointmentTime(dt == null ? "" : dt.toString());
      row.setClinicName(appDetails.DataCollection.get(i).Prfile_sess_idtxt);
      row.setConsultant(appDetails.DataCollection.get(i).Act_consulttxt);
      row.setStatus(appDetails.DataCollection.get(i).Appt_stattxt);

      row.setValue(appDetails.DataCollection.get(i));
    }

    int nCount = form.AppointmentsGrid().getRows().size();
    if (nCount == 0) engine.showMessage("No records.");

    // 05/06/2003 - Kevin's improvement - select the first record (or the previous selected one)
    if (nCount > 0) {
      form.AppointmentsGrid()
          .setValue(form.AppointmentsGrid().getRows().get(GetPrevSelIndex()).getValue());

      if (form.AppointmentsGrid().getSelectedRowIndex() >= 0) onAppointmentsGridSelectionChanged();

      // If only one record - disable
      if (nCount == 1) form.AllAppointments().setEnabled(false);
    }
  }
  protected void onImbCalculateClick() throws ims.framework.exceptions.PresentationLogicException {
    Time startTime = form.timStart().getValue();
    Time endTime = form.getGlobalContext().Scheduling.getProfileEndTime();

    // this is mandatory for dialog
    if (form.getGlobalContext().Scheduling.getProfileEndTime() == null) return;

    if (startTime == null
        || (form.intSlotInterval().getValue() == null || form.intSlotInterval().getValue() == 0)) {
      engine.showErrors(
          new String[] {"Start Time and Slot Interval need to be provided for calculation"});
      return;
    }

    int iDuration = form.intSlotInterval().getValue();

    int iTime = endTime.getTotalMinutes() - startTime.getTotalMinutes();
    form.intNoSlots().setValue(iTime / iDuration);
  }
  public static ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem
      extractSpecimenWorkListItem(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.ocrr.vo.SpecimenWorkListItemListVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_SpecimenWorkListItem();
    ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem)
            domMap.get(valueObject);
      }
      // ims.ocrr.vo.SpecimenWorkListItemListVo ID_SpecimenWorkListItem field is unknown
      domainObject = new ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_SpecimenWorkListItem());
      if (domMap.get(key) != null) {
        return (ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem) domMap.get(key);
      }
      domainObject =
          (ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem)
              domainFactory.getDomainObject(
                  ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem.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_SpecimenWorkListItem());

    domainObject.setSpecimen(
        ims.ocrr.vo.domain.OrderSpecimenListVoAssembler.extractOrderSpecimen(
            domainFactory, valueObject.getSpecimen(), domMap));
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value2 = null;
    if (null != valueObject.getListType()) {
      value2 = domainFactory.getLookupInstance(valueObject.getListType().getID());
    }
    domainObject.setListType(value2);
    java.util.Date value3 = null;
    ims.framework.utils.Date date3 = valueObject.getDateToCollect();
    if (date3 != null) {
      value3 = date3.getDate();
    }
    domainObject.setDateToCollect(value3);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value4 = null;
    if (null != valueObject.getRoundToCollect()) {
      value4 = domainFactory.getLookupInstance(valueObject.getRoundToCollect().getID());
    }
    domainObject.setRoundToCollect(value4);
    ims.framework.utils.Time time5 = valueObject.getTimeToCollect();
    String value5 = null;
    if (time5 != null) {
      value5 = time5.toString();
    }
    domainObject.setTimeToCollect(value5);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value6 = null;
    if (null != valueObject.getCollectionStatus()) {
      value6 = domainFactory.getLookupInstance(valueObject.getCollectionStatus().getID());
    }
    domainObject.setCollectionStatus(value6);
    domainObject.setPrinted(valueObject.getPrinted());
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.ocrr.orderingresults.domain.objects.OrderInvestigation value8 = null;
    if (null != valueObject.getDFTOrderInvestigation()) {
      if (valueObject.getDFTOrderInvestigation().getBoId() == null) {
        if (domMap.get(valueObject.getDFTOrderInvestigation()) != null) {
          value8 =
              (ims.ocrr.orderingresults.domain.objects.OrderInvestigation)
                  domMap.get(valueObject.getDFTOrderInvestigation());
        }
      } else {
        value8 =
            (ims.ocrr.orderingresults.domain.objects.OrderInvestigation)
                domainFactory.getDomainObject(
                    ims.ocrr.orderingresults.domain.objects.OrderInvestigation.class,
                    valueObject.getDFTOrderInvestigation().getBoId());
      }
    }
    domainObject.setDFTOrderInvestigation(value8);
    ims.core.resource.place.domain.objects.Location value9 = null;
    if (null != valueObject.getWard()) {
      if (valueObject.getWard().getBoId() == null) {
        if (domMap.get(valueObject.getWard()) != null) {
          value9 =
              (ims.core.resource.place.domain.objects.Location) domMap.get(valueObject.getWard());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
                 // BO field
      {
        value9 = domainObject.getWard();
      } else {
        value9 =
            (ims.core.resource.place.domain.objects.Location)
                domainFactory.getDomainObject(
                    ims.core.resource.place.domain.objects.Location.class,
                    valueObject.getWard().getBoId());
      }
    }
    domainObject.setWard(value9);

    return domainObject;
  }
示例#4
0
  protected void onListPatientsClick() {
    clearPIDAndPatient();
    form.Rebook().setEnabled(false);
    form.RebookingNotReq().setEnabled(false);
    form.PatientDiary().setEnabled(false);

    form.getGlobalContext().CcoSched.TreatmentPlan.setActionID(null);
    form.getGlobalContext().CcoSched.TreatmentPlan.setTreatmentPlanDetails(null);
    form.getGlobalContext().CcoSched.ActionUpdate.setTreatmentPlanActions(null);
    form.getGlobalContext().CcoSched.CancelledAppointments.setRebookAppointmentDetail(null);

    Clean();
    if (form.ActivityGroup().getValue() == null || form.Activity().getValue() == null) {
      engine.showMessage("Please select activity group and activity.");
      return;
    }

    String grp_id = form.ActivityGroup().getValue();
    String activ_id = form.Activity().getValue();
    String prty =
        form.Priority().getValue() != null
            ? Integer.toString(form.Priority().getValue().getID())
            : null;

    // Cancelled requiring rebooking
    String appt_stat = null;
    String act_comp_flg = null;
    if (form.chkIncompleteAppts().getValue()) {
      appt_stat = "-2192"; // Attended
      act_comp_flg = INCOMPLETE;
    } else appt_stat = "-2190 || -2191"; // Open and Cancelled Reallocate

    Sd_appt_dts patients = null;
    try {
      patients = domain.listSd_appt_dts(grp_id, activ_id, prty, appt_stat, act_comp_flg);
    } catch (DomainInterfaceException e) {
      engine.showMessage(e.getMessage());
      return;
    }

    for (int i = 0; patients != null && i < patients.DataCollection.count(); ++i) {
      GenForm.MainGridRow row = form.MainGrid().getRows().newRow();

      row.setHospitalNumber(patients.DataCollection.get(i).Hospnum);
      String name = patients.DataCollection.get(i).Fnm1 + " " + patients.DataCollection.get(i).Snm;
      row.setName(name);
      row.setTooltipForName(name);
      row.setPriority(patients.DataCollection.get(i).Prtytxt);
      row.setTooltipForPriority(patients.DataCollection.get(i).Prtytxt);

      Date DtodAppDate = null;
      if (patients.DataCollection.get(i).Sess_dt.equals("") == false) {
        try {
          DtodAppDate = new Date(patients.DataCollection.get(i).Sess_dt, DateFormat.ISO);
        } catch (ParseException e) {
        }
      }
      if (DtodAppDate != null) row.setInitAppDate(DtodAppDate);

      row.setCategory(patients.DataCollection.get(i).Txcattypetxt);
      row.setTooltipForCategory(patients.DataCollection.get(i).Txcattypetxt);

      Time DtodAppTime = null;
      if (patients.DataCollection.get(i).Stm.equals("") == false) {
        try {
          DtodAppTime = new Time(patients.DataCollection.get(i).Stm, TimeFormat.FLAT6);
        } catch (RuntimeException e) {
        }
      }

      if (DtodAppTime != null) row.setApptTime(DtodAppTime.toString());
      row.setAppointmentStatus(patients.DataCollection.get(i).Appt_stattxt);
      row.setTooltipForAppointmentStatus(patients.DataCollection.get(i).Appt_stattxt);
      row.setValue(patients.DataCollection.get(i));
    }

    if (patients == null || patients.DataCollection.count() == 0) engine.showMessage("No records.");

    form.MainGrid().sort(3);
  }
  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.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;
  }
 private Time calculateEndTime() {
   Time endTime = new Time();
   endTime = (Time) form.timStart().getValue().clone();
   endTime.addMinutes(form.intNoSlots().getValue() * form.intSlotInterval().getValue());
   return endTime;
 }
  public static ims.scheduling.domain.objects.Sch_Session extractSch_Session(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.scheduling.vo.SessionManagementVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Sch_Session();
    ims.scheduling.domain.objects.Sch_Session domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.scheduling.domain.objects.Sch_Session) domMap.get(valueObject);
      }
      // ims.scheduling.vo.SessionManagementVo ID_Sch_Session field is unknown
      domainObject = new ims.scheduling.domain.objects.Sch_Session();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Sch_Session());
      if (domMap.get(key) != null) {
        return (ims.scheduling.domain.objects.Sch_Session) domMap.get(key);
      }
      domainObject =
          (ims.scheduling.domain.objects.Sch_Session)
              domainFactory.getDomainObject(ims.scheduling.domain.objects.Sch_Session.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_Sch_Session());

    // 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.getName() != null && valueObject.getName().equals("")) {
      valueObject.setName(null);
    }
    domainObject.setName(valueObject.getName());
    java.util.Date value2 = null;
    ims.framework.utils.Date date2 = valueObject.getSessionDate();
    if (date2 != null) {
      value2 = date2.getDate();
    }
    domainObject.setSessionDate(value2);
    ims.framework.utils.Time time3 = valueObject.getStartTm();
    String value3 = null;
    if (time3 != null) {
      value3 = time3.toString();
    }
    domainObject.setStartTm(value3);
    ims.framework.utils.Time time4 = valueObject.getEndTm();
    String value4 = null;
    if (time4 != null) {
      value4 = time4.toString();
    }
    domainObject.setEndTm(value4);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.clinical.domain.objects.Service value5 = null;
    if (null != valueObject.getService()) {
      if (valueObject.getService().getBoId() == null) {
        if (domMap.get(valueObject.getService()) != null) {
          value5 = (ims.core.clinical.domain.objects.Service) domMap.get(valueObject.getService());
        }
      } else {
        value5 =
            (ims.core.clinical.domain.objects.Service)
                domainFactory.getDomainObject(
                    ims.core.clinical.domain.objects.Service.class,
                    valueObject.getService().getBoId());
      }
    }
    domainObject.setService(value5);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value6 = null;
    if (null != valueObject.getSessionStatus()) {
      value6 = domainFactory.getLookupInstance(valueObject.getSessionStatus().getID());
    }
    domainObject.setSessionStatus(value6);
    domainObject.setRemainingSlots(valueObject.getRemainingSlots());
    domainObject.setTotalSlots(valueObject.getTotalSlots());
    domainObject.setRemainingTime(valueObject.getRemainingTime());
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.resource.place.domain.objects.Location value10 = null;
    if (null != valueObject.getSchLocation()) {
      if (valueObject.getSchLocation().getBoId() == null) {
        if (domMap.get(valueObject.getSchLocation()) != null) {
          value10 =
              (ims.core.resource.place.domain.objects.Location)
                  domMap.get(valueObject.getSchLocation());
        }
      } else {
        value10 =
            (ims.core.resource.place.domain.objects.Location)
                domainFactory.getDomainObject(
                    ims.core.resource.place.domain.objects.Location.class,
                    valueObject.getSchLocation().getBoId());
      }
    }
    domainObject.setSchLocation(value10);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value11 = null;
    if (null != valueObject.getSessionType()) {
      value11 = domainFactory.getLookupInstance(valueObject.getSessionType().getID());
    }
    domainObject.setSessionType(value11);

    // SaveAsRefVO treated as RefValueObject
    ims.scheduling.vo.Session_ListOwnerRefVoCollection refCollection12 =
        new ims.scheduling.vo.Session_ListOwnerRefVoCollection();
    if (valueObject.getListOwners() != null) {
      for (int i12 = 0; i12 < valueObject.getListOwners().size(); i12++) {
        ims.scheduling.vo.Session_ListOwnerRefVo ref12 =
            (ims.scheduling.vo.Session_ListOwnerRefVo) valueObject.getListOwners().get(i12);
        refCollection12.add(ref12);
      }
    }
    int size12 = (null == refCollection12) ? 0 : refCollection12.size();
    java.util.Set domainListOwners12 = domainObject.getListOwners();
    if (domainListOwners12 == null) {
      domainListOwners12 = new java.util.HashSet();
    }
    java.util.Set newSet12 = new java.util.HashSet();
    for (int i = 0; i < size12; i++) {
      ims.scheduling.vo.Session_ListOwnerRefVo vo = refCollection12.get(i);
      ims.scheduling.domain.objects.Session_ListOwner dom = null;
      if (null != vo) {
        if (vo.getBoId() == null) {
          if (domMap.get(vo) != null) {
            dom = (ims.scheduling.domain.objects.Session_ListOwner) domMap.get(vo);
          }
        } else {
          dom =
              (ims.scheduling.domain.objects.Session_ListOwner)
                  domainFactory.getDomainObject(
                      ims.scheduling.domain.objects.Session_ListOwner.class, vo.getBoId());
        }
      }

      // Trying to avoid the hibernate collection being marked as dirty via its public interface
      // methods. (like add)
      if (!domainListOwners12.contains(dom)) {
        domainListOwners12.add(dom);
      }
      newSet12.add(dom);
    }
    java.util.Set removedSet12 = new java.util.HashSet();
    java.util.Iterator iter12 = domainListOwners12.iterator();
    // Find out which objects need to be removed
    while (iter12.hasNext()) {
      ims.domain.DomainObject o = (ims.domain.DomainObject) iter12.next();
      if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue())
          && !newSet12.contains(o)) {
        removedSet12.add(o);
      }
    }
    iter12 = removedSet12.iterator();
    // Remove the unwanted objects
    while (iter12.hasNext()) {
      domainListOwners12.remove(iter12.next());
    }

    domainObject.setListOwners(domainListOwners12);

    // SaveAsRefVO treated as RefValueObject
    ims.scheduling.vo.DirectoryofServiceRefVoCollection refCollection13 =
        new ims.scheduling.vo.DirectoryofServiceRefVoCollection();
    if (valueObject.getDirectoryofServices() != null) {
      for (int i13 = 0; i13 < valueObject.getDirectoryofServices().size(); i13++) {
        ims.scheduling.vo.DirectoryofServiceRefVo ref13 =
            (ims.scheduling.vo.DirectoryofServiceRefVo)
                valueObject.getDirectoryofServices().get(i13);
        refCollection13.add(ref13);
      }
    }
    int size13 = (null == refCollection13) ? 0 : refCollection13.size();
    java.util.Set domainDirectoryofServices13 = domainObject.getDirectoryofServices();
    if (domainDirectoryofServices13 == null) {
      domainDirectoryofServices13 = new java.util.HashSet();
    }
    java.util.Set newSet13 = new java.util.HashSet();
    for (int i = 0; i < size13; i++) {
      ims.scheduling.vo.DirectoryofServiceRefVo vo = refCollection13.get(i);
      ims.scheduling.domain.objects.DirectoryofService dom = null;
      if (null != vo) {
        if (vo.getBoId() == null) {
          if (domMap.get(vo) != null) {
            dom = (ims.scheduling.domain.objects.DirectoryofService) domMap.get(vo);
          }
        } else {
          dom =
              (ims.scheduling.domain.objects.DirectoryofService)
                  domainFactory.getDomainObject(
                      ims.scheduling.domain.objects.DirectoryofService.class, vo.getBoId());
        }
      }

      // Trying to avoid the hibernate collection being marked as dirty via its public interface
      // methods. (like add)
      if (!domainDirectoryofServices13.contains(dom)) {
        domainDirectoryofServices13.add(dom);
      }
      newSet13.add(dom);
    }
    java.util.Set removedSet13 = new java.util.HashSet();
    java.util.Iterator iter13 = domainDirectoryofServices13.iterator();
    // Find out which objects need to be removed
    while (iter13.hasNext()) {
      ims.domain.DomainObject o = (ims.domain.DomainObject) iter13.next();
      if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue())
          && !newSet13.contains(o)) {
        removedSet13.add(o);
      }
    }
    iter13 = removedSet13.iterator();
    // Remove the unwanted objects
    while (iter13.hasNext()) {
      domainDirectoryofServices13.remove(iter13.next());
    }

    domainObject.setDirectoryofServices(domainDirectoryofServices13);
    domainObject.setIsTheatreSession(valueObject.getIsTheatreSession());

    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;
  }