public static ims.core.clinical.domain.objects.EpworthSleepAssessment
      extractEpworthSleepAssessment(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.generalmedical.vo.EpworthSleepAssessmentVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_EpworthSleepAssessment();
    ims.core.clinical.domain.objects.EpworthSleepAssessment domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.clinical.domain.objects.EpworthSleepAssessment) domMap.get(valueObject);
      }
      // ims.generalmedical.vo.EpworthSleepAssessmentVo ID_EpworthSleepAssessment field is unknown
      domainObject = new ims.core.clinical.domain.objects.EpworthSleepAssessment();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_EpworthSleepAssessment());
      if (domMap.get(key) != null) {
        return (ims.core.clinical.domain.objects.EpworthSleepAssessment) domMap.get(key);
      }
      domainObject =
          (ims.core.clinical.domain.objects.EpworthSleepAssessment)
              domainFactory.getDomainObject(
                  ims.core.clinical.domain.objects.EpworthSleepAssessment.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_EpworthSleepAssessment());

    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value1 = null;
    if (null != valueObject.getChanceOfSleep()) {
      value1 = domainFactory.getLookupInstance(valueObject.getChanceOfSleep().getID());
    }
    domainObject.setChanceOfSleep(value1);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value2 = null;
    if (null != valueObject.getSleepScore()) {
      value2 = domainFactory.getLookupInstance(valueObject.getSleepScore().getID());
    }
    domainObject.setSleepScore(value2);

    return domainObject;
  }
 /**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.generalmedical.vo.EpworthSleepAssessmentVo copy(
     ims.generalmedical.vo.EpworthSleepAssessmentVo valueObjectDest,
     ims.generalmedical.vo.EpworthSleepAssessmentVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_EpworthSleepAssessment(valueObjectSrc.getID_EpworthSleepAssessment());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // ChanceOfSleep
   valueObjectDest.setChanceOfSleep(valueObjectSrc.getChanceOfSleep());
   // SleepScore
   valueObjectDest.setSleepScore(valueObjectSrc.getSleepScore());
   return valueObjectDest;
 }