/**
   * Create the ValueObject from the
   * ims.nursing.assessmenttools.domain.objects.SkinAssessmentFindings object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param domainObject
   */
  public static ims.nursing.vo.SkinAssessmentFindings create(
      DomainObjectMap map,
      ims.nursing.assessmenttools.domain.objects.SkinAssessmentFindings domainObject) {
    if (null == domainObject) {
      return null;
    }
    // check if the domainObject already has a valueObject created for it
    ims.nursing.vo.SkinAssessmentFindings valueObject =
        (ims.nursing.vo.SkinAssessmentFindings)
            map.getValueObject(domainObject, ims.nursing.vo.SkinAssessmentFindings.class);
    if (null == valueObject) {
      valueObject =
          new ims.nursing.vo.SkinAssessmentFindings(
              domainObject.getId(), domainObject.getVersion());
      map.addValueObject(domainObject, valueObject);

      valueObject = insert(map, valueObject, domainObject);
    }
    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;
  }