コード例 #1
0
  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;
  }
  /**
   * 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.resource.domain.objects.ServiceActivity
   */
  public static ims.core.vo.ServiceActivityForServiceConfigurationVo insert(
      DomainObjectMap map,
      ims.core.vo.ServiceActivityForServiceConfigurationVo valueObject,
      ims.core.resource.domain.objects.ServiceActivity domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Service
    if (domainObject.getService() != null) {
      if (domainObject.getService()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getService();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setService(new ims.core.clinical.vo.ServiceRefVo(id, -1));
      } else {
        valueObject.setService(
            new ims.core.clinical.vo.ServiceRefVo(
                domainObject.getService().getId(), domainObject.getService().getVersion()));
      }
    }
    // Activity
    valueObject.setActivity(
        ims.core.vo.domain.ActivityLiteVoAssembler.create(map, domainObject.getActivity()));
    // TaxonomyMap
    valueObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            map, domainObject.getTaxonomyMap()));
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    // isFlexible
    valueObject.setIsFlexible(domainObject.isIsFlexible());
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.oncology.domain.objects.ContactTypesByDisciplineItem
   */
  public static ims.oncology.vo.ContactTypesByDisciplineItemVo insert(
      DomainObjectMap map,
      ims.oncology.vo.ContactTypesByDisciplineItemVo valueObject,
      ims.oncology.domain.objects.ContactTypesByDisciplineItem domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // ContactType
    valueObject.setContactType(domainObject.getContactType());
    // Active
    valueObject.setActive(domainObject.isActive());
    // Parent
    if (domainObject.getParent() != null) {
      if (domainObject.getParent()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getParent();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setParent(new ims.oncology.vo.ContactTypesByDisciplineItemRefVo(id, -1));
      } else {
        valueObject.setParent(
            new ims.oncology.vo.ContactTypesByDisciplineItemRefVo(
                domainObject.getParent().getId(), domainObject.getParent().getVersion()));
      }
    }
    // TaxonomyMap
    valueObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            map, domainObject.getTaxonomyMap()));
    return valueObject;
  }
コード例 #4
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;
  }
コード例 #5
0
  public static java.util.Set extractTaxonomyMapSet(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.core.vo.TaxonomyMapCollection voCollection,
      java.util.Set domainObjectSet,
      HashMap domMap) {
    int size = (null == voCollection) ? 0 : voCollection.size();
    if (domainObjectSet == null) {
      domainObjectSet = new java.util.HashSet();
    }
    java.util.Set newSet = new java.util.HashSet();
    for (int i = 0; i < size; i++) {
      ims.core.vo.TaxonomyMap vo = voCollection.get(i);
      ims.core.clinical.domain.objects.TaxonomyMap domainObject =
          TaxonomyMapAssembler.extractTaxonomyMap(domainFactory, vo, domMap);

      // TODO: This can only occur in the situation of a stale object exception. For now leave it to
      // the Interceptor to handle it.
      if (domainObject == null) {
        continue;
      }

      // Trying to avoid the hibernate collection being marked as dirty via its public interface
      // methods. (like add)
      if (!domainObjectSet.contains(domainObject)) domainObjectSet.add(domainObject);
      newSet.add(domainObject);
    }
    java.util.Set removedSet = new java.util.HashSet();
    java.util.Iterator iter = domainObjectSet.iterator();
    // Find out which objects need to be removed
    while (iter.hasNext()) {
      ims.domain.DomainObject o = (ims.domain.DomainObject) iter.next();
      if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue())
          && !newSet.contains(o)) {
        removedSet.add(o);
      }
    }
    iter = removedSet.iterator();
    // Remove the unwanted objects
    while (iter.hasNext()) {
      domainObjectSet.remove(iter.next());
    }
    return domainObjectSet;
  }
コード例 #6
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.core.resource.people.domain.objects.Gp
   */
  public static ims.core.vo.GPNTPFVo insert(
      DomainObjectMap map,
      ims.core.vo.GPNTPFVo valueObject,
      ims.core.resource.people.domain.objects.Gp domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // name
    valueObject.setName(ims.core.vo.domain.PersonNameAssembler.create(map, domainObject.getName()));
    // practices
    valueObject.setPractices(
        ims.core.vo.domain.GPToPracticeNTPFVoAssembler
            .createGPToPracticeNTPFVoCollectionFromGpToPractice(map, domainObject.getPractices()));
    // CodeMappings
    valueObject.setCodeMappings(
        ims.core.vo.domain.TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            map, domainObject.getCodeMappings()));
    return valueObject;
  }
コード例 #7
0
  public static java.util.List extractTaxonomyMapList(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.core.vo.TaxonomyMapCollection voCollection,
      java.util.List domainObjectList,
      HashMap domMap) {
    int size = (null == voCollection) ? 0 : voCollection.size();
    if (domainObjectList == null) {
      domainObjectList = new java.util.ArrayList();
    }
    for (int i = 0; i < size; i++) {
      ims.core.vo.TaxonomyMap vo = voCollection.get(i);
      ims.core.clinical.domain.objects.TaxonomyMap domainObject =
          TaxonomyMapAssembler.extractTaxonomyMap(domainFactory, vo, domMap);

      // TODO: This can only occur in the situation of a stale object exception. For now leave it to
      // the Interceptor to handle it.
      if (domainObject == null) {
        continue;
      }

      int domIdx = domainObjectList.indexOf(domainObject);
      if (domIdx == -1) {
        domainObjectList.add(i, domainObject);
      } else if (i != domIdx && i < domainObjectList.size()) {
        Object tmp = domainObjectList.get(i);
        domainObjectList.set(i, domainObjectList.get(domIdx));
        domainObjectList.set(domIdx, tmp);
      }
    }

    // Remove all ones in domList where index > voCollection.size() as these should
    // now represent the ones removed from the VO collection. No longer referenced.
    int i1 = domainObjectList.size();
    while (i1 > size) {
      domainObjectList.remove(i1 - 1);
      i1 = domainObjectList.size();
    }
    return domainObjectList;
  }
コード例 #8
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.core.clinical.domain.objects.Medication
   */
  public static ims.core.vo.MedicationVo insert(
      DomainObjectMap map,
      ims.core.vo.MedicationVo valueObject,
      ims.core.clinical.domain.objects.Medication domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // TaxonomyMap
    valueObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            map, domainObject.getTaxonomyMap()));
    // Keywords
    valueObject.setKeywords(
        ims.core.vo.domain.KeywordVoAssembler.createKeywordVoCollectionFromKeyword(
            map, domainObject.getKeywords()));
    // MedicationName
    valueObject.setMedicationName(domainObject.getMedicationName());
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    // isControlledDrug
    valueObject.setIsControlledDrug(domainObject.isIsControlledDrug());
    // FrequencyDefault
    ims.domain.lookups.LookupInstance instance6 = domainObject.getFrequencyDefault();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.MedicationFrequency voLookup6 =
          new ims.core.vo.lookups.MedicationFrequency(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.core.vo.lookups.MedicationFrequency parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.core.vo.lookups.MedicationFrequency(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setFrequencyDefault(voLookup6);
    }
    // NoOfDaysSupplyDefault
    valueObject.setNoOfDaysSupplyDefault(domainObject.getNoOfDaysSupplyDefault());
    return valueObject;
  }
  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;
  }