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

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

    // BedAvailability
    valueObject.setBedAvailability(
        ims.emergency.vo.domain.BedAvailabilityForTrackVoAssembler.create(
            map, domainObject.getBedAvailability()));
    // AssociatedPendingEmergencyAdmission
    valueObject.setAssociatedPendingEmergencyAdmission(
        ims.emergency.vo.domain.PendingEmergencyAdmissionShortVoAssembler.create(
            map, domainObject.getAssociatedPendingEmergencyAdmission()));
    // Patient
    valueObject.setPatient(
        ims.emergency.vo.domain.PatientForTriageVoAssembler.create(map, domainObject.getPatient()));
    // Attendance
    valueObject.setAttendance(
        ims.emergency.vo.domain.EmergencyAttendanceForTriageLiteVoAssembler.create(
            map, domainObject.getAttendance()));
    // Episode
    valueObject.setEpisode(
        ims.emergency.vo.domain.EmergencyEpisodeForTriageLiteVoAssembler.create(
            map, domainObject.getEpisode()));
    // TriageDetails
    valueObject.setTriageDetails(
        ims.emergency.vo.domain.TriageForClinicianWorklistVoAssembler.create(
            map, domainObject.getTriageDetails()));
    // CurrentArea
    valueObject.setCurrentArea(
        ims.emergency.vo.domain.TrackingAreaLiteVoAssembler.create(
            map, domainObject.getCurrentArea()));
    // isDischarged
    valueObject.setIsDischarged(domainObject.isIsDischarged());
    // CurrentStatus
    valueObject.setCurrentStatus(
        ims.emergency.vo.domain.TrackingAttendanceStatusVoAssembler.create(
            map, domainObject.getCurrentStatus()));
    // SeenBy
    valueObject.setSeenBy(
        ims.emergency.vo.domain.SeenByHCPForEDAssessmentComponentVoAssembler.create(
            map, domainObject.getSeenBy()));
    // CurrentReferral
    valueObject.setCurrentReferral(
        ims.emergency.vo.domain.ReferralToSpecialtyTeamForEDAssessmentComponentVoAssembler.create(
            map, domainObject.getCurrentReferral()));
    // SeenByNurse
    valueObject.setSeenByNurse(
        ims.emergency.vo.domain.SeenByHCPForEDAssessmentComponentVoAssembler.create(
            map, domainObject.getSeenByNurse()));
    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.emergency.domain.objects.Tracking
   */
  public static ims.emergency.vo.TrackingForSeenByHCPVo insert(
      DomainObjectMap map,
      ims.emergency.vo.TrackingForSeenByHCPVo valueObject,
      ims.emergency.domain.objects.Tracking domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_Tracking(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()));
      }
    }
    // CurrentArea
    valueObject.setCurrentArea(
        ims.emergency.vo.domain.TrackingAreaLiteVoAssembler.create(
            map, domainObject.getCurrentArea()));
    // CurrentStatus
    valueObject.setCurrentStatus(
        ims.emergency.vo.domain.TrackingAttendanceStatusVoAssembler.create(
            map, domainObject.getCurrentStatus()));
    // isDischarged
    valueObject.setIsDischarged(domainObject.isIsDischarged());
    // SeenBy
    valueObject.setSeenBy(
        ims.emergency.vo.domain.SeenByHCPVoAssembler.create(map, domainObject.getSeenBy()));
    // TriageDetails
    valueObject.setTriageDetails(
        ims.emergency.vo.domain.TriageForSeenByHcpVoAssembler.create(
            map, domainObject.getTriageDetails()));
    // SeenByNurse
    valueObject.setSeenByNurse(
        ims.emergency.vo.domain.SeenByHCPVoAssembler.create(map, domainObject.getSeenByNurse()));
    // Attendance
    valueObject.setAttendance(
        ims.emergency.vo.domain.AttendanceForSeenByHCPVoAssembler.create(
            map, domainObject.getAttendance()));
    return valueObject;
  }