Class SpringBidiMappingService

java.lang.Object
org.openehealth.ipf.commons.map.BidiMappingService
org.openehealth.ipf.commons.spring.map.SpringBidiMappingService
All Implemented Interfaces:
MappingService, MappingResourceTarget, Aware, BeanFactoryAware, SmartInitializingSingleton

@Deprecated(since="6.0", forRemoval=true) public class SpringBidiMappingService extends BidiMappingService implements MappingResourceTarget, BeanFactoryAware, SmartInitializingSingleton
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, use SpringMappings and the typed Mappings API. This class remains as an adapter for applications still holding a MappingService, and is scheduled for removal in IPF 7.0.
BidiMappingService implementation that can be configured with Spring resources.

A resource is dispatched to a loader by its file extension, so the mapping files an application registers may be in any format whose module is on the classpath - .mapping.xml, .mapping.yaml, .conceptmap.r4.json or the legacy .map - and one list may mix them.

When this service owns its mappings, it collects the MappingResourceHolder beans (usually CustomMappings instances) of the application context itself, so no further beans are required:

    <bean id="mappingService"
          class="org.openehealth.ipf.commons.spring.map.SpringBidiMappingService"/>
Collecting happens in afterSingletonsInstantiated(), i.e. from within finishBeanFactoryInitialization and thus before the ContextRefreshedEvent that starts e.g. the Camel context. Contributions can be ordered relative to each other with Spring's @Order / Ordered on the MappingResourceHolder bean.

Reading resources is left to a SpringMappings: one this service creates for itself, or, with SpringBidiMappingService(SpringMappings), the application's bean, which then does the collecting so that the mappings the two share are read exactly once.

Since:
3.1
  • Constructor Details

    • SpringBidiMappingService

      public SpringBidiMappingService()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • SpringBidiMappingService

      public SpringBidiMappingService(SpringMappings mappings)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Adapts mappings somebody else owns, so that an application can keep using the untyped service while the mappings themselves are configured, and read, through SpringMappings. The SpringMappings must be a bean of the application context, since it collects the MappingResourceHolder beans itself; one created in place and handed in here never does.
      Parameters:
      mappings - the mappings to delegate to
  • Method Details

    • setBeanFactory

      public void setBeanFactory(@NonNull @NonNull BeanFactory beanFactory)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      setBeanFactory in interface BeanFactoryAware
      See Also:
    • afterSingletonsInstantiated

      public void afterSingletonsInstantiated()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Collects the mapping resources of all MappingResourceHolder beans of the application context and its ancestors, honouring their @Order. Does nothing if the mappings belong to a SpringMappings bean, which collects them itself.
      Specified by:
      afterSingletonsInstantiated in interface SmartInitializingSingleton
    • getMappingResources

      public Collection<? extends Resource> getMappingResources()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setMappingResource

      public void setMappingResource(Resource resource)
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • setMappingResources

      public void setMappingResources(Collection<? extends Resource> resources)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MappingResourceTarget
      Reads every resource and registers the mappings it contains. Which format a resource is in is decided by its file extension.
      Specified by:
      setMappingResources in interface MappingResourceTarget
      Parameters:
      resources - mapping resources
    • setMappingResources

      public void setMappingResources(Collection<? extends Resource> resources, String format)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MappingResourceTarget
      Reads every resource in a format named explicitly, for resources whose name does not identify one - a location without a file extension, or a file called gender.xml.
      Specified by:
      setMappingResources in interface MappingResourceTarget
      Parameters:
      resources - mapping resources
      format - a format id such as xml or conceptmap-r4-json, or null to dispatch by file extension
    • setIgnoreResourceNotFound

      public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Whether a resource that does not exist or cannot be read is skipped instead of failing the context. Applies to the SpringMappings this service reads into.
    • getIgnoreResourceNotFound

      public boolean getIgnoreResourceNotFound()
      Deprecated, for removal: This API element is subject to removal in a future version.