/**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.nursing.vo.NutritionalRiskAssessmentVo copy(
     ims.nursing.vo.NutritionalRiskAssessmentVo valueObjectDest,
     ims.nursing.vo.NutritionalRiskAssessmentVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_Assessment(valueObjectSrc.getID_Assessment());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // AssessmentDetails
   valueObjectDest.setAssessmentDetails(valueObjectSrc.getAssessmentDetails());
   // HcpInitiated
   valueObjectDest.setHcpInitiated(valueObjectSrc.getHcpInitiated());
   // DateTimeInitiated
   valueObjectDest.setDateTimeInitiated(valueObjectSrc.getDateTimeInitiated());
   // ClinicalContact
   valueObjectDest.setClinicalContact(valueObjectSrc.getClinicalContact());
   // CareContext
   valueObjectDest.setCareContext(valueObjectSrc.getCareContext());
   return valueObjectDest;
 }
  /**
   * 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.NutritionalRiskAssessment
   */
  public static ims.nursing.vo.NutritionalRiskAssessmentVo insert(
      DomainObjectMap map,
      ims.nursing.vo.NutritionalRiskAssessmentVo valueObject,
      ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // AssessmentDetails
    valueObject.setAssessmentDetails(
        ims.nursing.vo.domain.NutritionalRiskAssessmentDetailsVoAssembler
            .createNutritionalRiskAssessmentDetailsVoCollectionFromNutritionalRiskAssessmentDetails(
                map, domainObject.getAssessmentDetails()));
    // HcpInitiated
    valueObject.setHcpInitiated(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getHcpInitiated()));
    // DateTimeInitiated
    java.util.Date DateTimeInitiated = domainObject.getDateTimeInitiated();
    if (null != DateTimeInitiated) {
      valueObject.setDateTimeInitiated(new ims.framework.utils.DateTime(DateTimeInitiated));
    }
    // 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()));
      }
    }
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    return valueObject;
  }