/**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.clinical.vo.IntraOperativeCareRecordShortVo copy(
     ims.clinical.vo.IntraOperativeCareRecordShortVo valueObjectDest,
     ims.clinical.vo.IntraOperativeCareRecordShortVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_IntraOperativeCareRecord(valueObjectSrc.getID_IntraOperativeCareRecord());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // IntraOperativeDetails
   valueObjectDest.setIntraOperativeDetails(valueObjectSrc.getIntraOperativeDetails());
   // CareContext
   valueObjectDest.setCareContext(valueObjectSrc.getCareContext());
   // ActualProcedure
   valueObjectDest.setActualProcedure(valueObjectSrc.getActualProcedure());
   // ProcedureDate
   valueObjectDest.setProcedureDate(valueObjectSrc.getProcedureDate());
   // Theatre
   valueObjectDest.setTheatre(valueObjectSrc.getTheatre());
   // Surgeon
   valueObjectDest.setSurgeon(valueObjectSrc.getSurgeon());
   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.core.clinical.domain.objects.IntraOperativeCareRecord
   */
  public static ims.clinical.vo.IntraOperativeCareRecordShortVo insert(
      DomainObjectMap map,
      ims.clinical.vo.IntraOperativeCareRecordShortVo valueObject,
      ims.core.clinical.domain.objects.IntraOperativeCareRecord domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // IntraOperativeDetails
    valueObject.setIntraOperativeDetails(
        ims.clinical.vo.domain.IntraOperativeDetailsLiteVoAssembler.create(
            map, domainObject.getIntraOperativeDetails()));
    // 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()));
      }
    }
    // ActualProcedure
    valueObject.setActualProcedure(
        ims.core.vo.domain.PatientProcedureForSurgicalOperationNotesVoAssembler.create(
            map, domainObject.getActualProcedure()));
    // ProcedureDate
    java.util.Date ProcedureDate = domainObject.getProcedureDate();
    if (null != ProcedureDate) {
      valueObject.setProcedureDate(new ims.framework.utils.Date(ProcedureDate));
    }
    // Theatre
    valueObject.setTheatre(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getTheatre()));
    // Surgeon
    valueObject.setSurgeon(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getSurgeon()));
    return valueObject;
  }