/**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.emergency.vo.EmergencyAttendanceForTriageLiteVo copy(
     ims.emergency.vo.EmergencyAttendanceForTriageLiteVo valueObjectDest,
     ims.emergency.vo.EmergencyAttendanceForTriageLiteVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_EmergencyAttendance(valueObjectSrc.getID_EmergencyAttendance());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // ArrivalDateTime
   valueObjectDest.setArrivalDateTime(valueObjectSrc.getArrivalDateTime());
   // DischargeDateTime
   valueObjectDest.setDischargeDateTime(valueObjectSrc.getDischargeDateTime());
   // CareContext
   valueObjectDest.setCareContext(valueObjectSrc.getCareContext());
   // UrgencyLevel
   valueObjectDest.setUrgencyLevel(valueObjectSrc.getUrgencyLevel());
   // ConclusionDateTime
   valueObjectDest.setConclusionDateTime(valueObjectSrc.getConclusionDateTime());
   // BedTypeRequested
   valueObjectDest.setBedTypeRequested(valueObjectSrc.getBedTypeRequested());
   // MC
   valueObjectDest.setMC(valueObjectSrc.getMC());
   // COTA
   valueObjectDest.setCOTA(valueObjectSrc.getCOTA());
   // PCG1
   valueObjectDest.setPCG1(valueObjectSrc.getPCG1());
   // PCG2
   valueObjectDest.setPCG2(valueObjectSrc.getPCG2());
   // HAR
   valueObjectDest.setHAR(valueObjectSrc.getHAR());
   // Purchaser
   valueObjectDest.setPurchaser(valueObjectSrc.getPurchaser());
   // SequenceNumber
   valueObjectDest.setSequenceNumber(valueObjectSrc.getSequenceNumber());
   // customID
   valueObjectDest.setCustomID(valueObjectSrc.getCustomID());
   // EndOfRegistrationDateTime
   valueObjectDest.setEndOfRegistrationDateTime(valueObjectSrc.getEndOfRegistrationDateTime());
   // ModeOfArrival
   valueObjectDest.setModeOfArrival(valueObjectSrc.getModeOfArrival());
   // RegistrationDateTime
   valueObjectDest.setRegistrationDateTime(valueObjectSrc.getRegistrationDateTime());
   // AgeAtAttendance
   valueObjectDest.setAgeAtAttendance(valueObjectSrc.getAgeAtAttendance());
   return valueObjectDest;
 }
  public static ims.core.admin.domain.objects.EmergencyAttendance extractEmergencyAttendance(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.emergency.vo.EmergencyAttendanceForTriageLiteVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_EmergencyAttendance();
    ims.core.admin.domain.objects.EmergencyAttendance domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.admin.domain.objects.EmergencyAttendance) domMap.get(valueObject);
      }
      // ims.emergency.vo.EmergencyAttendanceForTriageLiteVo ID_EmergencyAttendance field is unknown
      domainObject = new ims.core.admin.domain.objects.EmergencyAttendance();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_EmergencyAttendance());
      if (domMap.get(key) != null) {
        return (ims.core.admin.domain.objects.EmergencyAttendance) domMap.get(key);
      }
      domainObject =
          (ims.core.admin.domain.objects.EmergencyAttendance)
              domainFactory.getDomainObject(
                  ims.core.admin.domain.objects.EmergencyAttendance.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_EmergencyAttendance());

    ims.framework.utils.DateTime dateTime1 = valueObject.getArrivalDateTime();
    java.util.Date value1 = null;
    if (dateTime1 != null) {
      value1 = dateTime1.getJavaDate();
    }
    domainObject.setArrivalDateTime(value1);
    ims.framework.utils.DateTime dateTime2 = valueObject.getDischargeDateTime();
    java.util.Date value2 = null;
    if (dateTime2 != null) {
      value2 = dateTime2.getJavaDate();
    }
    domainObject.setDischargeDateTime(value2);
    ims.core.admin.domain.objects.CareContext value3 = null;
    if (null != valueObject.getCareContext()) {
      if (valueObject.getCareContext().getBoId() == null) {
        if (domMap.get(valueObject.getCareContext()) != null) {
          value3 =
              (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
                 // BO field
      {
        value3 = domainObject.getCareContext();
      } else {
        value3 =
            (ims.core.admin.domain.objects.CareContext)
                domainFactory.getDomainObject(
                    ims.core.admin.domain.objects.CareContext.class,
                    valueObject.getCareContext().getBoId());
      }
    }
    domainObject.setCareContext(value3);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value4 = null;
    if (null != valueObject.getUrgencyLevel()) {
      value4 = domainFactory.getLookupInstance(valueObject.getUrgencyLevel().getID());
    }
    domainObject.setUrgencyLevel(value4);
    ims.framework.utils.DateTime dateTime5 = valueObject.getConclusionDateTime();
    java.util.Date value5 = null;
    if (dateTime5 != null) {
      value5 = dateTime5.getJavaDate();
    }
    domainObject.setConclusionDateTime(value5);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value6 = null;
    if (null != valueObject.getBedTypeRequested()) {
      value6 = domainFactory.getLookupInstance(valueObject.getBedTypeRequested().getID());
    }
    domainObject.setBedTypeRequested(value6);
    // 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.getMC() != null && valueObject.getMC().equals("")) {
      valueObject.setMC(null);
    }
    domainObject.setMC(valueObject.getMC());
    // 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.getCOTA() != null && valueObject.getCOTA().equals("")) {
      valueObject.setCOTA(null);
    }
    domainObject.setCOTA(valueObject.getCOTA());
    // 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.getPCG1() != null && valueObject.getPCG1().equals("")) {
      valueObject.setPCG1(null);
    }
    domainObject.setPCG1(valueObject.getPCG1());
    // 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.getPCG2() != null && valueObject.getPCG2().equals("")) {
      valueObject.setPCG2(null);
    }
    domainObject.setPCG2(valueObject.getPCG2());
    // 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.getHAR() != null && valueObject.getHAR().equals("")) {
      valueObject.setHAR(null);
    }
    domainObject.setHAR(valueObject.getHAR());
    // 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.getPurchaser() != null && valueObject.getPurchaser().equals("")) {
      valueObject.setPurchaser(null);
    }
    domainObject.setPurchaser(valueObject.getPurchaser());
    // 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.getSequenceNumber() != null && valueObject.getSequenceNumber().equals("")) {
      valueObject.setSequenceNumber(null);
    }
    domainObject.setSequenceNumber(valueObject.getSequenceNumber());
    // 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.getCustomID() != null && valueObject.getCustomID().equals("")) {
      valueObject.setCustomID(null);
    }
    domainObject.setCustomID(valueObject.getCustomID());
    ims.framework.utils.DateTime dateTime15 = valueObject.getEndOfRegistrationDateTime();
    java.util.Date value15 = null;
    if (dateTime15 != null) {
      value15 = dateTime15.getJavaDate();
    }
    domainObject.setEndOfRegistrationDateTime(value15);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value16 = null;
    if (null != valueObject.getModeOfArrival()) {
      value16 = domainFactory.getLookupInstance(valueObject.getModeOfArrival().getID());
    }
    domainObject.setModeOfArrival(value16);
    ims.framework.utils.DateTime dateTime17 = valueObject.getRegistrationDateTime();
    java.util.Date value17 = null;
    if (dateTime17 != null) {
      value17 = dateTime17.getJavaDate();
    }
    domainObject.setRegistrationDateTime(value17);
    domainObject.setAgeAtAttendance(valueObject.getAgeAtAttendance());

    return domainObject;
  }