public static ims.ocrr.orderingresults.domain.objects.OrderInvestigation
      extractOrderInvestigation(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.ocrr.vo.PathologyOrderVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_OrderInvestigation();
    ims.ocrr.orderingresults.domain.objects.OrderInvestigation domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.ocrr.orderingresults.domain.objects.OrderInvestigation) domMap.get(valueObject);
      }
      // ims.ocrr.vo.PathologyOrderVo ID_OrderInvestigation field is unknown
      domainObject = new ims.ocrr.orderingresults.domain.objects.OrderInvestigation();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_OrderInvestigation());
      if (domMap.get(key) != null) {
        return (ims.ocrr.orderingresults.domain.objects.OrderInvestigation) domMap.get(key);
      }
      domainObject =
          (ims.ocrr.orderingresults.domain.objects.OrderInvestigation)
              domainFactory.getDomainObject(
                  ims.ocrr.orderingresults.domain.objects.OrderInvestigation.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_OrderInvestigation());

    domainObject.setInvestigation(
        ims.ocrr.vo.domain.InvestigationLiteVoAssembler.extractInvestigation(
            domainFactory, valueObject.getInvestigation(), domMap));
    domainObject.setOrderDetails(
        ims.ocrr.vo.domain.OcsOrderShortVoAssembler.extractOcsOrderSession(
            domainFactory, valueObject.getOrderDetails(), domMap));
    ims.framework.utils.DateTime dateTime3 = valueObject.getDisplayDateTime();
    java.util.Date value3 = null;
    if (dateTime3 != null) {
      value3 = dateTime3.getJavaDate();
    }
    domainObject.setDisplayDateTime(value3);
    domainObject.setSpecimen(
        ims.ocrr.vo.domain.OrderSpecimenPathologyVoAssembler.extractOrderSpecimenList(
            domainFactory, valueObject.getSpecimen(), domainObject.getSpecimen(), domMap));

    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.ocrr.orderingresults.domain.objects.OrderInvestigation
   */
  public static ims.ocrr.vo.PathologyOrderVo insert(
      DomainObjectMap map,
      ims.ocrr.vo.PathologyOrderVo valueObject,
      ims.ocrr.orderingresults.domain.objects.OrderInvestigation domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Investigation
    valueObject.setInvestigation(
        ims.ocrr.vo.domain.InvestigationLiteVoAssembler.create(
            map, domainObject.getInvestigation()));
    // OrderDetails
    valueObject.setOrderDetails(
        ims.ocrr.vo.domain.OcsOrderShortVoAssembler.create(map, domainObject.getOrderDetails()));
    // DisplayDateTime
    java.util.Date DisplayDateTime = domainObject.getDisplayDateTime();
    if (null != DisplayDateTime) {
      valueObject.setDisplayDateTime(new ims.framework.utils.DateTime(DisplayDateTime));
    }
    // Specimen
    valueObject.setSpecimen(
        ims.ocrr.vo.domain.OrderSpecimenPathologyVoAssembler
            .createOrderSpecimenPathologyVoCollectionFromOrderSpecimen(
                map, domainObject.getSpecimen()));
    return valueObject;
  }