Class FilterConfigurationMapper

    • Constructor Detail

      • FilterConfigurationMapper

        public FilterConfigurationMapper()
        Deprecated.
        Creates a new FilterConfigurationMapper object with no mappings and the custom configuration directory set to the current directory.
    • Method Detail

      • addFromPlugins

        public void addFromPlugins​(PluginsManager pm)
        Deprecated.
      • createFilter

        public IFilter createFilter​(String configId)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Creates an instance of the filter for a given configuration identifier and loads its corresponding parameters.
        Specified by:
        createFilter in interface IFilterConfigurationMapper
        Parameters:
        configId - the configuration identifier to use for look-up.
        Returns:
        a new IFilter object (with its parameters loaded) for the given configuration identifier, or null if the object could not be created.
      • createFilter

        public IFilter createFilter​(String configId,
                                    IFilter existingFilter)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Creates an instance of the filter for a given configuration identifier and loads its corresponding parameters.
        Specified by:
        createFilter in interface IFilterConfigurationMapper
        Parameters:
        configId - the configuration identifier to use for look-up.
        existingFilter - an optional existing instance of a filter. This argument can be null. If this argument is not null, it is checked against the requested filter and re-use if the requested filter and the provided instance are the same. If the provided instance is re-used, its parameters are always re-loaded. Providing an existing instance of the requested filter may allow for better efficiency.
        Returns:
        a new IFilter object (with its parameters loaded) for the given configuration identifier, or null if the object could not be created.
      • getParameters

        public IParameters getParameters​(FilterConfiguration config,
                                         IFilter existingFilter)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Gets the parameters for a given configuration (predefined or custom).
        Specified by:
        getParameters in interface IFilterConfigurationMapper
        Parameters:
        config - the configuration for which the parameters are requested.
        existingFilter - optional existing instance of the filter for the given configuration. This argument can be null. If it not null, the provided filter may be used to load the parameters (if it matches the appropriate class). Providing this argument may allow the method to be more efficient by not creating a temporary filter to get an instance of the parameters to load.
        Returns:
        the parameters object for the given configuration.
      • createConfigurationEditor

        public IParametersEditor createConfigurationEditor​(String configId)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Creates an instance of the filter's parameters editor for a given configuration identifier.
        Specified by:
        createConfigurationEditor in interface IFilterConfigurationMapper
        Parameters:
        configId - the configuration identifier to use for look-up.
        Returns:
        a new IParametersEditor object for the given configuration identifier, or null if no editor is available or if the object could not be created.
      • createConfigurationEditor

        public IParametersEditor createConfigurationEditor​(String configId,
                                                           IFilter existingFilter)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Creates an instance of the filter's parameters editor for a given configuration identifier.
        Specified by:
        createConfigurationEditor in interface IFilterConfigurationMapper
        Parameters:
        configId - the configuration identifier to use for look-up.
        existingFilter - an optional existing instance of a filter. This argument can be null. If this argument is not null and matches the filter of the given configuration it is used instead of a temporay instance, to get an instance of the parameters object for which the editor is requested.
        Returns:
        a new IParametersEditor object for the given configuration identifier, or null if no editor is available or if the object could not be created.
      • getConfiguration

        public FilterConfiguration getConfiguration​(String configId)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Gets the FilterConfiguration object for a given configuration identifier.
        Specified by:
        getConfiguration in interface IFilterConfigurationMapper
        Parameters:
        configId - the configuration identifier to search for.
        Returns:
        the FilterConfiguration object for the given configuration identifier, or null if a match could not be found.
      • getFilterConfigurations

        public List<FilterConfiguration> getFilterConfigurations​(String filterClass)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Gets a list of all FilterConfiguration objects for a given filter class.
        Specified by:
        getFilterConfigurations in interface IFilterConfigurationMapper
        Parameters:
        filterClass - the class name of the filter to search for.
        Returns:
        a list of all FilterConfiguration objects found for the given filter class name (the list may be empty).
      • removeConfigurations

        public void removeConfigurations​(String filterClass)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Removes all the configurations (predefined and custom) of a given filter from this mapper.
        Specified by:
        removeConfigurations in interface IFilterConfigurationMapper
        Parameters:
        filterClass - the class name of the filter to lookup.
      • getCustomParameters

        public IParameters getCustomParameters​(FilterConfiguration config,
                                               IFilter existingFilter)
        Deprecated.
        Gets the parameters for a given custom filter configuration. This default implementation gets the custom data from a file located in the current directory at the time the method is called.
        Specified by:
        getCustomParameters in interface IFilterConfigurationMapper
        Parameters:
        config - the custom configuration for which the method should return the filter parameters.
        existingFilter - optional existing instance of the filter for the given configuration. This argument can be null. If it not null, the provided filter may be used to load the parameters (if it matches the appropriate class). Providing this argument may allow the method to be more efficient by not creating a temporary filter to get an instance of the parameters to load.
        Returns:
        the parameters for the given custom filter configuration, or null if the parameters could not be provided, or if the corresponding filter does not have parameters.
      • saveCustomParameters

        public void saveCustomParameters​(FilterConfiguration config,
                                         IParameters params)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Saves the parameters of a custom configuration. This method provides a way for this mapper to implements how it stores custom filter parameters.
        Specified by:
        saveCustomParameters in interface IFilterConfigurationMapper
        Parameters:
        config - the custom configuration for which to save the parameters.
        params - the parameters to save.
      • clearConfigurations

        public void clearConfigurations​(boolean customOnly)
        Deprecated.
        Description copied from interface: IFilterConfigurationMapper
        Removes configuration mappings from this mapper.
        Specified by:
        clearConfigurations in interface IFilterConfigurationMapper
        Parameters:
        customOnly - true to clear only the custom configurations, false to clear all the configurations from this mapper.
      • getCustomConfigurationsDirectory

        public String getCustomConfigurationsDirectory()
        Deprecated.
        Gets the directory where the custom configuration files are stored.
        Returns:
        the directory where the custom configuration files are stored.
      • setCustomConfigurationsDirectory

        public void setCustomConfigurationsDirectory​(String dir)
        Deprecated.
        Sets the directory where the custom configuration files are stored. You should call updateCustomConfigurations() after this to update the list of the custom configurations in this mapper.
        Parameters:
        dir - the new directory where the custom configuration files are stored.
      • updateCustomConfigurations

        public void updateCustomConfigurations()
        Deprecated.
        Updates the custom configurations for this mapper. This should be called if the custom configurations directory has changed.
      • instantiateFilter

        protected IFilter instantiateFilter​(FilterConfiguration config,
                                            IFilter existingFilter)
        Deprecated.
        Instantiate a filter from a given configuration, trying to re-use an existing one.
        Parameters:
        config - the configuration corresponding to the filter to load.
        existingFilter - an optional existing filter we can try to reuse.
        Returns:
        the instance of the requested filter, or null if an error occurred.
        Throws:
        OkapiFilterCreationException - if the filter could not be instantiated.