/**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.emergency.vo.TrackingforDecisionToAdmitDialogVo copy(
     ims.emergency.vo.TrackingforDecisionToAdmitDialogVo valueObjectDest,
     ims.emergency.vo.TrackingforDecisionToAdmitDialogVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_Tracking(valueObjectSrc.getID_Tracking());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // BedAvailability
   valueObjectDest.setBedAvailability(valueObjectSrc.getBedAvailability());
   // AssociatedPendingEmergencyAdmission
   valueObjectDest.setAssociatedPendingEmergencyAdmission(
       valueObjectSrc.getAssociatedPendingEmergencyAdmission());
   // Patient
   valueObjectDest.setPatient(valueObjectSrc.getPatient());
   // Attendance
   valueObjectDest.setAttendance(valueObjectSrc.getAttendance());
   // Episode
   valueObjectDest.setEpisode(valueObjectSrc.getEpisode());
   // TriageDetails
   valueObjectDest.setTriageDetails(valueObjectSrc.getTriageDetails());
   // CurrentArea
   valueObjectDest.setCurrentArea(valueObjectSrc.getCurrentArea());
   // isDischarged
   valueObjectDest.setIsDischarged(valueObjectSrc.getIsDischarged());
   // CurrentStatus
   valueObjectDest.setCurrentStatus(valueObjectSrc.getCurrentStatus());
   // SeenBy
   valueObjectDest.setSeenBy(valueObjectSrc.getSeenBy());
   // CurrentReferral
   valueObjectDest.setCurrentReferral(valueObjectSrc.getCurrentReferral());
   // SeenByNurse
   valueObjectDest.setSeenByNurse(valueObjectSrc.getSeenByNurse());
   return valueObjectDest;
 }
  public static ims.emergency.domain.objects.Tracking extractTracking(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.emergency.vo.TrackingforDecisionToAdmitDialogVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Tracking();
    ims.emergency.domain.objects.Tracking domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.emergency.domain.objects.Tracking) domMap.get(valueObject);
      }
      // ims.emergency.vo.TrackingforDecisionToAdmitDialogVo ID_Tracking field is unknown
      domainObject = new ims.emergency.domain.objects.Tracking();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Tracking());
      if (domMap.get(key) != null) {
        return (ims.emergency.domain.objects.Tracking) domMap.get(key);
      }
      domainObject =
          (ims.emergency.domain.objects.Tracking)
              domainFactory.getDomainObject(ims.emergency.domain.objects.Tracking.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_Tracking());

    domainObject.setBedAvailability(
        ims.emergency.vo.domain.BedAvailabilityForTrackVoAssembler.extractBedAvailability(
            domainFactory, valueObject.getBedAvailability(), domMap));
    domainObject.setAssociatedPendingEmergencyAdmission(
        ims.emergency.vo.domain.PendingEmergencyAdmissionShortVoAssembler
            .extractPendingEmergencyAdmission(
                domainFactory, valueObject.getAssociatedPendingEmergencyAdmission(), domMap));
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.patient.domain.objects.Patient value3 = null;
    if (null != valueObject.getPatient()) {
      if (valueObject.getPatient().getBoId() == null) {
        if (domMap.get(valueObject.getPatient()) != null) {
          value3 = (ims.core.patient.domain.objects.Patient) domMap.get(valueObject.getPatient());
        }
      } else {
        value3 =
            (ims.core.patient.domain.objects.Patient)
                domainFactory.getDomainObject(
                    ims.core.patient.domain.objects.Patient.class,
                    valueObject.getPatient().getBoId());
      }
    }
    domainObject.setPatient(value3);
    domainObject.setAttendance(
        ims.emergency.vo.domain.EmergencyAttendanceForTriageLiteVoAssembler
            .extractEmergencyAttendance(domainFactory, valueObject.getAttendance(), domMap));
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.admin.domain.objects.EmergencyEpisode value5 = null;
    if (null != valueObject.getEpisode()) {
      if (valueObject.getEpisode().getBoId() == null) {
        if (domMap.get(valueObject.getEpisode()) != null) {
          value5 =
              (ims.core.admin.domain.objects.EmergencyEpisode) domMap.get(valueObject.getEpisode());
        }
      } else {
        value5 =
            (ims.core.admin.domain.objects.EmergencyEpisode)
                domainFactory.getDomainObject(
                    ims.core.admin.domain.objects.EmergencyEpisode.class,
                    valueObject.getEpisode().getBoId());
      }
    }
    domainObject.setEpisode(value5);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.emergency.domain.objects.Triage value6 = null;
    if (null != valueObject.getTriageDetails()) {
      if (valueObject.getTriageDetails().getBoId() == null) {
        if (domMap.get(valueObject.getTriageDetails()) != null) {
          value6 = (ims.emergency.domain.objects.Triage) domMap.get(valueObject.getTriageDetails());
        }
      } else {
        value6 =
            (ims.emergency.domain.objects.Triage)
                domainFactory.getDomainObject(
                    ims.emergency.domain.objects.Triage.class,
                    valueObject.getTriageDetails().getBoId());
      }
    }
    domainObject.setTriageDetails(value6);
    domainObject.setCurrentArea(
        ims.emergency.vo.domain.TrackingAreaLiteVoAssembler.extractTrackingArea(
            domainFactory, valueObject.getCurrentArea(), domMap));
    domainObject.setIsDischarged(valueObject.getIsDischarged());
    domainObject.setCurrentStatus(
        ims.emergency.vo.domain.TrackingAttendanceStatusVoAssembler.extractTrackingAttendanceStatus(
            domainFactory, valueObject.getCurrentStatus(), domMap));
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.emergency.domain.objects.SeenByHCP value10 = null;
    if (null != valueObject.getSeenBy()) {
      if (valueObject.getSeenBy().getBoId() == null) {
        if (domMap.get(valueObject.getSeenBy()) != null) {
          value10 = (ims.emergency.domain.objects.SeenByHCP) domMap.get(valueObject.getSeenBy());
        }
      } else {
        value10 =
            (ims.emergency.domain.objects.SeenByHCP)
                domainFactory.getDomainObject(
                    ims.emergency.domain.objects.SeenByHCP.class,
                    valueObject.getSeenBy().getBoId());
      }
    }
    domainObject.setSeenBy(value10);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.emergency.domain.objects.ReferralToSpecTeam value11 = null;
    if (null != valueObject.getCurrentReferral()) {
      if (valueObject.getCurrentReferral().getBoId() == null) {
        if (domMap.get(valueObject.getCurrentReferral()) != null) {
          value11 =
              (ims.emergency.domain.objects.ReferralToSpecTeam)
                  domMap.get(valueObject.getCurrentReferral());
        }
      } else {
        value11 =
            (ims.emergency.domain.objects.ReferralToSpecTeam)
                domainFactory.getDomainObject(
                    ims.emergency.domain.objects.ReferralToSpecTeam.class,
                    valueObject.getCurrentReferral().getBoId());
      }
    }
    domainObject.setCurrentReferral(value11);
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.emergency.domain.objects.SeenByHCP value12 = null;
    if (null != valueObject.getSeenByNurse()) {
      if (valueObject.getSeenByNurse().getBoId() == null) {
        if (domMap.get(valueObject.getSeenByNurse()) != null) {
          value12 =
              (ims.emergency.domain.objects.SeenByHCP) domMap.get(valueObject.getSeenByNurse());
        }
      } else {
        value12 =
            (ims.emergency.domain.objects.SeenByHCP)
                domainFactory.getDomainObject(
                    ims.emergency.domain.objects.SeenByHCP.class,
                    valueObject.getSeenByNurse().getBoId());
      }
    }
    domainObject.setSeenByNurse(value12);

    return domainObject;
  }