/**
   * 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.configuration.domain.objects.ProblemHotlistItem
   */
  public static ims.clinicaladmin.vo.ProblemHotlistItemVo insert(
      DomainObjectMap map,
      ims.clinicaladmin.vo.ProblemHotlistItemVo valueObject,
      ims.clinical.configuration.domain.objects.ProblemHotlistItem domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Problem
    valueObject.setProblem(
        ims.clinical.vo.domain.ClinicalProblemShortVoAssembler.create(
            map, domainObject.getProblem()));
    return valueObject;
  }
  public static ims.clinical.configuration.domain.objects.ProblemHotlistItem
      extractProblemHotlistItem(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.clinicaladmin.vo.ProblemHotlistItemVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_ProblemHotlistItem();
    ims.clinical.configuration.domain.objects.ProblemHotlistItem domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.clinical.configuration.domain.objects.ProblemHotlistItem)
            domMap.get(valueObject);
      }
      // ims.clinicaladmin.vo.ProblemHotlistItemVo ID_ProblemHotlistItem field is unknown
      domainObject = new ims.clinical.configuration.domain.objects.ProblemHotlistItem();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_ProblemHotlistItem());
      if (domMap.get(key) != null) {
        return (ims.clinical.configuration.domain.objects.ProblemHotlistItem) domMap.get(key);
      }
      domainObject =
          (ims.clinical.configuration.domain.objects.ProblemHotlistItem)
              domainFactory.getDomainObject(
                  ims.clinical.configuration.domain.objects.ProblemHotlistItem.class, id);

      // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception,
      // but maybe should be handled as that further up.
      if (domainObject == null) return null;

      domMap.put(key, domainObject);
    }
    domainObject.setVersion(valueObject.getVersion_ProblemHotlistItem());

    domainObject.setProblem(
        ims.clinical.vo.domain.ClinicalProblemShortVoAssembler.extractClinicalProblem(
            domainFactory, valueObject.getProblem(), domMap));

    return domainObject;
  }