/** Sets the "single-best-record" element */
 public void setSingleBestRecord(
     org.openhie.openempi.configuration.xml.SingleBestRecordType singleBestRecord) {
   synchronized (monitor()) {
     check_orphaned();
     org.openhie.openempi.configuration.xml.SingleBestRecordType target = null;
     target =
         (org.openhie.openempi.configuration.xml.SingleBestRecordType)
             get_store().find_element_user(SINGLEBESTRECORD$1, 0);
     if (target == null) {
       target =
           (org.openhie.openempi.configuration.xml.SingleBestRecordType)
               get_store().add_element_user(SINGLEBESTRECORD$0);
     }
     target.set(singleBestRecord);
   }
 }
Example #2
0
  private void processSingleBestRecordConfiguration(MpiConfigDocument configuration) {
    checkConfiguration(configuration);
    if (configuration.getMpiConfig().sizeOfSingleBestRecordArray() == 0) {
      log.warn("No single best record configuration has been specified.");
      return;
    }
    SingleBestRecordType obj = configuration.getMpiConfig().getSingleBestRecordArray(0);
    log.debug("Object is of type: " + obj.getDomNode().getNamespaceURI());
    String namespaceUriStr = obj.getDomNode().getNamespaceURI();
    URI namespaceURI = getNamespaceURI(namespaceUriStr);

    String resourcePath = generateComponentResourcePath(namespaceURI);
    Component component = loadAndRegisterComponentFromNamespaceUri(resourcePath);

    String configurationLoaderBean = getExtensionBeanNameFromComponent(component);

    ConfigurationLoader loader =
        (ConfigurationLoader) Context.getApplicationContext().getBean(configurationLoaderBean);
    loader.loadAndRegisterComponentConfiguration(this, obj);

    Component.Extension extension =
        component.getExtensionByExtensionInterface(ExtensionInterface.IMPLEMENTATION);
    if (extension == null) {
      log.error(
          "Encountered a custom single best record component with no implementation extension: "
              + component);
      throw new InitializationException(
          "Unable to locate an implementation component for custom single best record component "
              + component.getName());
    }
    log.debug(
        "Registering implementation of single best record component named "
            + extension.getName()
            + " and implementation key "
            + extension.getImplementationKey());
    SingleBestRecordService singleBestRecordService =
        (SingleBestRecordService)
            Context.getApplicationContext().getBean(extension.getImplementationKey());
    Context.registerCustomSingleBestRecordService(singleBestRecordService);
  }