Search in sources :

Example 1 with DBAggregationFunctionFactory

use of org.knime.core.node.port.database.aggregation.DBAggregationFunctionFactory in project knime-core by knime.

the class DatabaseUtility method getAggregationFunction.

/**
 * Returns the aggregation function with the given id, if the current database supports it.
 * Otherwise a {@link InvalidDBAggregationFunction} is returned.
 *
 * @param id the id as returned by {@link DBAggregationFunction#getId()}
 * @return the {@link DBAggregationFunction} for the given name or an instance of the
 * {@link InvalidDBAggregationFunction} that has the given id
 * @since 2.11
 */
public DBAggregationFunction getAggregationFunction(final String id) {
    final DBAggregationFunctionFactory function = m_aggregationFunctions.get(id);
    if (function != null) {
        return function.createInstance();
    }
    final String dbIdentifier = getDatabaseIdentifier();
    String msg = "The function '" + id + "' is not supported by ";
    if (dbIdentifier != null) {
        msg += dbIdentifier + ".";
    } else {
        msg += "the current database.";
    }
    return new InvalidDBAggregationFunction(id, msg, dbIdentifier);
}
Also used : DBAggregationFunctionFactory(org.knime.core.node.port.database.aggregation.DBAggregationFunctionFactory) InvalidDBAggregationFunction(org.knime.core.node.port.database.aggregation.InvalidDBAggregationFunction)

Aggregations

DBAggregationFunctionFactory (org.knime.core.node.port.database.aggregation.DBAggregationFunctionFactory)1 InvalidDBAggregationFunction (org.knime.core.node.port.database.aggregation.InvalidDBAggregationFunction)1