コード例 #1
0
  public static ims.core.clinical.domain.objects.SupportNetwork extractSupportNetwork(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.core.vo.SupportNetworkVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_SupportNetwork();
    ims.core.clinical.domain.objects.SupportNetwork domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.clinical.domain.objects.SupportNetwork) domMap.get(valueObject);
      }
      // ims.core.vo.SupportNetworkVo ID_SupportNetwork field is unknown
      domainObject = new ims.core.clinical.domain.objects.SupportNetwork();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_SupportNetwork());
      if (domMap.get(key) != null) {
        return (ims.core.clinical.domain.objects.SupportNetwork) domMap.get(key);
      }
      domainObject =
          (ims.core.clinical.domain.objects.SupportNetwork)
              domainFactory.getDomainObject(
                  ims.core.clinical.domain.objects.SupportNetwork.class, id);

      // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception,
      // but maybe should be handled as that further up.
      if (domainObject == null) return null;

      domMap.put(key, domainObject);
    }
    domainObject.setVersion(valueObject.getVersion_SupportNetwork());

    domainObject.setProfessional(
        ims.core.vo.domain.SupportNetworkProfessionalVoAssembler
            .extractSupportNetworkProfessionalSet(
                domainFactory,
                valueObject.getProfessional(),
                domainObject.getProfessional(),
                domMap));
    domainObject.setServices(
        ims.core.vo.domain.SupportNetworkServicesVoAssembler.extractSupportNetworkServicesSet(
            domainFactory, valueObject.getServices(), domainObject.getServices(), domMap));
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.admin.domain.objects.ClinicalContact value3 = null;
    if (null != valueObject.getClinicalContact()) {
      if (valueObject.getClinicalContact().getBoId() == null) {
        if (domMap.get(valueObject.getClinicalContact()) != null) {
          value3 =
              (ims.core.admin.domain.objects.ClinicalContact)
                  domMap.get(valueObject.getClinicalContact());
        }
      } else {
        value3 =
            (ims.core.admin.domain.objects.ClinicalContact)
                domainFactory.getDomainObject(
                    ims.core.admin.domain.objects.ClinicalContact.class,
                    valueObject.getClinicalContact().getBoId());
      }
    }
    domainObject.setClinicalContact(value3);
    ims.core.admin.domain.objects.CareContext value4 = null;
    if (null != valueObject.getCareContext()) {
      if (valueObject.getCareContext().getBoId() == null) {
        if (domMap.get(valueObject.getCareContext()) != null) {
          value4 =
              (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
      // BO field
      {
        value4 = domainObject.getCareContext();
      } else {
        value4 =
            (ims.core.admin.domain.objects.CareContext)
                domainFactory.getDomainObject(
                    ims.core.admin.domain.objects.CareContext.class,
                    valueObject.getCareContext().getBoId());
      }
    }
    domainObject.setCareContext(value4);
    ims.core.patient.domain.objects.Patient value5 = null;
    if (null != valueObject.getPatient()) {
      if (valueObject.getPatient().getBoId() == null) {
        if (domMap.get(valueObject.getPatient()) != null) {
          value5 = (ims.core.patient.domain.objects.Patient) domMap.get(valueObject.getPatient());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
      // BO field
      {
        value5 = domainObject.getPatient();
      } else {
        value5 =
            (ims.core.patient.domain.objects.Patient)
                domainFactory.getDomainObject(
                    ims.core.patient.domain.objects.Patient.class,
                    valueObject.getPatient().getBoId());
      }
    }
    domainObject.setPatient(value5);

    return domainObject;
  }