/**
   * 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;
  }