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

      valueObject = insert(map, valueObject, domainObject);
    }
    return valueObject;
  }
  public String toAuditString() {
    StringBuffer auditStr = new StringBuffer();

    auditStr.append("\r\n*careContext* :");
    if (careContext != null) {
      auditStr.append(toShortClassName(careContext));

      auditStr.append(careContext.getId());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*authoringInformation* :");
    if (authoringInformation != null) {
      auditStr.append(toShortClassName(authoringInformation));

      auditStr.append(authoringInformation.toString());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*intraOperativeCareRecord* :");
    if (intraOperativeCareRecord != null) {
      auditStr.append(toShortClassName(intraOperativeCareRecord));

      auditStr.append(intraOperativeCareRecord.getId());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*preOperativeDiagnosis* :");
    auditStr.append(preOperativeDiagnosis);
    auditStr.append("; ");
    auditStr.append("\r\n*antibiotics* :");
    auditStr.append(antibiotics);
    auditStr.append("; ");
    auditStr.append("\r\n*vTE* :");
    auditStr.append(vTE);
    auditStr.append("; ");
    auditStr.append("\r\n*incision* :");
    auditStr.append(incision);
    auditStr.append("; ");
    auditStr.append("\r\n*findings* :");
    auditStr.append(findings);
    auditStr.append("; ");
    auditStr.append("\r\n*procedure* :");
    auditStr.append(procedure);
    auditStr.append("; ");
    auditStr.append("\r\n*complications* :");
    auditStr.append(complications);
    auditStr.append("; ");
    auditStr.append("\r\n*closure* :");
    auditStr.append(closure);
    auditStr.append("; ");
    auditStr.append("\r\n*lAInfiltration* :");
    auditStr.append(lAInfiltration);
    auditStr.append("; ");
    auditStr.append("\r\n*postOpInstructions* :");
    auditStr.append(postOpInstructions);
    auditStr.append("; ");
    auditStr.append("\r\n*eBI* :");
    auditStr.append(eBI);
    auditStr.append("; ");
    auditStr.append("\r\n*followUpType* :");
    if (followUpType != null) auditStr.append(followUpType.getText());
    auditStr.append("; ");
    auditStr.append("\r\n*followUpTypeIn* :");
    if (followUpTypeIn != null) auditStr.append(followUpTypeIn.getText());
    auditStr.append("; ");
    return auditStr.toString();
  }
  /**
   * 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;
  }