/**
   * Create the ValueObject from the ims.nursing.careplans.domain.objects.CarePlanTemplate object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param domainObject
   */
  public static ims.nursing.vo.CarePlanTemplateTitle create(
      DomainObjectMap map, ims.nursing.careplans.domain.objects.CarePlanTemplate domainObject) {
    if (null == domainObject) {
      return null;
    }
    // check if the domainObject already has a valueObject created for it
    ims.nursing.vo.CarePlanTemplateTitle valueObject =
        (ims.nursing.vo.CarePlanTemplateTitle)
            map.getValueObject(domainObject, ims.nursing.vo.CarePlanTemplateTitle.class);
    if (null == valueObject) {
      valueObject =
          new ims.nursing.vo.CarePlanTemplateTitle(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.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;
  }