/**
   * 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.treatment.domain.objects.Mobilisations
   */
  public static ims.therapies.vo.MobilisationsShortVo insert(
      DomainObjectMap map,
      ims.therapies.vo.MobilisationsShortVo valueObject,
      ims.therapies.treatment.domain.objects.Mobilisations domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ClinicalContact
    valueObject.setClinicalContact(
        ims.core.vo.domain.ClinicalContactShortVoAssembler.create(
            map, domainObject.getClinicalContact()));
    // AuthoringCP
    valueObject.setAuthoringCP(
        ims.core.vo.domain.HcpAssembler.create(map, domainObject.getAuthoringCP()));
    // AuthoringDateTime
    java.util.Date AuthoringDateTime = domainObject.getAuthoringDateTime();
    if (null != AuthoringDateTime) {
      valueObject.setAuthoringDateTime(new ims.framework.utils.DateTime(AuthoringDateTime));
    }
    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.mobilitytransfers.domain.objects.WheelchairAssessment
   */
  public static ims.therapies.vo.WheelchairAssessmentVo insert(
      DomainObjectMap map,
      ims.therapies.vo.WheelchairAssessmentVo valueObject,
      ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // AuthoringDateTime
    java.util.Date AuthoringDateTime = domainObject.getAuthoringDateTime();
    if (null != AuthoringDateTime) {
      valueObject.setAuthoringDateTime(new ims.framework.utils.DateTime(AuthoringDateTime));
    }
    // AuthoringCP
    valueObject.setAuthoringCP(
        ims.core.vo.domain.HcpAssembler.create(map, domainObject.getAuthoringCP()));
    // ChairType
    ims.domain.lookups.LookupInstance instance3 = domainObject.getChairType();
    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.spinalinjuries.vo.lookups.WheelchairType voLookup3 =
          new ims.spinalinjuries.vo.lookups.WheelchairType(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.spinalinjuries.vo.lookups.WheelchairType 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.spinalinjuries.vo.lookups.WheelchairType(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setChairType(voLookup3);
    }
    // SurfaceDistance
    valueObject.setSurfaceDistance(
        ims.therapies.vo.domain.WheelchairSurfaceDistanceVoAssembler
            .createWheelchairSurfaceDistanceVoCollectionFromWheelchairSurfaceDistance(
                map, domainObject.getSurfaceDistance()));
    // PowerchairSkillsAssess
    valueObject.setPowerchairSkillsAssess(
        ims.therapies.vo.domain.PowerchairSkillsAssessmentVoAssembler
            .createPowerchairSkillsAssessmentVoCollectionFromPowerchairSkillsAssessment(
                map, domainObject.getPowerchairSkillsAssess()));
    // WheelchairSkillsAssess
    valueObject.setWheelchairSkillsAssess(
        ims.therapies.vo.domain.WheelchairSkillsAssessmentVoAssembler
            .createWheelchairSkillsAssessmentVoCollectionFromWheelchairSkillsAssessment(
                map, domainObject.getWheelchairSkillsAssess()));
    // 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()));
      }
    }
    return valueObject;
  }