public static ims.core.clinical.domain.objects.Medication extractMedication(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.core.vo.MedicationVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Medication();
    ims.core.clinical.domain.objects.Medication domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.clinical.domain.objects.Medication) domMap.get(valueObject);
      }
      // ims.core.vo.MedicationVo ID_Medication field is unknown
      domainObject = new ims.core.clinical.domain.objects.Medication();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Medication());
      if (domMap.get(key) != null) {
        return (ims.core.clinical.domain.objects.Medication) domMap.get(key);
      }
      domainObject =
          (ims.core.clinical.domain.objects.Medication)
              domainFactory.getDomainObject(ims.core.clinical.domain.objects.Medication.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_Medication());

    domainObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.extractTaxonomyMapList(
            domainFactory, valueObject.getTaxonomyMap(), domainObject.getTaxonomyMap(), domMap));
    domainObject.setKeywords(
        ims.core.vo.domain.KeywordVoAssembler.extractKeywordList(
            domainFactory, valueObject.getKeywords(), domainObject.getKeywords(), domMap));
    // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty
    // string correctly
    // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them
    // consistent at least.
    if (valueObject.getMedicationName() != null && valueObject.getMedicationName().equals("")) {
      valueObject.setMedicationName(null);
    }
    domainObject.setMedicationName(valueObject.getMedicationName());
    domainObject.setIsActive(valueObject.getIsActive());
    domainObject.setIsControlledDrug(valueObject.getIsControlledDrug());
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value6 = null;
    if (null != valueObject.getFrequencyDefault()) {
      value6 = domainFactory.getLookupInstance(valueObject.getFrequencyDefault().getID());
    }
    domainObject.setFrequencyDefault(value6);
    domainObject.setNoOfDaysSupplyDefault(valueObject.getNoOfDaysSupplyDefault());

    return domainObject;
  }
Ejemplo n.º 2
0
  public static ims.core.resource.people.domain.objects.Gp extractGp(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.core.vo.GPNTPFVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Gp();
    ims.core.resource.people.domain.objects.Gp domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.resource.people.domain.objects.Gp) domMap.get(valueObject);
      }
      // ims.core.vo.GPNTPFVo ID_Gp field is unknown
      domainObject = new ims.core.resource.people.domain.objects.Gp();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Gp());
      if (domMap.get(key) != null) {
        return (ims.core.resource.people.domain.objects.Gp) domMap.get(key);
      }
      domainObject =
          (ims.core.resource.people.domain.objects.Gp)
              domainFactory.getDomainObject(ims.core.resource.people.domain.objects.Gp.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_Gp());

    domainObject.setName(
        ims.core.vo.domain.PersonNameAssembler.extractPersonName(
            domainFactory, valueObject.getName(), domMap));
    domainObject.setPractices(
        ims.core.vo.domain.GPToPracticeNTPFVoAssembler.extractGpToPracticeSet(
            domainFactory, valueObject.getPractices(), domainObject.getPractices(), domMap));
    domainObject.setCodeMappings(
        ims.core.vo.domain.TaxonomyMapAssembler.extractTaxonomyMapList(
            domainFactory, valueObject.getCodeMappings(), domainObject.getCodeMappings(), domMap));

    return domainObject;
  }
  public static ims.oncology.domain.objects.ContactTypesByDisciplineItem
      extractContactTypesByDisciplineItem(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.oncology.vo.ContactTypesByDisciplineItemVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_ContactTypesByDisciplineItem();
    ims.oncology.domain.objects.ContactTypesByDisciplineItem domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.oncology.domain.objects.ContactTypesByDisciplineItem) domMap.get(valueObject);
      }
      // ims.oncology.vo.ContactTypesByDisciplineItemVo ID_ContactTypesByDisciplineItem field is
      // unknown
      domainObject = new ims.oncology.domain.objects.ContactTypesByDisciplineItem();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName()
              + "__"
              + valueObject.getID_ContactTypesByDisciplineItem());
      if (domMap.get(key) != null) {
        return (ims.oncology.domain.objects.ContactTypesByDisciplineItem) domMap.get(key);
      }
      domainObject =
          (ims.oncology.domain.objects.ContactTypesByDisciplineItem)
              domainFactory.getDomainObject(
                  ims.oncology.domain.objects.ContactTypesByDisciplineItem.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_ContactTypesByDisciplineItem());

    // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty
    // string correctly
    // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them
    // consistent at least.
    if (valueObject.getContactType() != null && valueObject.getContactType().equals("")) {
      valueObject.setContactType(null);
    }
    domainObject.setContactType(valueObject.getContactType());
    domainObject.setActive(valueObject.getActive());
    ims.oncology.domain.objects.ContactTypesByDisciplineItem value3 = null;
    if (null != valueObject.getParent()) {
      if (valueObject.getParent().getBoId() == null) {
        if (domMap.get(valueObject.getParent()) != null) {
          value3 =
              (ims.oncology.domain.objects.ContactTypesByDisciplineItem)
                  domMap.get(valueObject.getParent());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
      // BO field
      {
        value3 = domainObject.getParent();
      } else {
        value3 =
            (ims.oncology.domain.objects.ContactTypesByDisciplineItem)
                domainFactory.getDomainObject(
                    ims.oncology.domain.objects.ContactTypesByDisciplineItem.class,
                    valueObject.getParent().getBoId());
      }
    }
    domainObject.setParent(value3);
    domainObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.extractTaxonomyMapList(
            domainFactory, valueObject.getTaxonomyMap(), domainObject.getTaxonomyMap(), domMap));

    return domainObject;
  }