コード例 #1
0
  public static ims.core.clinical.domain.objects.Service extractService(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.core.vo.ServiceShortVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Service();
    ims.core.clinical.domain.objects.Service domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.clinical.domain.objects.Service) domMap.get(valueObject);
      }
      // ims.core.vo.ServiceShortVo ID_Service field is unknown
      domainObject = new ims.core.clinical.domain.objects.Service();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Service());
      if (domMap.get(key) != null) {
        return (ims.core.clinical.domain.objects.Service) domMap.get(key);
      }
      domainObject =
          (ims.core.clinical.domain.objects.Service)
              domainFactory.getDomainObject(ims.core.clinical.domain.objects.Service.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_Service());

    // 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.getServiceDescription() != null
        && valueObject.getServiceDescription().equals("")) {
      valueObject.setServiceDescription(null);
    }
    domainObject.setServiceDescription(valueObject.getServiceDescription());
    domainObject.setIsActive(valueObject.getIsActive());
    // 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.getAlternateServiceCode() != null
        && valueObject.getAlternateServiceCode().equals("")) {
      valueObject.setAlternateServiceCode(null);
    }
    domainObject.setAlternateServiceCode(valueObject.getAlternateServiceCode());
    // 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.getServiceName() != null && valueObject.getServiceName().equals("")) {
      valueObject.setServiceName(null);
    }
    domainObject.setServiceName(valueObject.getServiceName());
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value5 = null;
    if (null != valueObject.getServiceCategory()) {
      value5 = domainFactory.getLookupInstance(valueObject.getServiceCategory().getID());
    }
    domainObject.setServiceCategory(value5);
    domainObject.setCanBeScheduled(valueObject.getCanBeScheduled());
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value7 = null;
    if (null != valueObject.getSpecialty()) {
      value7 = domainFactory.getLookupInstance(valueObject.getSpecialty().getID());
    }
    domainObject.setSpecialty(value7);
    domainObject.setExpectedTurnaround(valueObject.getExpectedTurnaround());
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value9 = null;
    if (null != valueObject.getTurnaroundMeasure()) {
      value9 = domainFactory.getLookupInstance(valueObject.getTurnaroundMeasure().getID());
    }
    domainObject.setTurnaroundMeasure(value9);
    domainObject.setMaternityIndicator(valueObject.getMaternityIndicator());

    return domainObject;
  }