/**
   * 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.ConsultantStay
   */
  public static ims.core.vo.ConsultantStayMinVo insert(
      DomainObjectMap map,
      ims.core.vo.ConsultantStayMinVo valueObject,
      ims.core.admin.pas.domain.objects.ConsultantStay domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // transferDateTime
    java.util.Date transferDateTime = domainObject.getTransferDateTime();
    if (null != transferDateTime) {
      valueObject.setTransferDateTime(new ims.framework.utils.DateTime(transferDateTime));
    }
    // endDateTime
    java.util.Date endDateTime = domainObject.getEndDateTime();
    if (null != endDateTime) {
      valueObject.setEndDateTime(new ims.framework.utils.DateTime(endDateTime));
    }
    // PatientStatus
    ims.domain.lookups.LookupInstance instance3 = domainObject.getPatientStatus();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.PatientStatus voLookup3 =
          new ims.core.vo.lookups.PatientStatus(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.core.vo.lookups.PatientStatus parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.core.vo.lookups.PatientStatus(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setPatientStatus(voLookup3);
    }
    return valueObject;
  }
Ejemplo n.º 2
0
 public static void fillFieldsfromXML(
     org.dom4j.Element el,
     ims.domain.DomainFactory factory,
     PlanOfCare obj,
     java.util.HashMap domMap)
     throws Exception {
   org.dom4j.Element fldEl;
   fldEl = el.element("clinicalContact");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setClinicalContact(
         ims.core.admin.domain.objects.ClinicalContact.getClinicalContactfromXML(
             fldEl, factory, domMap));
   }
   fldEl = el.element("careContext");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setCareContext(
         ims.core.admin.domain.objects.CareContext.getCareContextfromXML(fldEl, factory, domMap));
   }
   fldEl = el.element("authoringInformation");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setAuthoringInformation(
         ims.core.clinical.domain.objects.AuthoringInformation.getAuthoringInformationfromXML(
             fldEl, factory, domMap));
   }
   fldEl = el.element("startDateTime");
   if (fldEl != null) {
     obj.setStartDateTime(
         new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").parse(fldEl.getTextTrim()));
   }
   fldEl = el.element("startHCP");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setStartHCP(
         ims.core.resource.people.domain.objects.Hcp.getHcpfromXML(fldEl, factory, domMap));
   }
   fldEl = el.element("levelOfIntervention");
   if (fldEl != null) {
     obj.setLevelOfIntervention(ims.framework.utils.Color.getColor(fldEl.getTextTrim()));
   }
   fldEl = el.element("group");
   if (fldEl != null) {
     fldEl = fldEl.element("lki");
     obj.setGroup(ims.domain.lookups.LookupInstance.fromXMLString(fldEl, factory));
   }
   fldEl = el.element("title");
   if (fldEl != null) {
     obj.setTitle(new String(fldEl.getTextTrim()));
   }
   fldEl = el.element("status");
   if (fldEl != null) {
     fldEl = fldEl.element("lki");
     obj.setStatus(ims.domain.lookups.LookupInstance.fromXMLString(fldEl, factory));
   }
   fldEl = el.element("resolvedDateTime");
   if (fldEl != null) {
     obj.setResolvedDateTime(
         new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").parse(fldEl.getTextTrim()));
   }
   fldEl = el.element("resolvingHCP");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setResolvingHCP(
         ims.core.resource.people.domain.objects.Hcp.getHcpfromXML(fldEl, factory, domMap));
   }
   fldEl = el.element("confirmingDateTime");
   if (fldEl != null) {
     obj.setConfirmingDateTime(
         new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").parse(fldEl.getTextTrim()));
   }
   fldEl = el.element("confirmingHCP");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setConfirmingHCP(
         ims.core.resource.people.domain.objects.Hcp.getHcpfromXML(fldEl, factory, domMap));
   }
   fldEl = el.element("actions");
   if (fldEl != null) {
     fldEl = fldEl.element("set");
     obj.setActions(
         ims.nursing.domain.objects.PlanOfCareActions.fromSetXMLString(
             fldEl, factory, obj.getActions(), domMap));
   }
   fldEl = el.element("assessmentQuestion");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setAssessmentQuestion(
         ims.assessment.configuration.domain.objects.AssessmentQuestion
             .getAssessmentQuestionfromXML(fldEl, factory, domMap));
   }
   fldEl = el.element("answerHistory");
   if (fldEl != null) {
     fldEl = fldEl.element("set");
     obj.setAnswerHistory(
         ims.nursing.domain.objects.PlanOfCareHistory.fromSetXMLString(
             fldEl, factory, obj.getAnswerHistory(), domMap));
   }
 }
  /**
   * 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.domain.objects.Referral
   */
  public static ims.core.vo.PASReferralVo insert(
      DomainObjectMap map,
      ims.core.vo.PASReferralVo valueObject,
      ims.core.admin.domain.objects.Referral domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Details
    valueObject.setDetails(domainObject.getDetails());
    // ReferralReceivedDate
    java.util.Date ReferralReceivedDate = domainObject.getReferralReceivedDate();
    if (null != ReferralReceivedDate) {
      valueObject.setReferralReceivedDate(new ims.framework.utils.Date(ReferralReceivedDate));
    }
    // OriginalReferralDate
    java.util.Date OriginalReferralDate = domainObject.getOriginalReferralDate();
    if (null != OriginalReferralDate) {
      valueObject.setOriginalReferralDate(new ims.framework.utils.Date(OriginalReferralDate));
    }
    // FirstApptDate
    java.util.Date FirstApptDate = domainObject.getFirstApptDate();
    if (null != FirstApptDate) {
      valueObject.setFirstApptDate(new ims.framework.utils.DateTime(FirstApptDate));
    }
    // SourceOfReferral
    ims.domain.lookups.LookupInstance instance5 = domainObject.getSourceOfReferral();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.SourceOfReferral voLookup5 =
          new ims.core.vo.lookups.SourceOfReferral(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.core.vo.lookups.SourceOfReferral parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.core.vo.lookups.SourceOfReferral(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setSourceOfReferral(voLookup5);
    }
    // ReferringGP
    valueObject.setReferringGP(
        ims.core.vo.domain.GpLiteVoAssembler.create(map, domainObject.getReferringGP()));
    // ReferringClinician
    valueObject.setReferringClinician(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getReferringClinician()));
    // ReferredTo
    valueObject.setReferredTo(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getReferredTo()));
    // ReferralDetails
    valueObject.setReferralDetails(domainObject.getReferralDetails());
    // DateOfReferral
    java.util.Date DateOfReferral = domainObject.getDateOfReferral();
    if (null != DateOfReferral) {
      valueObject.setDateOfReferral(new ims.framework.utils.Date(DateOfReferral));
    }
    // ReferralLocation
    valueObject.setReferralLocation(domainObject.getReferralLocation());
    // ReferralType
    ims.domain.lookups.LookupInstance instance12 = domainObject.getReferralType();
    if (null != instance12) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance12.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance12.getImage().getImageId(), instance12.getImage().getImagePath());
      }
      color = instance12.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.ReferralType voLookup12 =
          new ims.core.vo.lookups.ReferralType(
              instance12.getId(), instance12.getText(), instance12.isActive(), null, img, color);
      ims.core.vo.lookups.ReferralType parentVoLookup12 = voLookup12;
      ims.domain.lookups.LookupInstance parent12 = instance12.getParent();
      while (parent12 != null) {
        if (parent12.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent12.getImage().getImageId(), parent12.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent12.getColor();
        if (color != null) color.getValue();
        parentVoLookup12.setParent(
            new ims.core.vo.lookups.ReferralType(
                parent12.getId(), parent12.getText(), parent12.isActive(), null, img, color));
        parentVoLookup12 = parentVoLookup12.getParent();
        parent12 = parent12.getParent();
      }
      valueObject.setReferralType(voLookup12);
    }
    return valueObject;
  }
Ejemplo n.º 4
0
  /**
   * 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.clinical.domain.objects.ReferralLetterDetails
   */
  public static ims.RefMan.vo.ReferralLetterServiceVo insert(
      DomainObjectMap map,
      ims.RefMan.vo.ReferralLetterServiceVo valueObject,
      ims.core.clinical.domain.objects.ReferralLetterDetails domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Service
    valueObject.setService(
        ims.core.vo.domain.ServiceLiteVoAssembler.create(map, domainObject.getService()));
    // ReferrerType
    ims.domain.lookups.LookupInstance instance2 = domainObject.getReferrerType();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.SourceOfReferral voLookup2 =
          new ims.core.vo.lookups.SourceOfReferral(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.core.vo.lookups.SourceOfReferral parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.core.vo.lookups.SourceOfReferral(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setReferrerType(voLookup2);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.oncology.domain.objects.PathologyDetails
   */
  public static ims.clinicaladmin.vo.PathologyDetailsVo insert(
      DomainObjectMap map,
      ims.clinicaladmin.vo.PathologyDetailsVo valueObject,
      ims.oncology.domain.objects.PathologyDetails domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // InvasiveLesionSize
    valueObject.setInvasiveLesionSize(domainObject.getInvasiveLesionSize());
    // SynchronousTumourIndicator
    ims.domain.lookups.LookupInstance instance2 = domainObject.getSynchronousTumourIndicator();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.SynchronousTumourIndicator voLookup2 =
          new ims.oncology.vo.lookups.SynchronousTumourIndicator(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.oncology.vo.lookups.SynchronousTumourIndicator parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.oncology.vo.lookups.SynchronousTumourIndicator(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setSynchronousTumourIndicator(voLookup2);
    }
    // Histology
    valueObject.setHistology(
        ims.clinicaladmin.vo.domain.TumourHistologyLiteVoAssembler
            .createTumourHistologyLiteVoCollectionFromTumourHistology(
                map, domainObject.getHistology()));
    // VascularLymphInvasion
    ims.domain.lookups.LookupInstance instance4 = domainObject.getVascularLymphInvasion();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.VascularLymphInvasion voLookup4 =
          new ims.oncology.vo.lookups.VascularLymphInvasion(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.oncology.vo.lookups.VascularLymphInvasion parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.oncology.vo.lookups.VascularLymphInvasion(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setVascularLymphInvasion(voLookup4);
    }
    // ExcisionMargin
    ims.domain.lookups.LookupInstance instance5 = domainObject.getExcisionMargin();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.ExcisionMargin voLookup5 =
          new ims.oncology.vo.lookups.ExcisionMargin(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.oncology.vo.lookups.ExcisionMargin parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.oncology.vo.lookups.ExcisionMargin(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setExcisionMargin(voLookup5);
    }
    // NumberNodesExamined
    valueObject.setNumberNodesExamined(domainObject.getNumberNodesExamined());
    // NodesPositiveNumber
    valueObject.setNodesPositiveNumber(domainObject.getNodesPositiveNumber());
    // PathologicalTVal
    valueObject.setPathologicalTVal(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler.create(
            map, domainObject.getPathologicalTVal()));
    // PathologicalNVal
    valueObject.setPathologicalNVal(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler.create(
            map, domainObject.getPathologicalNVal()));
    // PathologicalMVal
    valueObject.setPathologicalMVal(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler.create(
            map, domainObject.getPathologicalMVal()));
    // PathologicalOverall
    valueObject.setPathologicalOverall(
        ims.clinicaladmin.vo.domain.TumourGroupSiteOverallStagingVoAssembler.create(
            map, domainObject.getPathologicalOverall()));
    // ServiceReportId
    valueObject.setServiceReportId(domainObject.getServiceReportId());
    // ServiceReportStatus
    ims.domain.lookups.LookupInstance instance13 = domainObject.getServiceReportStatus();
    if (null != instance13) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance13.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance13.getImage().getImageId(), instance13.getImage().getImagePath());
      }
      color = instance13.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.ServiceReportStatus voLookup13 =
          new ims.oncology.vo.lookups.ServiceReportStatus(
              instance13.getId(), instance13.getText(), instance13.isActive(), null, img, color);
      ims.oncology.vo.lookups.ServiceReportStatus parentVoLookup13 = voLookup13;
      ims.domain.lookups.LookupInstance parent13 = instance13.getParent();
      while (parent13 != null) {
        if (parent13.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent13.getImage().getImageId(), parent13.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent13.getColor();
        if (color != null) color.getValue();
        parentVoLookup13.setParent(
            new ims.oncology.vo.lookups.ServiceReportStatus(
                parent13.getId(), parent13.getText(), parent13.isActive(), null, img, color));
        parentVoLookup13 = parentVoLookup13.getParent();
        parent13 = parent13.getParent();
      }
      valueObject.setServiceReportStatus(voLookup13);
    }
    // SpecimenNature
    ims.domain.lookups.LookupInstance instance14 = domainObject.getSpecimenNature();
    if (null != instance14) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance14.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance14.getImage().getImageId(), instance14.getImage().getImagePath());
      }
      color = instance14.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.SpecimenNature voLookup14 =
          new ims.oncology.vo.lookups.SpecimenNature(
              instance14.getId(), instance14.getText(), instance14.isActive(), null, img, color);
      ims.oncology.vo.lookups.SpecimenNature parentVoLookup14 = voLookup14;
      ims.domain.lookups.LookupInstance parent14 = instance14.getParent();
      while (parent14 != null) {
        if (parent14.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent14.getImage().getImageId(), parent14.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent14.getColor();
        if (color != null) color.getValue();
        parentVoLookup14.setParent(
            new ims.oncology.vo.lookups.SpecimenNature(
                parent14.getId(), parent14.getText(), parent14.isActive(), null, img, color));
        parentVoLookup14 = parentVoLookup14.getParent();
        parent14 = parent14.getParent();
      }
      valueObject.setSpecimenNature(voLookup14);
    }
    // OrgaCodeRequester
    valueObject.setOrgaCodeRequester(
        ims.core.vo.domain.OrgLiteVoAssembler.create(map, domainObject.getOrgaCodeRequester()));
    // CareProfCodeRequester
    valueObject.setCareProfCodeRequester(
        (ims.core.vo.HcpLiteVo)
            ims.core.vo.domain.HcpLiteVoAssembler.create(
                map, domainObject.getCareProfCodeRequester()));
    // TCategoryExtended
    valueObject.setTCategoryExtended(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler
            .createTumourGroupSiteTNMValueVoCollectionFromTumourGroupSiteTNMValue(
                map, domainObject.getTCategoryExtended()));
    // MCategoryExtended
    valueObject.setMCategoryExtended(
        ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueVoAssembler
            .createTumourGroupSiteTNMValueVoCollectionFromTumourGroupSiteTNMValue(
                map, domainObject.getMCategoryExtended()));
    // Status
    ims.domain.lookups.LookupInstance instance19 = domainObject.getStatus();
    if (null != instance19) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance19.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance19.getImage().getImageId(), instance19.getImage().getImagePath());
      }
      color = instance19.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.HistopathologyReportStatus voLookup19 =
          new ims.oncology.vo.lookups.HistopathologyReportStatus(
              instance19.getId(), instance19.getText(), instance19.isActive(), null, img, color);
      ims.oncology.vo.lookups.HistopathologyReportStatus parentVoLookup19 = voLookup19;
      ims.domain.lookups.LookupInstance parent19 = instance19.getParent();
      while (parent19 != null) {
        if (parent19.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent19.getImage().getImageId(), parent19.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent19.getColor();
        if (color != null) color.getValue();
        parentVoLookup19.setParent(
            new ims.oncology.vo.lookups.HistopathologyReportStatus(
                parent19.getId(), parent19.getText(), parent19.isActive(), null, img, color));
        parentVoLookup19 = parentVoLookup19.getParent();
        parent19 = parent19.getParent();
      }
      valueObject.setStatus(voLookup19);
    }
    // AuthoringInformation
    valueObject.setAuthoringInformation(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getAuthoringInformation()));
    // AssociatedQuestions
    valueObject.setAssociatedQuestions(
        ims.assessment.vo.domain.PatientAssessmentVoAssembler.create(
            map, domainObject.getAssociatedQuestions()));
    // AssociatiatedTumourDetails
    valueObject.setAssociatiatedTumourDetails(
        ims.oncology.vo.domain.PrimaryTumourDetailsShortVoAssembler.create(
            map, domainObject.getAssociatiatedTumourDetails()));
    // GradeOfDifferentation
    valueObject.setGradeOfDifferentation(
        ims.clinicaladmin.vo.domain.TumourGroupHistopathologyGradeVoAssembler.create(
            map, domainObject.getGradeOfDifferentation()));
    // InvestigationType
    ims.domain.lookups.LookupInstance instance24 = domainObject.getInvestigationType();
    if (null != instance24) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance24.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance24.getImage().getImageId(), instance24.getImage().getImagePath());
      }
      color = instance24.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.InvestigationType voLookup24 =
          new ims.oncology.vo.lookups.InvestigationType(
              instance24.getId(), instance24.getText(), instance24.isActive(), null, img, color);
      ims.oncology.vo.lookups.InvestigationType parentVoLookup24 = voLookup24;
      ims.domain.lookups.LookupInstance parent24 = instance24.getParent();
      while (parent24 != null) {
        if (parent24.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent24.getImage().getImageId(), parent24.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent24.getColor();
        if (color != null) color.getValue();
        parentVoLookup24.setParent(
            new ims.oncology.vo.lookups.InvestigationType(
                parent24.getId(), parent24.getText(), parent24.isActive(), null, img, color));
        parentVoLookup24 = parentVoLookup24.getParent();
        parent24 = parent24.getParent();
      }
      valueObject.setInvestigationType(voLookup24);
    }
    // SampleReceiptDate
    java.util.Date SampleReceiptDate = domainObject.getSampleReceiptDate();
    if (null != SampleReceiptDate) {
      valueObject.setSampleReceiptDate(new ims.framework.utils.Date(SampleReceiptDate));
    }
    // InvestigationResultDate
    java.util.Date InvestigationResultDate = domainObject.getInvestigationResultDate();
    if (null != InvestigationResultDate) {
      valueObject.setInvestigationResultDate(new ims.framework.utils.Date(InvestigationResultDate));
    }
    // ReportingConsultantCode
    valueObject.setReportingConsultantCode(
        (ims.core.vo.HcpLiteVo)
            ims.core.vo.domain.HcpLiteVoAssembler.create(
                map, domainObject.getReportingConsultantCode()));
    // ReportingOrganisation
    valueObject.setReportingOrganisation(
        ims.core.vo.domain.OrgLiteVoAssembler.create(map, domainObject.getReportingOrganisation()));
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    // PreviousVersion
    if (domainObject.getPreviousVersion() != null) {
      if (domainObject.getPreviousVersion()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPreviousVersion();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPreviousVersion(new ims.oncology.vo.PathologyDetailsRefVo(id, -1));
      } else {
        valueObject.setPreviousVersion(
            new ims.oncology.vo.PathologyDetailsRefVo(
                domainObject.getPreviousVersion().getId(),
                domainObject.getPreviousVersion().getVersion()));
      }
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.nursing.domain.objects.PlanOfCare
   */
  public static ims.nursing.vo.PlanOfCareListVo insert(
      DomainObjectMap map,
      ims.nursing.vo.PlanOfCareListVo valueObject,
      ims.nursing.domain.objects.PlanOfCare domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Actions
    valueObject.setActions(
        ims.nursing.vo.domain.PlanOfCareActionsVoAssembler
            .createPlanOfCareActionsVoCollectionFromPlanOfCareActions(
                map, domainObject.getActions()));
    // Group
    ims.domain.lookups.LookupInstance instance2 = domainObject.getGroup();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.clinical.vo.lookups.PlanOfCareGroupings voLookup2 =
          new ims.clinical.vo.lookups.PlanOfCareGroupings(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.clinical.vo.lookups.PlanOfCareGroupings parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.clinical.vo.lookups.PlanOfCareGroupings(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setGroup(voLookup2);
    }
    // Title
    valueObject.setTitle(domainObject.getTitle());
    // StartDateTime
    java.util.Date StartDateTime = domainObject.getStartDateTime();
    if (null != StartDateTime) {
      valueObject.setStartDateTime(new ims.framework.utils.DateTime(StartDateTime));
    }
    // ResolvedDateTime
    java.util.Date ResolvedDateTime = domainObject.getResolvedDateTime();
    if (null != ResolvedDateTime) {
      valueObject.setResolvedDateTime(new ims.framework.utils.DateTime(ResolvedDateTime));
    }
    // AssessmentQuestion
    valueObject.setAssessmentQuestion(
        ims.core.vo.domain.AssessmentQuestionShortVoAssembler.create(
            map, domainObject.getAssessmentQuestion()));
    // LevelOfIntervention
    valueObject.setLevelOfIntervention(domainObject.getLevelOfIntervention());
    return valueObject;
  }
  /**
   * 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.SpecimenWorkListItem
   */
  public static ims.ocrr.vo.SpecimenWorkListItemListVo insert(
      DomainObjectMap map,
      ims.ocrr.vo.SpecimenWorkListItemListVo valueObject,
      ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Specimen
    valueObject.setSpecimen(
        ims.ocrr.vo.domain.OrderSpecimenListVoAssembler.create(map, domainObject.getSpecimen()));
    // ListType
    ims.domain.lookups.LookupInstance instance2 = domainObject.getListType();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.SpecimenCollectionMethod voLookup2 =
          new ims.ocrr.vo.lookups.SpecimenCollectionMethod(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.ocrr.vo.lookups.SpecimenCollectionMethod parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.ocrr.vo.lookups.SpecimenCollectionMethod(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setListType(voLookup2);
    }
    // DateToCollect
    java.util.Date DateToCollect = domainObject.getDateToCollect();
    if (null != DateToCollect) {
      valueObject.setDateToCollect(new ims.framework.utils.Date(DateToCollect));
    }
    // RoundToCollect
    ims.domain.lookups.LookupInstance instance4 = domainObject.getRoundToCollect();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.SpecimenCollectionTime voLookup4 =
          new ims.ocrr.vo.lookups.SpecimenCollectionTime(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.ocrr.vo.lookups.SpecimenCollectionTime parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.ocrr.vo.lookups.SpecimenCollectionTime(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setRoundToCollect(voLookup4);
    }
    // TimeToCollect
    String TimeToCollect = domainObject.getTimeToCollect();
    if (null != TimeToCollect) {
      valueObject.setTimeToCollect(new ims.framework.utils.Time(TimeToCollect));
    }
    // CollectionStatus
    ims.domain.lookups.LookupInstance instance6 = domainObject.getCollectionStatus();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.SpecimenCollectionStatus voLookup6 =
          new ims.ocrr.vo.lookups.SpecimenCollectionStatus(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.ocrr.vo.lookups.SpecimenCollectionStatus parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.ocrr.vo.lookups.SpecimenCollectionStatus(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setCollectionStatus(voLookup6);
    }
    // Printed
    valueObject.setPrinted(domainObject.isPrinted());
    // DFTOrderInvestigation
    valueObject.setDFTOrderInvestigation(
        ims.ocrr.vo.domain.DftOrderInvestigationVoAssembler.create(
            map, domainObject.getDFTOrderInvestigation()));
    // Ward
    if (domainObject.getWard() != null) {
      if (domainObject.getWard()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getWard();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setWard(new ims.core.resource.place.vo.LocationRefVo(id, -1));
      } else {
        valueObject.setWard(
            new ims.core.resource.place.vo.LocationRefVo(
                domainObject.getWard().getId(), domainObject.getWard().getVersion()));
      }
    }
    return valueObject;
  }
  /**
   * 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.clinical.domain.objects.Service
   */
  public static ims.admin.vo.ServiceForElectiveListConfigVo insert(
      DomainObjectMap map,
      ims.admin.vo.ServiceForElectiveListConfigVo valueObject,
      ims.core.clinical.domain.objects.Service domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ServiceName
    valueObject.setServiceName(domainObject.getServiceName());
    // ServiceDescription
    valueObject.setServiceDescription(domainObject.getServiceDescription());
    // ServiceCategory
    ims.domain.lookups.LookupInstance instance3 = domainObject.getServiceCategory();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.ServiceCategory voLookup3 =
          new ims.core.vo.lookups.ServiceCategory(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.core.vo.lookups.ServiceCategory parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.core.vo.lookups.ServiceCategory(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setServiceCategory(voLookup3);
    }
    // Specialty
    ims.domain.lookups.LookupInstance instance4 = domainObject.getSpecialty();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.Specialty voLookup4 =
          new ims.core.vo.lookups.Specialty(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.core.vo.lookups.Specialty parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.core.vo.lookups.Specialty(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setSpecialty(voLookup4);
    }
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    // UpperName
    valueObject.setUpperName(domainObject.getUpperName());
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.icps.configuration.domain.objects.ICPPhase
   */
  public static ims.icp.vo.ICPPhaseListVo insert(
      DomainObjectMap map,
      ims.icp.vo.ICPPhaseListVo valueObject,
      ims.icps.configuration.domain.objects.ICPPhase domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Name
    valueObject.setName(domainObject.getName());
    // Description
    valueObject.setDescription(domainObject.getDescription());
    // Status
    ims.domain.lookups.LookupInstance instance3 = domainObject.getStatus();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.PreActiveActiveInactiveStatus voLookup3 =
          new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.core.vo.lookups.PreActiveActiveInactiveStatus parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setStatus(voLookup3);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.correspondence.domain.objects.CorrespondenceDetails
   */
  public static ims.correspondence.vo.CorrespondenceDetailsVo insert(
      DomainObjectMap map,
      ims.correspondence.vo.CorrespondenceDetailsVo valueObject,
      ims.correspondence.domain.objects.CorrespondenceDetails domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // pasEvent
    if (domainObject.getPasEvent() != null) {
      if (domainObject.getPasEvent()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPasEvent();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPasEvent(new ims.core.admin.pas.vo.PASEventRefVo(id, -1));
      } else {
        valueObject.setPasEvent(
            new ims.core.admin.pas.vo.PASEventRefVo(
                domainObject.getPasEvent().getId(), domainObject.getPasEvent().getVersion()));
      }
    }
    // currentStatus
    ims.domain.lookups.LookupInstance instance2 = domainObject.getCurrentStatus();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.DocumentStatus voLookup2 =
          new ims.core.vo.lookups.DocumentStatus(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.core.vo.lookups.DocumentStatus parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.core.vo.lookups.DocumentStatus(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setCurrentStatus(voLookup2);
    }
    // CspStatusHistory
    valueObject.setCspStatusHistory(
        ims.correspondence.vo.domain.CorrespondenceStatusHistoryVoAssembler
            .createCorrespondenceStatusHistoryVoCollectionFromCorrespondenceStatusHistory(
                map, domainObject.getCspStatusHistory()));
    // categories
    valueObject.setCategories(
        ims.correspondence.vo.domain.CategoryNotesVoAssembler
            .createCategoryNotesVoCollectionFromCategoryNotes(map, domainObject.getCategories()));
    // recipients
    valueObject.setRecipients(
        ims.correspondence.vo.domain.RecipientVoAssembler.createRecipientVoCollectionFromRecipient(
            map, domainObject.getRecipients()));
    // currentDocument
    valueObject.setCurrentDocument(
        ims.core.vo.domain.DocumentVoAssembler.create(map, domainObject.getCurrentDocument()));
    // signedBy
    valueObject.setSignedBy(
        ims.core.vo.domain.MedicLiteVoAssembler.create(map, domainObject.getSignedBy()));
    // specialInterest
    ims.domain.lookups.LookupInstance instance8 = domainObject.getSpecialInterest();
    if (null != instance8) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance8.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance8.getImage().getImageId(), instance8.getImage().getImagePath());
      }
      color = instance8.getColor();
      if (color != null) color.getValue();

      ims.correspondence.vo.lookups.SpecialInterestType voLookup8 =
          new ims.correspondence.vo.lookups.SpecialInterestType(
              instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color);
      ims.correspondence.vo.lookups.SpecialInterestType parentVoLookup8 = voLookup8;
      ims.domain.lookups.LookupInstance parent8 = instance8.getParent();
      while (parent8 != null) {
        if (parent8.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent8.getImage().getImageId(), parent8.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent8.getColor();
        if (color != null) color.getValue();
        parentVoLookup8.setParent(
            new ims.correspondence.vo.lookups.SpecialInterestType(
                parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color));
        parentVoLookup8 = parentVoLookup8.getParent();
        parent8 = parent8.getParent();
      }
      valueObject.setSpecialInterest(voLookup8);
    }
    // DateOfClinic
    java.util.Date DateOfClinic = domainObject.getDateOfClinic();
    if (null != DateOfClinic) {
      valueObject.setDateOfClinic(new ims.framework.utils.Date(DateOfClinic));
    }
    // AdmissionDate
    java.util.Date AdmissionDate = domainObject.getAdmissionDate();
    if (null != AdmissionDate) {
      valueObject.setAdmissionDate(new ims.framework.utils.Date(AdmissionDate));
    }
    // DischargeDate
    java.util.Date DischargeDate = domainObject.getDischargeDate();
    if (null != DischargeDate) {
      valueObject.setDischargeDate(new ims.framework.utils.Date(DischargeDate));
    }
    // DictatedBy
    valueObject.setDictatedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getDictatedBy()));
    // DictatedByInitials
    valueObject.setDictatedByInitials(domainObject.getDictatedByInitials());
    // TypedBy
    valueObject.setTypedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getTypedBy()));
    // TypedByInitials
    valueObject.setTypedByInitials(domainObject.getTypedByInitials());
    // EnquiriesTo
    valueObject.setEnquiriesTo(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getEnquiriesTo()));
    // WasTypedWithoutCaseNotes
    valueObject.setWasTypedWithoutCaseNotes(domainObject.isWasTypedWithoutCaseNotes());
    return valueObject;
  }
  /**
   * 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.OcsOrderSession
   */
  public static ims.ocrr.vo.OcsOrderVo insert(
      DomainObjectMap map,
      ims.ocrr.vo.OcsOrderVo valueObject,
      ims.ocrr.orderingresults.domain.objects.OcsOrderSession domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ClinicalTrial
    valueObject.setClinicalTrial(domainObject.isClinicalTrial());
    // ClinicalTrialTxt
    valueObject.setClinicalTrialTxt(domainObject.getClinicalTrialTxt());
    // PatMobility
    ims.domain.lookups.LookupInstance instance3 = domainObject.getPatMobility();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.OrderPatMobility voLookup3 =
          new ims.ocrr.vo.lookups.OrderPatMobility(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.ocrr.vo.lookups.OrderPatMobility parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.ocrr.vo.lookups.OrderPatMobility(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setPatMobility(voLookup3);
    }
    // OrderCategory
    ims.domain.lookups.LookupInstance instance4 = domainObject.getOrderCategory();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.OrderCategory voLookup4 =
          new ims.ocrr.vo.lookups.OrderCategory(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.ocrr.vo.lookups.OrderCategory parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.ocrr.vo.lookups.OrderCategory(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setOrderCategory(voLookup4);
    }
    // specimens
    valueObject.setSpecimens(
        ims.ocrr.vo.domain.OrderSpecimenVoAssembler
            .createOrderSpecimenVoCollectionFromOrderSpecimen(map, domainObject.getSpecimens()));
    // Investigations
    valueObject.setInvestigations(
        ims.ocrr.vo.domain.OrderInvestigationVoAssembler
            .createOrderInvestigationVoCollectionFromOrderInvestigation(
                map, domainObject.getInvestigations()));
    // wasProcessed
    valueObject.setWasProcessed(domainObject.isWasProcessed());
    // ClinicalInfo
    valueObject.setClinicalInfo(
        ims.ocrr.vo.domain.OcsQASessionVoAssembler.create(map, domainObject.getClinicalInfo()));
    // ReportTo
    valueObject.setReportTo(
        ims.ocrr.vo.domain.OcsReportToVoAssembler.createOcsReportToVoCollectionFromOcsReportTo(
            map, domainObject.getReportTo()));
    // SummaryClinicalInformation
    valueObject.setSummaryClinicalInformation(domainObject.getSummaryClinicalInformation());
    // BleepExtNumber
    valueObject.setBleepExtNumber(domainObject.getBleepExtNumber());
    // ClinicalContact
    if (domainObject.getClinicalContact() != null) {
      if (domainObject.getClinicalContact()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1));
      } else {
        valueObject.setClinicalContact(
            new ims.core.admin.vo.ClinicalContactRefVo(
                domainObject.getClinicalContact().getId(),
                domainObject.getClinicalContact().getVersion()));
      }
    }
    // Patient
    valueObject.setPatient(
        ims.core.vo.domain.PatientShortAssembler.create(map, domainObject.getPatient()));
    // OrderedBy
    valueObject.setOrderedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getOrderedBy()));
    // ResponsibleClinician
    valueObject.setResponsibleClinician(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getResponsibleClinician()));
    // ResponsibleGp
    valueObject.setResponsibleGp(
        ims.core.vo.domain.GpLiteVoAssembler.create(map, domainObject.getResponsibleGp()));
    // PatientLocation
    valueObject.setPatientLocation(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getPatientLocation()));
    // PatientClinic
    valueObject.setPatientClinic(
        ims.core.vo.domain.ClinicLiteVoAssembler.create(map, domainObject.getPatientClinic()));
    // AdditClinNotes
    valueObject.setAdditClinNotes(domainObject.getAdditClinNotes());
    // SysInfo
    // set system information
    valueObject.setSysInfo(
        ims.vo.domain.SystemInformationAssembler.create(domainObject.getSystemInformation()));
    // CareContext
    valueObject.setCareContext(
        ims.core.vo.domain.CareContextPasVoAssembler.create(map, domainObject.getCareContext()));
    // OrderingHospital
    if (domainObject.getOrderingHospital() != null) {
      if (domainObject.getOrderingHospital()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getOrderingHospital();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setOrderingHospital(new ims.core.resource.place.vo.LocSiteRefVo(id, -1));
      } else {
        valueObject.setOrderingHospital(
            new ims.core.resource.place.vo.LocSiteRefVo(
                domainObject.getOrderingHospital().getId(),
                domainObject.getOrderingHospital().getVersion()));
      }
    }
    // OutpatientDept
    valueObject.setOutpatientDept(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getOutpatientDept()));
    // AuthorisationOrderStatus
    ims.domain.lookups.LookupInstance instance24 = domainObject.getAuthorisationOrderStatus();
    if (null != instance24) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance24.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance24.getImage().getImageId(), instance24.getImage().getImagePath());
      }
      color = instance24.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.AuthorisationOrderStatus voLookup24 =
          new ims.ocrr.vo.lookups.AuthorisationOrderStatus(
              instance24.getId(), instance24.getText(), instance24.isActive(), null, img, color);
      ims.ocrr.vo.lookups.AuthorisationOrderStatus parentVoLookup24 = voLookup24;
      ims.domain.lookups.LookupInstance parent24 = instance24.getParent();
      while (parent24 != null) {
        if (parent24.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent24.getImage().getImageId(), parent24.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent24.getColor();
        if (color != null) color.getValue();
        parentVoLookup24.setParent(
            new ims.ocrr.vo.lookups.AuthorisationOrderStatus(
                parent24.getId(), parent24.getText(), parent24.isActive(), null, img, color));
        parentVoLookup24 = parentVoLookup24.getParent();
        parent24 = parent24.getParent();
      }
      valueObject.setAuthorisationOrderStatus(voLookup24);
    }
    return valueObject;
  }
  /**
   * 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.resource.place.domain.objects.Location
   */
  public static ims.admin.vo.LocationShortVo insert(
      DomainObjectMap map,
      ims.admin.vo.LocationShortVo valueObject,
      ims.core.resource.place.domain.objects.Location domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // UpperName
    valueObject.setUpperName(domainObject.getUpperName());
    // Name
    valueObject.setName(domainObject.getName());
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    // IsVirtual
    valueObject.setIsVirtual(domainObject.isIsVirtual());
    // Type
    ims.domain.lookups.LookupInstance instance5 = domainObject.getType();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.LocationType voLookup5 =
          new ims.core.vo.lookups.LocationType(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.core.vo.lookups.LocationType parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.core.vo.lookups.LocationType(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setType(voLookup5);
    }
    // DisplayInEDTracking
    valueObject.setDisplayInEDTracking(domainObject.isDisplayInEDTracking());
    // CaseNoteFolderLocation
    valueObject.setCaseNoteFolderLocation(domainObject.isCaseNoteFolderLocation());
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.nursing.careplans.domain.objects.CarePlanTemplate
   */
  public static ims.nursing.vo.CarePlanTemplateTitle insert(
      DomainObjectMap map,
      ims.nursing.vo.CarePlanTemplateTitle valueObject,
      ims.nursing.careplans.domain.objects.CarePlanTemplate domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // CreationDate
    java.util.Date CreationDate = domainObject.getCreationDate();
    if (null != CreationDate) {
      valueObject.setCreationDate(new ims.framework.utils.Date(CreationDate));
    }
    // AssessmentComponent
    ims.domain.lookups.LookupInstance instance2 = domainObject.getAssessmentComponent();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.AssessmentComponentType voLookup2 =
          new ims.nursing.vo.lookups.AssessmentComponentType(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.nursing.vo.lookups.AssessmentComponentType parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.nursing.vo.lookups.AssessmentComponentType(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setAssessmentComponent(voLookup2);
    }
    // Title
    valueObject.setTitle(domainObject.getTitle());
    // Active
    valueObject.setActive(domainObject.isActive());
    return valueObject;
  }
  /**
   * 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.domain.objects.EmergencyAttendance
   */
  public static ims.emergency.vo.EmergencyAttendanceForTriageLiteVo insert(
      DomainObjectMap map,
      ims.emergency.vo.EmergencyAttendanceForTriageLiteVo valueObject,
      ims.core.admin.domain.objects.EmergencyAttendance domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ArrivalDateTime
    java.util.Date ArrivalDateTime = domainObject.getArrivalDateTime();
    if (null != ArrivalDateTime) {
      valueObject.setArrivalDateTime(new ims.framework.utils.DateTime(ArrivalDateTime));
    }
    // DischargeDateTime
    java.util.Date DischargeDateTime = domainObject.getDischargeDateTime();
    if (null != DischargeDateTime) {
      valueObject.setDischargeDateTime(new ims.framework.utils.DateTime(DischargeDateTime));
    }
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    // UrgencyLevel
    ims.domain.lookups.LookupInstance instance4 = domainObject.getUrgencyLevel();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.emergency.vo.lookups.UrgencyLevel voLookup4 =
          new ims.emergency.vo.lookups.UrgencyLevel(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.emergency.vo.lookups.UrgencyLevel parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.emergency.vo.lookups.UrgencyLevel(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setUrgencyLevel(voLookup4);
    }
    // ConclusionDateTime
    java.util.Date ConclusionDateTime = domainObject.getConclusionDateTime();
    if (null != ConclusionDateTime) {
      valueObject.setConclusionDateTime(new ims.framework.utils.DateTime(ConclusionDateTime));
    }
    // BedTypeRequested
    ims.domain.lookups.LookupInstance instance6 = domainObject.getBedTypeRequested();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.BedTypeRequested voLookup6 =
          new ims.core.vo.lookups.BedTypeRequested(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.core.vo.lookups.BedTypeRequested parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.core.vo.lookups.BedTypeRequested(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setBedTypeRequested(voLookup6);
    }
    // MC
    valueObject.setMC(domainObject.getMC());
    // COTA
    valueObject.setCOTA(domainObject.getCOTA());
    // PCG1
    valueObject.setPCG1(domainObject.getPCG1());
    // PCG2
    valueObject.setPCG2(domainObject.getPCG2());
    // HAR
    valueObject.setHAR(domainObject.getHAR());
    // Purchaser
    valueObject.setPurchaser(domainObject.getPurchaser());
    // SequenceNumber
    valueObject.setSequenceNumber(domainObject.getSequenceNumber());
    // customID
    valueObject.setCustomID(domainObject.getCustomID());
    // EndOfRegistrationDateTime
    java.util.Date EndOfRegistrationDateTime = domainObject.getEndOfRegistrationDateTime();
    if (null != EndOfRegistrationDateTime) {
      valueObject.setEndOfRegistrationDateTime(
          new ims.framework.utils.DateTime(EndOfRegistrationDateTime));
    }
    // ModeOfArrival
    ims.domain.lookups.LookupInstance instance16 = domainObject.getModeOfArrival();
    if (null != instance16) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance16.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance16.getImage().getImageId(), instance16.getImage().getImagePath());
      }
      color = instance16.getColor();
      if (color != null) color.getValue();

      ims.emergency.vo.lookups.ModeOfArrival voLookup16 =
          new ims.emergency.vo.lookups.ModeOfArrival(
              instance16.getId(), instance16.getText(), instance16.isActive(), null, img, color);
      ims.emergency.vo.lookups.ModeOfArrival parentVoLookup16 = voLookup16;
      ims.domain.lookups.LookupInstance parent16 = instance16.getParent();
      while (parent16 != null) {
        if (parent16.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent16.getImage().getImageId(), parent16.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent16.getColor();
        if (color != null) color.getValue();
        parentVoLookup16.setParent(
            new ims.emergency.vo.lookups.ModeOfArrival(
                parent16.getId(), parent16.getText(), parent16.isActive(), null, img, color));
        parentVoLookup16 = parentVoLookup16.getParent();
        parent16 = parent16.getParent();
      }
      valueObject.setModeOfArrival(voLookup16);
    }
    // RegistrationDateTime
    java.util.Date RegistrationDateTime = domainObject.getRegistrationDateTime();
    if (null != RegistrationDateTime) {
      valueObject.setRegistrationDateTime(new ims.framework.utils.DateTime(RegistrationDateTime));
    }
    // AgeAtAttendance
    valueObject.setAgeAtAttendance(domainObject.getAgeAtAttendance());
    return valueObject;
  }
  /**
   * 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.OrderChangeResponseQueue
   */
  public static ims.ocs_if.vo.OrderChangeResponseVo insert(
      DomainObjectMap map,
      ims.ocs_if.vo.OrderChangeResponseVo valueObject,
      ims.ocrr.orderingresults.domain.objects.OrderChangeResponseQueue domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ProviderSystem
    valueObject.setProviderSystem(
        ims.ocrr.vo.domain.ProviderSystemVoAssembler.create(map, domainObject.getProviderSystem()));
    // wasProcessed
    valueObject.setWasProcessed(domainObject.isWasProcessed());
    // wasDiscarded
    valueObject.setWasDiscarded(domainObject.isWasDiscarded());
    // msgText
    valueObject.setMsgText(domainObject.getMsgText());
    // ackText
    valueObject.setAckText(domainObject.getAckText());
    // failureMsg
    valueObject.setFailureMsg(domainObject.getFailureMsg());
    // messageStatus
    ims.domain.lookups.LookupInstance instance7 = domainObject.getMessageStatus();
    if (null != instance7) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance7.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance7.getImage().getImageId(), instance7.getImage().getImagePath());
      }
      color = instance7.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.OrderMessageStatus voLookup7 =
          new ims.ocrr.vo.lookups.OrderMessageStatus(
              instance7.getId(), instance7.getText(), instance7.isActive(), null, img, color);
      ims.ocrr.vo.lookups.OrderMessageStatus parentVoLookup7 = voLookup7;
      ims.domain.lookups.LookupInstance parent7 = instance7.getParent();
      while (parent7 != null) {
        if (parent7.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent7.getImage().getImageId(), parent7.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent7.getColor();
        if (color != null) color.getValue();
        parentVoLookup7.setParent(
            new ims.ocrr.vo.lookups.OrderMessageStatus(
                parent7.getId(), parent7.getText(), parent7.isActive(), null, img, color));
        parentVoLookup7 = parentVoLookup7.getParent();
        parent7 = parent7.getParent();
      }
      valueObject.setMessageStatus(voLookup7);
    }
    // msgType
    ims.domain.lookups.LookupInstance instance8 = domainObject.getMsgType();
    if (null != instance8) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance8.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance8.getImage().getImageId(), instance8.getImage().getImagePath());
      }
      color = instance8.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.MsgEventType voLookup8 =
          new ims.core.vo.lookups.MsgEventType(
              instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color);
      ims.core.vo.lookups.MsgEventType parentVoLookup8 = voLookup8;
      ims.domain.lookups.LookupInstance parent8 = instance8.getParent();
      while (parent8 != null) {
        if (parent8.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent8.getImage().getImageId(), parent8.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent8.getColor();
        if (color != null) color.getValue();
        parentVoLookup8.setParent(
            new ims.core.vo.lookups.MsgEventType(
                parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color));
        parentVoLookup8 = parentVoLookup8.getParent();
        parent8 = parent8.getParent();
      }
      valueObject.setMsgType(voLookup8);
    }
    // queueType
    ims.domain.lookups.LookupInstance instance9 = domainObject.getQueueType();
    if (null != instance9) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance9.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance9.getImage().getImageId(), instance9.getImage().getImagePath());
      }
      color = instance9.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.QueueType voLookup9 =
          new ims.core.vo.lookups.QueueType(
              instance9.getId(), instance9.getText(), instance9.isActive(), null, img, color);
      ims.core.vo.lookups.QueueType parentVoLookup9 = voLookup9;
      ims.domain.lookups.LookupInstance parent9 = instance9.getParent();
      while (parent9 != null) {
        if (parent9.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent9.getImage().getImageId(), parent9.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent9.getColor();
        if (color != null) color.getValue();
        parentVoLookup9.setParent(
            new ims.core.vo.lookups.QueueType(
                parent9.getId(), parent9.getText(), parent9.isActive(), null, img, color));
        parentVoLookup9 = parentVoLookup9.getParent();
        parent9 = parent9.getParent();
      }
      valueObject.setQueueType(voLookup9);
    }
    // Investigation
    if (domainObject.getInvestigation() != null) {
      if (domainObject.getInvestigation()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getInvestigation();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setInvestigation(
            new ims.ocrr.orderingresults.vo.OrderInvestigationRefVo(id, -1));
      } else {
        valueObject.setInvestigation(
            new ims.ocrr.orderingresults.vo.OrderInvestigationRefVo(
                domainObject.getInvestigation().getId(),
                domainObject.getInvestigation().getVersion()));
      }
    }
    // StatusReason
    valueObject.setStatusReason(domainObject.getStatusReason());
    // CausingStatus
    ims.domain.lookups.LookupInstance instance12 = domainObject.getCausingStatus();
    if (null != instance12) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance12.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance12.getImage().getImageId(), instance12.getImage().getImagePath());
      }
      color = instance12.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.OrderInvStatus voLookup12 =
          new ims.ocrr.vo.lookups.OrderInvStatus(
              instance12.getId(), instance12.getText(), instance12.isActive(), null, img, color);
      ims.ocrr.vo.lookups.OrderInvStatus parentVoLookup12 = voLookup12;
      ims.domain.lookups.LookupInstance parent12 = instance12.getParent();
      while (parent12 != null) {
        if (parent12.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent12.getImage().getImageId(), parent12.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent12.getColor();
        if (color != null) color.getValue();
        parentVoLookup12.setParent(
            new ims.ocrr.vo.lookups.OrderInvStatus(
                parent12.getId(), parent12.getText(), parent12.isActive(), null, img, color));
        parentVoLookup12 = parentVoLookup12.getParent();
        parent12 = parent12.getParent();
      }
      valueObject.setCausingStatus(voLookup12);
    }
    // systemInformation
    // set system information
    valueObject.setSystemInformation(
        ims.vo.domain.SystemInformationAssembler.create(domainObject.getSystemInformation()));
    return valueObject;
  }
  /**
   * 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.clinical.domain.objects.Service
   */
  public static ims.core.vo.ServiceShortVo insert(
      DomainObjectMap map,
      ims.core.vo.ServiceShortVo valueObject,
      ims.core.clinical.domain.objects.Service domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ServiceDescription
    valueObject.setServiceDescription(domainObject.getServiceDescription());
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    // AlternateServiceCode
    valueObject.setAlternateServiceCode(domainObject.getAlternateServiceCode());
    // ServiceName
    valueObject.setServiceName(domainObject.getServiceName());
    // ServiceCategory
    ims.domain.lookups.LookupInstance instance5 = domainObject.getServiceCategory();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.ServiceCategory voLookup5 =
          new ims.core.vo.lookups.ServiceCategory(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.core.vo.lookups.ServiceCategory parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.core.vo.lookups.ServiceCategory(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setServiceCategory(voLookup5);
    }
    // CanBeScheduled
    valueObject.setCanBeScheduled(domainObject.isCanBeScheduled());
    // Specialty
    ims.domain.lookups.LookupInstance instance7 = domainObject.getSpecialty();
    if (null != instance7) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance7.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance7.getImage().getImageId(), instance7.getImage().getImagePath());
      }
      color = instance7.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.Specialty voLookup7 =
          new ims.core.vo.lookups.Specialty(
              instance7.getId(), instance7.getText(), instance7.isActive(), null, img, color);
      ims.core.vo.lookups.Specialty parentVoLookup7 = voLookup7;
      ims.domain.lookups.LookupInstance parent7 = instance7.getParent();
      while (parent7 != null) {
        if (parent7.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent7.getImage().getImageId(), parent7.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent7.getColor();
        if (color != null) color.getValue();
        parentVoLookup7.setParent(
            new ims.core.vo.lookups.Specialty(
                parent7.getId(), parent7.getText(), parent7.isActive(), null, img, color));
        parentVoLookup7 = parentVoLookup7.getParent();
        parent7 = parent7.getParent();
      }
      valueObject.setSpecialty(voLookup7);
    }
    // ExpectedTurnaround
    valueObject.setExpectedTurnaround(domainObject.getExpectedTurnaround());
    // TurnaroundMeasure
    ims.domain.lookups.LookupInstance instance9 = domainObject.getTurnaroundMeasure();
    if (null != instance9) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance9.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance9.getImage().getImageId(), instance9.getImage().getImagePath());
      }
      color = instance9.getColor();
      if (color != null) color.getValue();

      ims.ocrr.vo.lookups.MinReorderPeriod voLookup9 =
          new ims.ocrr.vo.lookups.MinReorderPeriod(
              instance9.getId(), instance9.getText(), instance9.isActive(), null, img, color);
      ims.ocrr.vo.lookups.MinReorderPeriod parentVoLookup9 = voLookup9;
      ims.domain.lookups.LookupInstance parent9 = instance9.getParent();
      while (parent9 != null) {
        if (parent9.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent9.getImage().getImageId(), parent9.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent9.getColor();
        if (color != null) color.getValue();
        parentVoLookup9.setParent(
            new ims.ocrr.vo.lookups.MinReorderPeriod(
                parent9.getId(), parent9.getText(), parent9.isActive(), null, img, color));
        parentVoLookup9 = parentVoLookup9.getParent();
        parent9 = parent9.getParent();
      }
      valueObject.setTurnaroundMeasure(voLookup9);
    }
    // MaternityIndicator
    valueObject.setMaternityIndicator(domainObject.isMaternityIndicator());
    return valueObject;
  }
  /**
   * 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.domain.objects.CareContext
   */
  public static ims.core.vo.CareContextSmallVo insert(
      DomainObjectMap map,
      ims.core.vo.CareContextSmallVo valueObject,
      ims.core.admin.domain.objects.CareContext domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Context
    ims.domain.lookups.LookupInstance instance1 = domainObject.getContext();
    if (null != instance1) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance1.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance1.getImage().getImageId(), instance1.getImage().getImagePath());
      }
      color = instance1.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.ContextType voLookup1 =
          new ims.core.vo.lookups.ContextType(
              instance1.getId(), instance1.getText(), instance1.isActive(), null, img, color);
      ims.core.vo.lookups.ContextType parentVoLookup1 = voLookup1;
      ims.domain.lookups.LookupInstance parent1 = instance1.getParent();
      while (parent1 != null) {
        if (parent1.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent1.getImage().getImageId(), parent1.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent1.getColor();
        if (color != null) color.getValue();
        parentVoLookup1.setParent(
            new ims.core.vo.lookups.ContextType(
                parent1.getId(), parent1.getText(), parent1.isActive(), null, img, color));
        parentVoLookup1 = parentVoLookup1.getParent();
        parent1 = parent1.getParent();
      }
      valueObject.setContext(voLookup1);
    }
    // StartDateTime
    java.util.Date StartDateTime = domainObject.getStartDateTime();
    if (null != StartDateTime) {
      valueObject.setStartDateTime(new ims.framework.utils.DateTime(StartDateTime));
    }
    // EndDateTime
    java.util.Date EndDateTime = domainObject.getEndDateTime();
    if (null != EndDateTime) {
      valueObject.setEndDateTime(new ims.framework.utils.DateTime(EndDateTime));
    }
    // CareContextHistory
    valueObject.setCareContextHistory(
        ims.core.vo.domain.CareContextHistVoAssembler
            .createCareContextHistVoCollectionFromCareContextHistory(
                map, domainObject.getCareContextHistory()));
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.assessment.configuration.domain.objects.UserDefinedObject
   */
  public static ims.assessment.vo.UserDefinedObjectListVo insert(
      DomainObjectMap map,
      ims.assessment.vo.UserDefinedObjectListVo valueObject,
      ims.assessment.configuration.domain.objects.UserDefinedObject domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Components
    valueObject.setComponents(
        ims.assessment.vo.domain.UserDefinedObjectComponentListVoAssembler
            .createUserDefinedObjectComponentListVoCollectionFromUserDefinedObjectComponent(
                map, domainObject.getComponents()));
    // Name
    valueObject.setName(domainObject.getName());
    // ObjectType
    ims.domain.lookups.LookupInstance instance3 = domainObject.getObjectType();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.UserDefinedObjectType voLookup3 =
          new ims.core.vo.lookups.UserDefinedObjectType(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.core.vo.lookups.UserDefinedObjectType parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.core.vo.lookups.UserDefinedObjectType(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setObjectType(voLookup3);
    }
    // ActiveStatus
    ims.domain.lookups.LookupInstance instance4 = domainObject.getActiveStatus();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.PreActiveActiveInactiveStatus voLookup4 =
          new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.core.vo.lookups.PreActiveActiveInactiveStatus parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setActiveStatus(voLookup4);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.therapies.admin.domain.objects.TreatmentEquipmentConfig
   */
  public static ims.therapies.vo.TreatmentEquipmentConfigVo insert(
      DomainObjectMap map,
      ims.therapies.vo.TreatmentEquipmentConfigVo valueObject,
      ims.therapies.admin.domain.objects.TreatmentEquipmentConfig domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Model
    valueObject.setModel(domainObject.getModel());
    // SerialNumber
    valueObject.setSerialNumber(domainObject.getSerialNumber());
    // Type
    ims.domain.lookups.LookupInstance instance3 = domainObject.getType();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.therapies.vo.lookups.TreatmentEquipmentTypeConfig voLookup3 =
          new ims.therapies.vo.lookups.TreatmentEquipmentTypeConfig(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.therapies.vo.lookups.TreatmentEquipmentTypeConfig parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.therapies.vo.lookups.TreatmentEquipmentTypeConfig(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setType(voLookup3);
    }
    // Description
    valueObject.setDescription(domainObject.getDescription());
    return valueObject;
  }
  /**
   * 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.clinical.domain.objects.EpworthSleepAssessment
   */
  public static ims.generalmedical.vo.EpworthSleepAssessmentVo insert(
      DomainObjectMap map,
      ims.generalmedical.vo.EpworthSleepAssessmentVo valueObject,
      ims.core.clinical.domain.objects.EpworthSleepAssessment domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ChanceOfSleep
    ims.domain.lookups.LookupInstance instance1 = domainObject.getChanceOfSleep();
    if (null != instance1) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance1.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance1.getImage().getImageId(), instance1.getImage().getImagePath());
      }
      color = instance1.getColor();
      if (color != null) color.getValue();

      ims.spinalinjuries.vo.lookups.SleepEpworthChanceOfSleep voLookup1 =
          new ims.spinalinjuries.vo.lookups.SleepEpworthChanceOfSleep(
              instance1.getId(), instance1.getText(), instance1.isActive(), null, img, color);
      ims.spinalinjuries.vo.lookups.SleepEpworthChanceOfSleep parentVoLookup1 = voLookup1;
      ims.domain.lookups.LookupInstance parent1 = instance1.getParent();
      while (parent1 != null) {
        if (parent1.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent1.getImage().getImageId(), parent1.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent1.getColor();
        if (color != null) color.getValue();
        parentVoLookup1.setParent(
            new ims.spinalinjuries.vo.lookups.SleepEpworthChanceOfSleep(
                parent1.getId(), parent1.getText(), parent1.isActive(), null, img, color));
        parentVoLookup1 = parentVoLookup1.getParent();
        parent1 = parent1.getParent();
      }
      valueObject.setChanceOfSleep(voLookup1);
    }
    // SleepScore
    ims.domain.lookups.LookupInstance instance2 = domainObject.getSleepScore();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.spinalinjuries.vo.lookups.SleepEpworthScore voLookup2 =
          new ims.spinalinjuries.vo.lookups.SleepEpworthScore(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.spinalinjuries.vo.lookups.SleepEpworthScore parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.spinalinjuries.vo.lookups.SleepEpworthScore(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setSleepScore(voLookup2);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.clinical.domain.objects.PatientSpecialNeed
   */
  public static ims.clinical.vo.PatientSpecialNeedVo insert(
      DomainObjectMap map,
      ims.clinical.vo.PatientSpecialNeedVo valueObject,
      ims.clinical.domain.objects.PatientSpecialNeed domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // SpecialNeed
    ims.domain.lookups.LookupInstance instance1 = domainObject.getSpecialNeed();
    if (null != instance1) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance1.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance1.getImage().getImageId(), instance1.getImage().getImagePath());
      }
      color = instance1.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.SpecialNeed voLookup1 =
          new ims.core.vo.lookups.SpecialNeed(
              instance1.getId(), instance1.getText(), instance1.isActive(), null, img, color);
      ims.core.vo.lookups.SpecialNeed parentVoLookup1 = voLookup1;
      ims.domain.lookups.LookupInstance parent1 = instance1.getParent();
      while (parent1 != null) {
        if (parent1.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent1.getImage().getImageId(), parent1.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent1.getColor();
        if (color != null) color.getValue();
        parentVoLookup1.setParent(
            new ims.core.vo.lookups.SpecialNeed(
                parent1.getId(), parent1.getText(), parent1.isActive(), null, img, color));
        parentVoLookup1 = parentVoLookup1.getParent();
        parent1 = parent1.getParent();
      }
      valueObject.setSpecialNeed(voLookup1);
    }
    // Details
    valueObject.setDetails(domainObject.getDetails());
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.RefMan.domain.objects.CatsReferral
   */
  public static ims.core.vo.CatsReferralRepatriationRequestVo insert(
      DomainObjectMap map,
      ims.core.vo.CatsReferralRepatriationRequestVo valueObject,
      ims.RefMan.domain.objects.CatsReferral domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Patient
    if (domainObject.getPatient() != null) {
      if (domainObject.getPatient()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPatient();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPatient(new ims.core.patient.vo.PatientRefVo(id, -1));
      } else {
        valueObject.setPatient(
            new ims.core.patient.vo.PatientRefVo(
                domainObject.getPatient().getId(), domainObject.getPatient().getVersion()));
      }
    }
    // ReferralDetails
    valueObject.setReferralDetails(
        ims.core.vo.domain.CatsReferralDetailsRepatriationRequestVoAssembler.create(
            map, domainObject.getReferralDetails()));
    // EpisodeOfCare
    if (domainObject.getEpisodeOfCare() != null) {
      if (domainObject.getEpisodeOfCare()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getEpisodeOfCare();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setEpisodeOfCare(new ims.core.admin.vo.EpisodeOfCareRefVo(id, -1));
      } else {
        valueObject.setEpisodeOfCare(
            new ims.core.admin.vo.EpisodeOfCareRefVo(
                domainObject.getEpisodeOfCare().getId(),
                domainObject.getEpisodeOfCare().getVersion()));
      }
    }
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    // CurrentStatus
    valueObject.setCurrentStatus(
        ims.RefMan.vo.domain.CatsReferralStatusVoAssembler.create(
            map, domainObject.getCurrentStatus()));
    // StatusHistory
    valueObject.setStatusHistory(
        ims.RefMan.vo.domain.CatsReferralStatusVoAssembler
            .createCatsReferralStatusVoCollectionFromCATSReferralStatus(
                map, domainObject.getStatusHistory()));
    // Contract
    if (domainObject.getContract() != null) {
      if (domainObject.getContract()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getContract();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setContract(new ims.core.configuration.vo.ContractConfigRefVo(id, -1));
      } else {
        valueObject.setContract(
            new ims.core.configuration.vo.ContractConfigRefVo(
                domainObject.getContract().getId(), domainObject.getContract().getVersion()));
      }
    }
    // Urgency
    ims.domain.lookups.LookupInstance instance8 = domainObject.getUrgency();
    if (null != instance8) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance8.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance8.getImage().getImageId(), instance8.getImage().getImagePath());
      }
      color = instance8.getColor();
      if (color != null) color.getValue();

      ims.RefMan.vo.lookups.ReferralUrgency voLookup8 =
          new ims.RefMan.vo.lookups.ReferralUrgency(
              instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color);
      ims.RefMan.vo.lookups.ReferralUrgency parentVoLookup8 = voLookup8;
      ims.domain.lookups.LookupInstance parent8 = instance8.getParent();
      while (parent8 != null) {
        if (parent8.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent8.getImage().getImageId(), parent8.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent8.getColor();
        if (color != null) color.getValue();
        parentVoLookup8.setParent(
            new ims.RefMan.vo.lookups.ReferralUrgency(
                parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color));
        parentVoLookup8 = parentVoLookup8.getParent();
        parent8 = parent8.getParent();
      }
      valueObject.setUrgency(voLookup8);
    }
    // Journey
    if (domainObject.getJourney() != null) {
      if (domainObject.getJourney()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getJourney();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setJourney(new ims.pathways.vo.PatientPathwayJourneyRefVo(id, -1));
      } else {
        valueObject.setJourney(
            new ims.pathways.vo.PatientPathwayJourneyRefVo(
                domainObject.getJourney().getId(), domainObject.getJourney().getVersion()));
      }
    }
    // PathwayID
    valueObject.setPathwayID(domainObject.getPathwayID());
    // RTTClockImpact
    valueObject.setRTTClockImpact(domainObject.isRTTClockImpact());
    // CurrentRTTStatus
    valueObject.setCurrentRTTStatus(
        ims.pathways.vo.domain.PathwayRTTStatusVoAssembler.create(
            map, domainObject.getCurrentRTTStatus()));
    // RepatriationRequest
    valueObject.setRepatriationRequest(
        ims.core.vo.domain.PendingEmergencyAdmissionRepatriationVoAssembler.create(
            map, domainObject.getRepatriationRequest()));
    // PatientCategory
    ims.domain.lookups.LookupInstance instance14 = domainObject.getPatientCategory();
    if (null != instance14) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance14.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance14.getImage().getImageId(), instance14.getImage().getImagePath());
      }
      color = instance14.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.PatientStatus voLookup14 =
          new ims.core.vo.lookups.PatientStatus(
              instance14.getId(), instance14.getText(), instance14.isActive(), null, img, color);
      ims.core.vo.lookups.PatientStatus parentVoLookup14 = voLookup14;
      ims.domain.lookups.LookupInstance parent14 = instance14.getParent();
      while (parent14 != null) {
        if (parent14.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent14.getImage().getImageId(), parent14.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent14.getColor();
        if (color != null) color.getValue();
        parentVoLookup14.setParent(
            new ims.core.vo.lookups.PatientStatus(
                parent14.getId(), parent14.getText(), parent14.isActive(), null, img, color));
        parentVoLookup14 = parentVoLookup14.getParent();
        parent14 = parent14.getParent();
      }
      valueObject.setPatientCategory(voLookup14);
    }
    // IsEmergencyReferral
    valueObject.setIsEmergencyReferral(domainObject.isIsEmergencyReferral());
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.nursing.assessmenttools.domain.objects.SkinAssessmentFindings
   */
  public static ims.nursing.vo.SkinAssessmentFindings insert(
      DomainObjectMap map,
      ims.nursing.vo.SkinAssessmentFindings valueObject,
      ims.nursing.assessmenttools.domain.objects.SkinAssessmentFindings domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // WoundType
    ims.domain.lookups.LookupInstance instance1 = domainObject.getWoundType();
    if (null != instance1) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance1.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance1.getImage().getImageId(), instance1.getImage().getImagePath());
      }
      color = instance1.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinWoundType voLookup1 =
          new ims.nursing.vo.lookups.SkinWoundType(
              instance1.getId(), instance1.getText(), instance1.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinWoundType parentVoLookup1 = voLookup1;
      ims.domain.lookups.LookupInstance parent1 = instance1.getParent();
      while (parent1 != null) {
        if (parent1.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent1.getImage().getImageId(), parent1.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent1.getColor();
        if (color != null) color.getValue();
        parentVoLookup1.setParent(
            new ims.nursing.vo.lookups.SkinWoundType(
                parent1.getId(), parent1.getText(), parent1.isActive(), null, img, color));
        parentVoLookup1 = parentVoLookup1.getParent();
        parent1 = parent1.getParent();
      }
      valueObject.setWoundType(voLookup1);
    }
    // SiteImage
    valueObject.setSiteImage(domainObject.getSiteImage());
    // SiteName
    valueObject.setSiteName(domainObject.getSiteName());
    // SiteDetails
    valueObject.setSiteDetails(domainObject.getSiteDetails());
    // HowLongIsItPresent
    valueObject.setHowLongIsItPresent(domainObject.getHowLongIsItPresent());
    // PressureSoreGrade
    ims.domain.lookups.LookupInstance instance6 = domainObject.getPressureSoreGrade();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinPressureSoreGrade voLookup6 =
          new ims.nursing.vo.lookups.SkinPressureSoreGrade(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinPressureSoreGrade parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.nursing.vo.lookups.SkinPressureSoreGrade(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setPressureSoreGrade(voLookup6);
    }
    // Length
    valueObject.setLength(domainObject.getLength());
    // Width
    valueObject.setWidth(domainObject.getWidth());
    // Depth
    valueObject.setDepth(domainObject.getDepth());
    // WoundBed
    ims.domain.lookups.LookupInstance instance10 = domainObject.getWoundBed();
    if (null != instance10) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance10.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance10.getImage().getImageId(), instance10.getImage().getImagePath());
      }
      color = instance10.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinWoundBed voLookup10 =
          new ims.nursing.vo.lookups.SkinWoundBed(
              instance10.getId(), instance10.getText(), instance10.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinWoundBed parentVoLookup10 = voLookup10;
      ims.domain.lookups.LookupInstance parent10 = instance10.getParent();
      while (parent10 != null) {
        if (parent10.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent10.getImage().getImageId(), parent10.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent10.getColor();
        if (color != null) color.getValue();
        parentVoLookup10.setParent(
            new ims.nursing.vo.lookups.SkinWoundBed(
                parent10.getId(), parent10.getText(), parent10.isActive(), null, img, color));
        parentVoLookup10 = parentVoLookup10.getParent();
        parent10 = parent10.getParent();
      }
      valueObject.setWoundBed(voLookup10);
    }
    // SurroundingSkin
    ims.domain.lookups.LookupInstance instance11 = domainObject.getSurroundingSkin();
    if (null != instance11) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance11.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance11.getImage().getImageId(), instance11.getImage().getImagePath());
      }
      color = instance11.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinSurroundingSkin voLookup11 =
          new ims.nursing.vo.lookups.SkinSurroundingSkin(
              instance11.getId(), instance11.getText(), instance11.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinSurroundingSkin parentVoLookup11 = voLookup11;
      ims.domain.lookups.LookupInstance parent11 = instance11.getParent();
      while (parent11 != null) {
        if (parent11.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent11.getImage().getImageId(), parent11.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent11.getColor();
        if (color != null) color.getValue();
        parentVoLookup11.setParent(
            new ims.nursing.vo.lookups.SkinSurroundingSkin(
                parent11.getId(), parent11.getText(), parent11.isActive(), null, img, color));
        parentVoLookup11 = parentVoLookup11.getParent();
        parent11 = parent11.getParent();
      }
      valueObject.setSurroundingSkin(voLookup11);
    }
    // ExudateAmount
    ims.domain.lookups.LookupInstance instance12 = domainObject.getExudateAmount();
    if (null != instance12) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance12.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance12.getImage().getImageId(), instance12.getImage().getImagePath());
      }
      color = instance12.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinExudateAmount voLookup12 =
          new ims.nursing.vo.lookups.SkinExudateAmount(
              instance12.getId(), instance12.getText(), instance12.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinExudateAmount parentVoLookup12 = voLookup12;
      ims.domain.lookups.LookupInstance parent12 = instance12.getParent();
      while (parent12 != null) {
        if (parent12.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent12.getImage().getImageId(), parent12.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent12.getColor();
        if (color != null) color.getValue();
        parentVoLookup12.setParent(
            new ims.nursing.vo.lookups.SkinExudateAmount(
                parent12.getId(), parent12.getText(), parent12.isActive(), null, img, color));
        parentVoLookup12 = parentVoLookup12.getParent();
        parent12 = parent12.getParent();
      }
      valueObject.setExudateAmount(voLookup12);
    }
    // ExudateType
    ims.domain.lookups.LookupInstance instance13 = domainObject.getExudateType();
    if (null != instance13) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance13.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance13.getImage().getImageId(), instance13.getImage().getImagePath());
      }
      color = instance13.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinExudateType voLookup13 =
          new ims.nursing.vo.lookups.SkinExudateType(
              instance13.getId(), instance13.getText(), instance13.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinExudateType parentVoLookup13 = voLookup13;
      ims.domain.lookups.LookupInstance parent13 = instance13.getParent();
      while (parent13 != null) {
        if (parent13.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent13.getImage().getImageId(), parent13.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent13.getColor();
        if (color != null) color.getValue();
        parentVoLookup13.setParent(
            new ims.nursing.vo.lookups.SkinExudateType(
                parent13.getId(), parent13.getText(), parent13.isActive(), null, img, color));
        parentVoLookup13 = parentVoLookup13.getParent();
        parent13 = parent13.getParent();
      }
      valueObject.setExudateType(voLookup13);
    }
    // Odour
    ims.domain.lookups.LookupInstance instance14 = domainObject.getOdour();
    if (null != instance14) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance14.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance14.getImage().getImageId(), instance14.getImage().getImagePath());
      }
      color = instance14.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinOdour voLookup14 =
          new ims.nursing.vo.lookups.SkinOdour(
              instance14.getId(), instance14.getText(), instance14.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinOdour parentVoLookup14 = voLookup14;
      ims.domain.lookups.LookupInstance parent14 = instance14.getParent();
      while (parent14 != null) {
        if (parent14.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent14.getImage().getImageId(), parent14.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent14.getColor();
        if (color != null) color.getValue();
        parentVoLookup14.setParent(
            new ims.nursing.vo.lookups.SkinOdour(
                parent14.getId(), parent14.getText(), parent14.isActive(), null, img, color));
        parentVoLookup14 = parentVoLookup14.getParent();
        parent14 = parent14.getParent();
      }
      valueObject.setOdour(voLookup14);
    }
    // Pain
    ims.domain.lookups.LookupInstance instance15 = domainObject.getPain();
    if (null != instance15) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance15.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance15.getImage().getImageId(), instance15.getImage().getImagePath());
      }
      color = instance15.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinPain voLookup15 =
          new ims.nursing.vo.lookups.SkinPain(
              instance15.getId(), instance15.getText(), instance15.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinPain parentVoLookup15 = voLookup15;
      ims.domain.lookups.LookupInstance parent15 = instance15.getParent();
      while (parent15 != null) {
        if (parent15.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent15.getImage().getImageId(), parent15.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent15.getColor();
        if (color != null) color.getValue();
        parentVoLookup15.setParent(
            new ims.nursing.vo.lookups.SkinPain(
                parent15.getId(), parent15.getText(), parent15.isActive(), null, img, color));
        parentVoLookup15 = parentVoLookup15.getParent();
        parent15 = parent15.getParent();
      }
      valueObject.setPain(voLookup15);
    }
    // InfectionSuspected
    valueObject.setInfectionSuspected(domainObject.isInfectionSuspected());
    // SwabTaken
    valueObject.setSwabTaken(domainObject.isSwabTaken());
    // WoundTraced
    valueObject.setWoundTraced(domainObject.isWoundTraced());
    // CleansedWith
    ims.domain.lookups.LookupInstance instance19 = domainObject.getCleansedWith();
    if (null != instance19) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance19.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance19.getImage().getImageId(), instance19.getImage().getImagePath());
      }
      color = instance19.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinCleansedWith voLookup19 =
          new ims.nursing.vo.lookups.SkinCleansedWith(
              instance19.getId(), instance19.getText(), instance19.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinCleansedWith parentVoLookup19 = voLookup19;
      ims.domain.lookups.LookupInstance parent19 = instance19.getParent();
      while (parent19 != null) {
        if (parent19.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent19.getImage().getImageId(), parent19.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent19.getColor();
        if (color != null) color.getValue();
        parentVoLookup19.setParent(
            new ims.nursing.vo.lookups.SkinCleansedWith(
                parent19.getId(), parent19.getText(), parent19.isActive(), null, img, color));
        parentVoLookup19 = parentVoLookup19.getParent();
        parent19 = parent19.getParent();
      }
      valueObject.setCleansedWith(voLookup19);
    }
    // PrimaryDressing
    ims.domain.lookups.LookupInstance instance20 = domainObject.getPrimaryDressing();
    if (null != instance20) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance20.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance20.getImage().getImageId(), instance20.getImage().getImagePath());
      }
      color = instance20.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinPrimaryDressing voLookup20 =
          new ims.nursing.vo.lookups.SkinPrimaryDressing(
              instance20.getId(), instance20.getText(), instance20.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinPrimaryDressing parentVoLookup20 = voLookup20;
      ims.domain.lookups.LookupInstance parent20 = instance20.getParent();
      while (parent20 != null) {
        if (parent20.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent20.getImage().getImageId(), parent20.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent20.getColor();
        if (color != null) color.getValue();
        parentVoLookup20.setParent(
            new ims.nursing.vo.lookups.SkinPrimaryDressing(
                parent20.getId(), parent20.getText(), parent20.isActive(), null, img, color));
        parentVoLookup20 = parentVoLookup20.getParent();
        parent20 = parent20.getParent();
      }
      valueObject.setPrimaryDressing(voLookup20);
    }
    // SecondaryDressing
    ims.domain.lookups.LookupInstance instance21 = domainObject.getSecondaryDressing();
    if (null != instance21) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance21.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance21.getImage().getImageId(), instance21.getImage().getImagePath());
      }
      color = instance21.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinSecondaryDressing voLookup21 =
          new ims.nursing.vo.lookups.SkinSecondaryDressing(
              instance21.getId(), instance21.getText(), instance21.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinSecondaryDressing parentVoLookup21 = voLookup21;
      ims.domain.lookups.LookupInstance parent21 = instance21.getParent();
      while (parent21 != null) {
        if (parent21.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent21.getImage().getImageId(), parent21.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent21.getColor();
        if (color != null) color.getValue();
        parentVoLookup21.setParent(
            new ims.nursing.vo.lookups.SkinSecondaryDressing(
                parent21.getId(), parent21.getText(), parent21.isActive(), null, img, color));
        parentVoLookup21 = parentVoLookup21.getParent();
        parent21 = parent21.getParent();
      }
      valueObject.setSecondaryDressing(voLookup21);
    }
    // FrequencyOfChange
    ims.domain.lookups.LookupInstance instance22 = domainObject.getFrequencyOfChange();
    if (null != instance22) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance22.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance22.getImage().getImageId(), instance22.getImage().getImagePath());
      }
      color = instance22.getColor();
      if (color != null) color.getValue();

      ims.nursing.vo.lookups.SkinFrequencyOfChange voLookup22 =
          new ims.nursing.vo.lookups.SkinFrequencyOfChange(
              instance22.getId(), instance22.getText(), instance22.isActive(), null, img, color);
      ims.nursing.vo.lookups.SkinFrequencyOfChange parentVoLookup22 = voLookup22;
      ims.domain.lookups.LookupInstance parent22 = instance22.getParent();
      while (parent22 != null) {
        if (parent22.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent22.getImage().getImageId(), parent22.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent22.getColor();
        if (color != null) color.getValue();
        parentVoLookup22.setParent(
            new ims.nursing.vo.lookups.SkinFrequencyOfChange(
                parent22.getId(), parent22.getText(), parent22.isActive(), null, img, color));
        parentVoLookup22 = parentVoLookup22.getParent();
        parent22 = parent22.getParent();
      }
      valueObject.setFrequencyOfChange(voLookup22);
    }
    // Comment
    valueObject.setComment(domainObject.getComment());
    // isDiscontinuedAssess
    valueObject.setIsDiscontinuedAssess(domainObject.isIsDiscontinuedAssess());
    // isContinuedAssessment
    valueObject.setIsContinuedAssessment(domainObject.isIsContinuedAssessment());
    // SkinAssessmentReview
    valueObject.setSkinAssessmentReview(
        ims.nursing.vo.domain.SkinAssessmentReviewAssembler
            .createSkinAssessmentReviewCollectionFromSkinAssessmentReview(
                map, domainObject.getSkinAssessmentReview()));
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.clinical.domain.objects.PatientAbsentProcedure
   */
  public static ims.clinical.vo.PatientAbsentProcedureVo insert(
      DomainObjectMap map,
      ims.clinical.vo.PatientAbsentProcedureVo valueObject,
      ims.clinical.domain.objects.PatientAbsentProcedure domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Procedure
    valueObject.setProcedure(
        ims.core.vo.domain.ProcedureLiteVoAssembler.create(map, domainObject.getProcedure()));
    // Selected
    ims.domain.lookups.LookupInstance instance2 = domainObject.getSelected();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.clinical.vo.lookups.PresentAbsentUnknown voLookup2 =
          new ims.clinical.vo.lookups.PresentAbsentUnknown(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.clinical.vo.lookups.PresentAbsentUnknown parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.clinical.vo.lookups.PresentAbsentUnknown(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setSelected(voLookup2);
    }
    // SourceofInformation
    ims.domain.lookups.LookupInstance instance3 = domainObject.getSourceofInformation();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.SourceofInformation voLookup3 =
          new ims.core.vo.lookups.SourceofInformation(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.core.vo.lookups.SourceofInformation parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.core.vo.lookups.SourceofInformation(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setSourceofInformation(voLookup3);
    }
    return valueObject;
  }
  /**
   * 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.clinical.domain.objects.Medication
   */
  public static ims.core.vo.MedicationVo insert(
      DomainObjectMap map,
      ims.core.vo.MedicationVo valueObject,
      ims.core.clinical.domain.objects.Medication domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // TaxonomyMap
    valueObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            map, domainObject.getTaxonomyMap()));
    // Keywords
    valueObject.setKeywords(
        ims.core.vo.domain.KeywordVoAssembler.createKeywordVoCollectionFromKeyword(
            map, domainObject.getKeywords()));
    // MedicationName
    valueObject.setMedicationName(domainObject.getMedicationName());
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    // isControlledDrug
    valueObject.setIsControlledDrug(domainObject.isIsControlledDrug());
    // FrequencyDefault
    ims.domain.lookups.LookupInstance instance6 = domainObject.getFrequencyDefault();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.MedicationFrequency voLookup6 =
          new ims.core.vo.lookups.MedicationFrequency(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.core.vo.lookups.MedicationFrequency parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.core.vo.lookups.MedicationFrequency(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setFrequencyDefault(voLookup6);
    }
    // NoOfDaysSupplyDefault
    valueObject.setNoOfDaysSupplyDefault(domainObject.getNoOfDaysSupplyDefault());
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.oncology.domain.objects.ChemotherapyDetails
   */
  public static ims.ocrr.vo.ChemotherapyDetailsLiteVo insert(
      DomainObjectMap map,
      ims.ocrr.vo.ChemotherapyDetailsLiteVo valueObject,
      ims.oncology.domain.objects.ChemotherapyDetails domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // EpisodeOfCare
    if (domainObject.getEpisodeOfCare() != null) {
      if (domainObject.getEpisodeOfCare()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getEpisodeOfCare();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setEpisodeOfCare(new ims.core.admin.vo.EpisodeOfCareRefVo(id, -1));
      } else {
        valueObject.setEpisodeOfCare(
            new ims.core.admin.vo.EpisodeOfCareRefVo(
                domainObject.getEpisodeOfCare().getId(),
                domainObject.getEpisodeOfCare().getVersion()));
      }
    }
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    // StartDate
    java.util.Date StartDate = domainObject.getStartDate();
    if (null != StartDate) {
      valueObject.setStartDate(new ims.framework.utils.Date(StartDate));
    }
    // DateDecisionToTreat
    java.util.Date DateDecisionToTreat = domainObject.getDateDecisionToTreat();
    if (null != DateDecisionToTreat) {
      valueObject.setDateDecisionToTreat(new ims.framework.utils.Date(DateDecisionToTreat));
    }
    // DrugTherapyType
    ims.domain.lookups.LookupInstance instance5 = domainObject.getDrugTherapyType();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.DrugTherapyType voLookup5 =
          new ims.oncology.vo.lookups.DrugTherapyType(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.oncology.vo.lookups.DrugTherapyType parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.oncology.vo.lookups.DrugTherapyType(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setDrugTherapyType(voLookup5);
    }
    // RegimenAcronym
    ims.domain.lookups.LookupInstance instance6 = domainObject.getRegimenAcronym();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.RegimenAcronym voLookup6 =
          new ims.oncology.vo.lookups.RegimenAcronym(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.oncology.vo.lookups.RegimenAcronym parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.oncology.vo.lookups.RegimenAcronym(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setRegimenAcronym(voLookup6);
    }
    // CancerTreatementIntent
    ims.domain.lookups.LookupInstance instance7 = domainObject.getCancerTreatementIntent();
    if (null != instance7) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance7.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance7.getImage().getImageId(), instance7.getImage().getImagePath());
      }
      color = instance7.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.CancerTreatmentIntent voLookup7 =
          new ims.oncology.vo.lookups.CancerTreatmentIntent(
              instance7.getId(), instance7.getText(), instance7.isActive(), null, img, color);
      ims.oncology.vo.lookups.CancerTreatmentIntent parentVoLookup7 = voLookup7;
      ims.domain.lookups.LookupInstance parent7 = instance7.getParent();
      while (parent7 != null) {
        if (parent7.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent7.getImage().getImageId(), parent7.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent7.getColor();
        if (color != null) color.getValue();
        parentVoLookup7.setParent(
            new ims.oncology.vo.lookups.CancerTreatmentIntent(
                parent7.getId(), parent7.getText(), parent7.isActive(), null, img, color));
        parentVoLookup7 = parentVoLookup7.getParent();
        parent7 = parent7.getParent();
      }
      valueObject.setCancerTreatementIntent(voLookup7);
    }
    // TreatmentResponse
    ims.domain.lookups.LookupInstance instance8 = domainObject.getTreatmentResponse();
    if (null != instance8) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance8.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance8.getImage().getImageId(), instance8.getImage().getImagePath());
      }
      color = instance8.getColor();
      if (color != null) color.getValue();

      ims.oncology.vo.lookups.DrugProgramResponse voLookup8 =
          new ims.oncology.vo.lookups.DrugProgramResponse(
              instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color);
      ims.oncology.vo.lookups.DrugProgramResponse parentVoLookup8 = voLookup8;
      ims.domain.lookups.LookupInstance parent8 = instance8.getParent();
      while (parent8 != null) {
        if (parent8.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent8.getImage().getImageId(), parent8.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent8.getColor();
        if (color != null) color.getValue();
        parentVoLookup8.setParent(
            new ims.oncology.vo.lookups.DrugProgramResponse(
                parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color));
        parentVoLookup8 = parentVoLookup8.getParent();
        parent8 = parent8.getParent();
      }
      valueObject.setTreatmentResponse(voLookup8);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.clinical.domain.objects.PerfProcAndSignOutIntraOp
   */
  public static ims.clinical.vo.PerformedProcAndSignOutIntraOpVo insert(
      DomainObjectMap map,
      ims.clinical.vo.PerformedProcAndSignOutIntraOpVo valueObject,
      ims.clinical.domain.objects.PerfProcAndSignOutIntraOp domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // TheatreAppointment
    if (domainObject.getTheatreAppointment() != null) {
      if (domainObject.getTheatreAppointment()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getTheatreAppointment();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setTheatreAppointment(new ims.scheduling.vo.Booking_AppointmentRefVo(id, -1));
      } else {
        valueObject.setTheatreAppointment(
            new ims.scheduling.vo.Booking_AppointmentRefVo(
                domainObject.getTheatreAppointment().getId(),
                domainObject.getTheatreAppointment().getVersion()));
      }
    }
    // Unplannedreturntotheatre
    valueObject.setUnplannedreturntotheatre(domainObject.isUnplannedreturntotheatre());
    // ConfirmedCountsComplete
    valueObject.setConfirmedCountsComplete(domainObject.isConfirmedCountsComplete());
    // AntibioticsAfterKnifeToSkin
    ims.domain.lookups.LookupInstance instance4 = domainObject.getAntibioticsAfterKnifeToSkin();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.YesNoNotApplicable voLookup4 =
          new ims.core.vo.lookups.YesNoNotApplicable(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.core.vo.lookups.YesNoNotApplicable parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.core.vo.lookups.YesNoNotApplicable(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setAntibioticsAfterKnifeToSkin(voLookup4);
    }
    // TimeIntraOpAntibioticsGiven
    java.util.Date TimeIntraOpAntibioticsGiven = domainObject.getTimeIntraOpAntibioticsGiven();
    if (null != TimeIntraOpAntibioticsGiven) {
      valueObject.setTimeIntraOpAntibioticsGiven(
          new ims.framework.utils.DateTime(TimeIntraOpAntibioticsGiven));
    }
    // AdministrationRecordCompleted
    valueObject.setAdministrationRecordCompleted(domainObject.isAdministrationRecordCompleted());
    // AnySpecimensHaveBeenLabelled
    valueObject.setAnySpecimensHaveBeenLabelled(domainObject.isAnySpecimensHaveBeenLabelled());
    // AnyEquipmentProblemsAddressed
    ims.domain.lookups.LookupInstance instance8 = domainObject.getAnyEquipmentProblemsAddressed();
    if (null != instance8) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance8.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance8.getImage().getImageId(), instance8.getImage().getImagePath());
      }
      color = instance8.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.YesNoNotApplicable voLookup8 =
          new ims.core.vo.lookups.YesNoNotApplicable(
              instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color);
      ims.core.vo.lookups.YesNoNotApplicable parentVoLookup8 = voLookup8;
      ims.domain.lookups.LookupInstance parent8 = instance8.getParent();
      while (parent8 != null) {
        if (parent8.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent8.getImage().getImageId(), parent8.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent8.getColor();
        if (color != null) color.getValue();
        parentVoLookup8.setParent(
            new ims.core.vo.lookups.YesNoNotApplicable(
                parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color));
        parentVoLookup8 = parentVoLookup8.getParent();
        parent8 = parent8.getParent();
      }
      valueObject.setAnyEquipmentProblemsAddressed(voLookup8);
    }
    // KeyConcernsDocumented
    valueObject.setKeyConcernsDocumented(domainObject.isKeyConcernsDocumented());
    // SignatureByRegisteredPractitioner
    valueObject.setSignatureByRegisteredPractitioner(
        ims.core.vo.domain.HcpLiteVoAssembler.create(
            map, domainObject.getSignatureByRegisteredPractitioner()));
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject
   *     ims.coe.assessment.domain.objects.CommunicationSpeechAndLanguageUnderstanding
   */
  public static ims.coe.vo.CommunicationUnderstanding insert(
      DomainObjectMap map,
      ims.coe.vo.CommunicationUnderstanding valueObject,
      ims.coe.assessment.domain.objects.CommunicationSpeechAndLanguageUnderstanding domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // SpeechAndLanguageUnderstanding
    ims.domain.lookups.LookupInstance instance1 = domainObject.getSpeechAndLanguageUnderstanding();
    if (null != instance1) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance1.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance1.getImage().getImageId(), instance1.getImage().getImagePath());
      }
      color = instance1.getColor();
      if (color != null) color.getValue();

      ims.coe.vo.lookups.SpeechAndLanguageUnderstanding voLookup1 =
          new ims.coe.vo.lookups.SpeechAndLanguageUnderstanding(
              instance1.getId(), instance1.getText(), instance1.isActive(), null, img, color);
      ims.coe.vo.lookups.SpeechAndLanguageUnderstanding parentVoLookup1 = voLookup1;
      ims.domain.lookups.LookupInstance parent1 = instance1.getParent();
      while (parent1 != null) {
        if (parent1.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent1.getImage().getImageId(), parent1.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent1.getColor();
        if (color != null) color.getValue();
        parentVoLookup1.setParent(
            new ims.coe.vo.lookups.SpeechAndLanguageUnderstanding(
                parent1.getId(), parent1.getText(), parent1.isActive(), null, img, color));
        parentVoLookup1 = parentVoLookup1.getParent();
        parent1 = parent1.getParent();
      }
      valueObject.setSpeechAndLanguageUnderstanding(voLookup1);
    }
    // Status
    ims.domain.lookups.LookupInstance instance2 = domainObject.getStatus();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.YesNoUnknown voLookup2 =
          new ims.core.vo.lookups.YesNoUnknown(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.core.vo.lookups.YesNoUnknown parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.core.vo.lookups.YesNoUnknown(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setStatus(voLookup2);
    }
    return valueObject;
  }
  /**
   * 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.clinical.domain.objects.PatientDiagnosis
   */
  public static ims.core.vo.PatientDiagnosisEDischargeVo insert(
      DomainObjectMap map,
      ims.core.vo.PatientDiagnosisEDischargeVo valueObject,
      ims.core.clinical.domain.objects.PatientDiagnosis domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // StatusHistory
    valueObject.setStatusHistory(
        ims.clinical.vo.domain.PatientDiagnosisStatusVoAssembler
            .createPatientDiagnosisStatusVoCollectionFromPatientDiagnosisStatus(
                map, domainObject.getStatusHistory()));
    // DiagnosisDescription
    valueObject.setDiagnosisDescription(domainObject.getDiagnosisDescription());
    // DiagnosedDate
    Integer DiagnosedDate = domainObject.getDiagnosedDate();
    if (null != DiagnosedDate) {
      valueObject.setDiagnosedDate(new ims.framework.utils.PartialDate(DiagnosedDate));
    }
    // Diagnosis
    valueObject.setDiagnosis(
        ims.core.vo.domain.DiagLiteVoAssembler.create(map, domainObject.getDiagnosis()));
    // SourceofInformation
    ims.domain.lookups.LookupInstance instance5 = domainObject.getSourceofInformation();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.SourceofInformation voLookup5 =
          new ims.core.vo.lookups.SourceofInformation(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.core.vo.lookups.SourceofInformation parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.core.vo.lookups.SourceofInformation(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setSourceofInformation(voLookup5);
    }
    // isComplication
    valueObject.setIsComplication(domainObject.isIsComplication());
    // isComorbidity
    valueObject.setIsComorbidity(domainObject.isIsComorbidity());
    // DateResolved
    java.util.Date DateResolved = domainObject.getDateResolved();
    if (null != DateResolved) {
      valueObject.setDateResolved(new ims.framework.utils.Date(DateResolved));
    }
    // CareContext
    valueObject.setCareContext(
        ims.core.vo.domain.CareContextForEdischargeDiagnosisVoAssembler.create(
            map, domainObject.getCareContext()));
    // DiagLaterality
    ims.domain.lookups.LookupInstance instance10 = domainObject.getDiagLaterality();
    if (null != instance10) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance10.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance10.getImage().getImageId(), instance10.getImage().getImagePath());
      }
      color = instance10.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.LateralityLRB voLookup10 =
          new ims.core.vo.lookups.LateralityLRB(
              instance10.getId(), instance10.getText(), instance10.isActive(), null, img, color);
      ims.core.vo.lookups.LateralityLRB parentVoLookup10 = voLookup10;
      ims.domain.lookups.LookupInstance parent10 = instance10.getParent();
      while (parent10 != null) {
        if (parent10.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent10.getImage().getImageId(), parent10.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent10.getColor();
        if (color != null) color.getValue();
        parentVoLookup10.setParent(
            new ims.core.vo.lookups.LateralityLRB(
                parent10.getId(), parent10.getText(), parent10.isActive(), null, img, color));
        parentVoLookup10 = parentVoLookup10.getParent();
        parent10 = parent10.getParent();
      }
      valueObject.setDiagLaterality(voLookup10);
    }
    // SiteText
    valueObject.setSiteText(domainObject.getSiteText());
    // AuthoringInfo
    valueObject.setAuthoringInfo(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getAuthoringInfo()));
    // IncludeDiagnosisInDiscReports
    valueObject.setIncludeDiagnosisInDiscReports(
        ims.core.vo.domain.IncludeDiagnosisInDischargeReportVoAssembler
            .createIncludeDiagnosisInDischargeReportVoCollectionFromIncludeDiagnosisInDischargeReport(
                map, domainObject.getIncludeDiagnosisInDiscReports()));
    // isPrevRelevantDiagnosis
    valueObject.setIsPrevRelevantDiagnosis(domainObject.isIsPrevRelevantDiagnosis());
    // SysInfo
    // set system information
    valueObject.setSysInfo(
        ims.vo.domain.SystemInformationAssembler.create(domainObject.getSystemInformation()));
    // DateOnset
    java.util.Date DateOnset = domainObject.getDateOnset();
    if (null != DateOnset) {
      valueObject.setDateOnset(new ims.framework.utils.Date(DateOnset));
    }
    // ClinicalContact
    if (domainObject.getClinicalContact() != null) {
      if (domainObject.getClinicalContact()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1));
      } else {
        valueObject.setClinicalContact(
            new ims.core.admin.vo.ClinicalContactRefVo(
                domainObject.getClinicalContact().getId(),
                domainObject.getClinicalContact().getVersion()));
      }
    }
    // PrimaryForCareSpells
    valueObject.setPrimaryForCareSpells(
        ims.core.vo.domain.CSPrimaryDiagnosisVoAssembler
            .createCSPrimaryDiagnosisVoCollectionFromCsPrimaryDiagnosis(
                map, domainObject.getPrimaryForCareSpells()));
    // CoMorbidityForEpisodeOfCares
    valueObject.setCoMorbidityForEpisodeOfCares(
        ims.core.vo.domain.EpisodeOfCareCoMorbidityVoAssembler
            .createEpisodeOfCareCoMorbidityVoCollectionFromEpisodeOfCareCoMorbidity(
                map, domainObject.getCoMorbidityForEpisodeOfCares()));
    // EpisodeOfCare
    if (domainObject.getEpisodeOfCare() != null) {
      if (domainObject.getEpisodeOfCare()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getEpisodeOfCare();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setEpisodeOfCare(new ims.core.admin.vo.EpisodeOfCareRefVo(id, -1));
      } else {
        valueObject.setEpisodeOfCare(
            new ims.core.admin.vo.EpisodeOfCareRefVo(
                domainObject.getEpisodeOfCare().getId(),
                domainObject.getEpisodeOfCare().getVersion()));
      }
    }
    // diagnosedOnAdmission
    valueObject.setDiagnosedOnAdmission(domainObject.isDiagnosedOnAdmission());
    return valueObject;
  }
  /**
   * 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.patient.domain.objects.PDSBatchTraceParams
   */
  public static ims.core.vo.PDSBatchTraceItemsVo insert(
      DomainObjectMap map,
      ims.core.vo.PDSBatchTraceItemsVo valueObject,
      ims.core.patient.domain.objects.PDSBatchTraceParams domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // NHSNumber
    valueObject.setNHSNumber(domainObject.getNHSNumber());
    // surname
    valueObject.setSurname(domainObject.getSurname());
    // forename
    valueObject.setForename(domainObject.getForename());
    // dateOfBirth
    java.util.Date dateOfBirth = domainObject.getDateOfBirth();
    if (null != dateOfBirth) {
      valueObject.setDateOfBirth(new ims.framework.utils.Date(dateOfBirth));
    }
    // gender
    ims.domain.lookups.LookupInstance instance5 = domainObject.getGender();
    if (null != instance5) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance5.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance5.getImage().getImageId(), instance5.getImage().getImagePath());
      }
      color = instance5.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.Sex voLookup5 =
          new ims.core.vo.lookups.Sex(
              instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color);
      ims.core.vo.lookups.Sex parentVoLookup5 = voLookup5;
      ims.domain.lookups.LookupInstance parent5 = instance5.getParent();
      while (parent5 != null) {
        if (parent5.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent5.getImage().getImageId(), parent5.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent5.getColor();
        if (color != null) color.getValue();
        parentVoLookup5.setParent(
            new ims.core.vo.lookups.Sex(
                parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color));
        parentVoLookup5 = parentVoLookup5.getParent();
        parent5 = parent5.getParent();
      }
      valueObject.setGender(voLookup5);
    }
    // dateOfDeathFrom
    java.util.Date dateOfDeathFrom = domainObject.getDateOfDeathFrom();
    if (null != dateOfDeathFrom) {
      valueObject.setDateOfDeathFrom(new ims.framework.utils.Date(dateOfDeathFrom));
    }
    // dateOfDeathTo
    java.util.Date dateOfDeathTo = domainObject.getDateOfDeathTo();
    if (null != dateOfDeathTo) {
      valueObject.setDateOfDeathTo(new ims.framework.utils.Date(dateOfDeathTo));
    }
    // postCode
    valueObject.setPostCode(domainObject.getPostCode());
    // pafKey
    valueObject.setPafKey(domainObject.getPafKey());
    // addressLines
    if (domainObject.getAddressLines() != null) {
      if (domainObject.getAddressLines()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getAddressLines();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setAddressLines(new ims.core.patient.vo.PDSAddrRefVo(id, -1));
      } else {
        valueObject.setAddressLines(
            new ims.core.patient.vo.PDSAddrRefVo(
                domainObject.getAddressLines().getId(),
                domainObject.getAddressLines().getVersion()));
      }
    }
    // gpPracticeCode
    valueObject.setGpPracticeCode(domainObject.getGpPracticeCode());
    // status
    ims.domain.lookups.LookupInstance instance12 = domainObject.getStatus();
    if (null != instance12) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance12.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance12.getImage().getImageId(), instance12.getImage().getImagePath());
      }
      color = instance12.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.PDSSearchStatus voLookup12 =
          new ims.core.vo.lookups.PDSSearchStatus(
              instance12.getId(), instance12.getText(), instance12.isActive(), null, img, color);
      ims.core.vo.lookups.PDSSearchStatus parentVoLookup12 = voLookup12;
      ims.domain.lookups.LookupInstance parent12 = instance12.getParent();
      while (parent12 != null) {
        if (parent12.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent12.getImage().getImageId(), parent12.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent12.getColor();
        if (color != null) color.getValue();
        parentVoLookup12.setParent(
            new ims.core.vo.lookups.PDSSearchStatus(
                parent12.getId(), parent12.getText(), parent12.isActive(), null, img, color));
        parentVoLookup12 = parentVoLookup12.getParent();
        parent12 = parent12.getParent();
      }
      valueObject.setStatus(voLookup12);
    }
    // errorReason
    valueObject.setErrorReason(domainObject.getErrorReason());
    return valueObject;
  }