public static ims.core.admin.pas.domain.objects.PASEvent extractPASEvent(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.clinical.vo.PasEventForHospitalAtNightVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_PASEvent();
    ims.core.admin.pas.domain.objects.PASEvent domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.admin.pas.domain.objects.PASEvent) domMap.get(valueObject);
      }
      // ims.clinical.vo.PasEventForHospitalAtNightVo ID_PASEvent field is unknown
      domainObject = new ims.core.admin.pas.domain.objects.PASEvent();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PASEvent());
      if (domMap.get(key) != null) {
        return (ims.core.admin.pas.domain.objects.PASEvent) domMap.get(key);
      }
      domainObject =
          (ims.core.admin.pas.domain.objects.PASEvent)
              domainFactory.getDomainObject(ims.core.admin.pas.domain.objects.PASEvent.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_PASEvent());

    ims.core.resource.place.domain.objects.Location value1 = null;
    if (null != valueObject.getLocation()) {
      if (valueObject.getLocation().getBoId() == null) {
        if (domMap.get(valueObject.getLocation()) != null) {
          value1 =
              (ims.core.resource.place.domain.objects.Location)
                  domMap.get(valueObject.getLocation());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
                 // BO field
      {
        value1 = domainObject.getLocation();
      } else {
        value1 =
            (ims.core.resource.place.domain.objects.Location)
                domainFactory.getDomainObject(
                    ims.core.resource.place.domain.objects.Location.class,
                    valueObject.getLocation().getBoId());
      }
    }
    domainObject.setLocation(value1);

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

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

    // Location
    if (domainObject.getLocation() != null) {
      if (domainObject.getLocation()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getLocation();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setLocation(new ims.core.resource.place.vo.LocationRefVo(id, -1));
      } else {
        valueObject.setLocation(
            new ims.core.resource.place.vo.LocationRefVo(
                domainObject.getLocation().getId(), domainObject.getLocation().getVersion()));
      }
    }
    return valueObject;
  }
 /**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.clinical.vo.PasEventForHospitalAtNightVo copy(
     ims.clinical.vo.PasEventForHospitalAtNightVo valueObjectDest,
     ims.clinical.vo.PasEventForHospitalAtNightVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_PASEvent(valueObjectSrc.getID_PASEvent());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // Location
   valueObjectDest.setLocation(valueObjectSrc.getLocation());
   return valueObjectDest;
 }