<commit_before>/*
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.wso2.carbon.database.query.manager;

import org.apache.log4j.Logger;
import org.wso2.carbon.database.query.manager.config.Queries;
import org.wso2.carbon.database.query.manager.exception.QueryMappingNotAvailableException;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * The query mapping provider which mapping the queries of default map with component default config and
 * deployment.yaml config.
 */
public class QueryProvider {
    private static final Logger LOGGER = Logger.getLogger(QueryProvider.class);
    private static final String DEFAULT_TYPE = "default";

    /**
     * Merge the query mapping for component and deployment queries.
     *
     * @param databaseType      database type for query template lookup.
     * @param databaseVersion   database version for query template lookup.
     * @param componentQueries  queries array load from component queries config file.
     * @param deploymentQueries queries array load from carbon deployment config file.
     * @return results map of the component and deployment queries mapping.
     * @throws QueryMappingNotAvailableException
     */
    public static Map<String, String> mergeMapping(String databaseType, String databaseVersion,
                                                   ArrayList<Queries> componentQueries,
                                                   ArrayList<Queries> deploymentQueries)
            throws QueryMappingNotAvailableException {
        Set<String> defaultConfigSet = new HashSet<>();
        Map<String, String> deploymentConfigMap = new HashMap<>();
        Map<String, String> componentConfigMap = new HashMap<>();
        Map<String, String> result = new HashMap<>();<commit_msg>Fixing query provider List issue.<commit_after>/*
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.wso2.carbon.database.query.manager;

import org.apache.log4j.Logger;
import org.wso2.carbon.database.query.manager.config.Queries;
import org.wso2.carbon.database.query.manager.exception.QueryMappingNotAvailableException;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * The query mapping provider which mapping the queries of default map with component default config and
 * deployment.yaml config.
 */
public class QueryProvider {
    private static final Logger LOGGER = Logger.getLogger(QueryProvider.class);
    private static final String DEFAULT_TYPE = "default";

    /**
     * Merge the query mapping for component and deployment queries.
     *
     * @param databaseType      database type for query template lookup.
     * @param databaseVersion   database version for query template lookup.
     * @param componentQueries  queries array load from component queries config file.
     * @param deploymentQueries queries array load from carbon deployment config file.
     * @return results map of the component and deployment queries mapping.
     * @throws QueryMappingNotAvailableException
     */
    public static Map<String, String> mergeMapping(String databaseType, String databaseVersion,
                                                   List<Queries> componentQueries,
                                                   List<Queries> deploymentQueries)
            throws QueryMappingNotAvailableException {
        Set<String> defaultConfigSet = new HashSet<>();
        Map<String, String> deploymentConfigMap = new HashMap<>();
        Map<String, String> componentConfigMap = new HashMap<>();
        Map<String, String> result = new HashMap<>();
{'fraction_non_alphanumeric': 0.07794561933534744, 'fraction_numerical': 0.006042296072507553, 'mean_word_length': 3.2444444444444445, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2504058', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1187, 'n_words': 473}