/**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.ocrr.vo.SpecimenWorkListItemListVo copy(
     ims.ocrr.vo.SpecimenWorkListItemListVo valueObjectDest,
     ims.ocrr.vo.SpecimenWorkListItemListVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_SpecimenWorkListItem(valueObjectSrc.getID_SpecimenWorkListItem());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // Specimen
   valueObjectDest.setSpecimen(valueObjectSrc.getSpecimen());
   // ListType
   valueObjectDest.setListType(valueObjectSrc.getListType());
   // DateToCollect
   valueObjectDest.setDateToCollect(valueObjectSrc.getDateToCollect());
   // RoundToCollect
   valueObjectDest.setRoundToCollect(valueObjectSrc.getRoundToCollect());
   // TimeToCollect
   valueObjectDest.setTimeToCollect(valueObjectSrc.getTimeToCollect());
   // CollectionStatus
   valueObjectDest.setCollectionStatus(valueObjectSrc.getCollectionStatus());
   // Printed
   valueObjectDest.setPrinted(valueObjectSrc.getPrinted());
   // DFTOrderInvestigation
   valueObjectDest.setDFTOrderInvestigation(valueObjectSrc.getDFTOrderInvestigation());
   // Ward
   valueObjectDest.setWard(valueObjectSrc.getWard());
   return valueObjectDest;
 }
  public static ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem
      extractSpecimenWorkListItem(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.ocrr.vo.SpecimenWorkListItemListVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_SpecimenWorkListItem();
    ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem)
            domMap.get(valueObject);
      }
      // ims.ocrr.vo.SpecimenWorkListItemListVo ID_SpecimenWorkListItem field is unknown
      domainObject = new ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_SpecimenWorkListItem());
      if (domMap.get(key) != null) {
        return (ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem) domMap.get(key);
      }
      domainObject =
          (ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem)
              domainFactory.getDomainObject(
                  ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem.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_SpecimenWorkListItem());

    domainObject.setSpecimen(
        ims.ocrr.vo.domain.OrderSpecimenListVoAssembler.extractOrderSpecimen(
            domainFactory, valueObject.getSpecimen(), domMap));
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value2 = null;
    if (null != valueObject.getListType()) {
      value2 = domainFactory.getLookupInstance(valueObject.getListType().getID());
    }
    domainObject.setListType(value2);
    java.util.Date value3 = null;
    ims.framework.utils.Date date3 = valueObject.getDateToCollect();
    if (date3 != null) {
      value3 = date3.getDate();
    }
    domainObject.setDateToCollect(value3);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value4 = null;
    if (null != valueObject.getRoundToCollect()) {
      value4 = domainFactory.getLookupInstance(valueObject.getRoundToCollect().getID());
    }
    domainObject.setRoundToCollect(value4);
    ims.framework.utils.Time time5 = valueObject.getTimeToCollect();
    String value5 = null;
    if (time5 != null) {
      value5 = time5.toString();
    }
    domainObject.setTimeToCollect(value5);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value6 = null;
    if (null != valueObject.getCollectionStatus()) {
      value6 = domainFactory.getLookupInstance(valueObject.getCollectionStatus().getID());
    }
    domainObject.setCollectionStatus(value6);
    domainObject.setPrinted(valueObject.getPrinted());
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.ocrr.orderingresults.domain.objects.OrderInvestigation value8 = null;
    if (null != valueObject.getDFTOrderInvestigation()) {
      if (valueObject.getDFTOrderInvestigation().getBoId() == null) {
        if (domMap.get(valueObject.getDFTOrderInvestigation()) != null) {
          value8 =
              (ims.ocrr.orderingresults.domain.objects.OrderInvestigation)
                  domMap.get(valueObject.getDFTOrderInvestigation());
        }
      } else {
        value8 =
            (ims.ocrr.orderingresults.domain.objects.OrderInvestigation)
                domainFactory.getDomainObject(
                    ims.ocrr.orderingresults.domain.objects.OrderInvestigation.class,
                    valueObject.getDFTOrderInvestigation().getBoId());
      }
    }
    domainObject.setDFTOrderInvestigation(value8);
    ims.core.resource.place.domain.objects.Location value9 = null;
    if (null != valueObject.getWard()) {
      if (valueObject.getWard().getBoId() == null) {
        if (domMap.get(valueObject.getWard()) != null) {
          value9 =
              (ims.core.resource.place.domain.objects.Location) domMap.get(valueObject.getWard());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
                 // BO field
      {
        value9 = domainObject.getWard();
      } else {
        value9 =
            (ims.core.resource.place.domain.objects.Location)
                domainFactory.getDomainObject(
                    ims.core.resource.place.domain.objects.Location.class,
                    valueObject.getWard().getBoId());
      }
    }
    domainObject.setWard(value9);

    return domainObject;
  }