コード例 #1
0
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.ocrr.orderingresults.domain.objects.OcsOrderSession
   */
  public static ims.ocs_if.vo.IfOcsOrderShortVo insert(
      DomainObjectMap map,
      ims.ocs_if.vo.IfOcsOrderShortVo valueObject,
      ims.ocrr.orderingresults.domain.objects.OcsOrderSession domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Patient
    if (domainObject.getPatient() != null) {
      if (domainObject.getPatient()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPatient();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPatient(new ims.core.patient.vo.PatientRefVo(id, -1));
      } else {
        valueObject.setPatient(
            new ims.core.patient.vo.PatientRefVo(
                domainObject.getPatient().getId(), domainObject.getPatient().getVersion()));
      }
    }
    // OrderedBy
    valueObject.setOrderedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getOrderedBy()));
    // ResponsibleClinician
    valueObject.setResponsibleClinician(
        ims.core.vo.domain.HcpLiteVoAssembler.create(map, domainObject.getResponsibleClinician()));
    // ResponsibleGp
    valueObject.setResponsibleGp(
        ims.core.vo.domain.GpLiteVoAssembler.create(map, domainObject.getResponsibleGp()));
    // PatientLocation
    if (domainObject.getPatientLocation() != null) {
      if (domainObject.getPatientLocation()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPatientLocation();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPatientLocation(new ims.core.resource.place.vo.LocationRefVo(id, -1));
      } else {
        valueObject.setPatientLocation(
            new ims.core.resource.place.vo.LocationRefVo(
                domainObject.getPatientLocation().getId(),
                domainObject.getPatientLocation().getVersion()));
      }
    }
    // PatientClinic
    if (domainObject.getPatientClinic() != null) {
      if (domainObject.getPatientClinic()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPatientClinic();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPatientClinic(new ims.core.resource.place.vo.ClinicRefVo(id, -1));
      } else {
        valueObject.setPatientClinic(
            new ims.core.resource.place.vo.ClinicRefVo(
                domainObject.getPatientClinic().getId(),
                domainObject.getPatientClinic().getVersion()));
      }
    }
    // AdditClinNotes
    valueObject.setAdditClinNotes(domainObject.getAdditClinNotes());
    // SendNumber
    valueObject.setSendNumber(domainObject.isSendNumber());
    return valueObject;
  }