<commit_before>
package edu.wustl.bulkoperator.templateImport;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import edu.wustl.bulkoperator.dao.DBManagerImpl;
import edu.wustl.bulkoperator.util.BulkOperationConstants;
import edu.wustl.bulkoperator.util.BulkOperationException;
import edu.wustl.bulkoperator.util.BulkOperationUtility;
import edu.wustl.common.exception.ErrorKey;
import edu.wustl.common.util.global.CommonServiceLocator;
import edu.wustl.dao.exception.DAOException;

/**
 * Import Bulk Operation from UI back end target.
 * @author sagar_baldwa
 *
 */
public class ImportBulkOperationTemplate extends AbstractImportBulkOperation
{

	/**
	 * Import Bulk Operation Template.
	 * @param operationName String.
	 * @param dropdownName String.
	 * @param csvFilePath String.
	 * @param xmlFilePath String.
	 * @throws Exception Exception.
	 */
	public ImportBulkOperationTemplate(String operationName, String dropdownName, String csvFile,
			String xmlFile)
	{
		importTemplates(operationName, dropdownName, csvFile, xmlFile,"./"+System.getProperty(BulkOperationConstants.CONFIG_DIR)
				+ File.separator +"bulkOperatorXMLTemplateRules.xml","./"+System.getProperty(BulkOperationConstants.CONFIG_DIR)
				+ File.separator +"BulkOperations.xsd");
	}

	/**
	 * Main method.
	 * @param args Array of Strings.
	 * @throws IOException 
	 */
	public static void main(String[] args) 
	{
		InputStream stream;
		try 
		{
			stream = new FileInputStream(System.getProperty(BulkOperationConstants.CONFIG_DIR)
					+ File.separator +"ApplicationResources.properties");
			ErrorKey.addErrorKeysToMap(stream);
		} 
		catch (FileNotFoundException fileNotExp) 
		{
			logger.debug("Error in initializing Application Resource Properties File", fileNotExp);
		} 
		catch (IOException e) 
		{
			logger.debug("Error in initializing Application Resource Properties File", e);
		}
		String operationName = args[0];
		String dropdownName = args[1];
		String csvFile = args[2];
		String xmlFile = args[3];
		new ImportBulkOperationTemplate(operationName, dropdownName, csvFile, xmlFile);
	}

	/**
	 * Edit Template.
	 * @param connection Connection.
	 * @param operationName String.
	 * @param dropdownName String.
	 * @param csvFile String.
	 * @param xmlFile String.
	 * @throws BulkOperationException BulkOperationException.
	 * @throws IOException
	 * @throws SQLException
	 * @throws SQLException SQLException.
	 */
	protected void editTemplate(String operationName, String dropdownName, String csvFile,
			String xmlFile) throws BulkOperationException, DAOException, IOException
	{
		PreparedStatement preparedStatement = null;<commit_msg>Fix for 22660. Initializing ApplicationResources file.<commit_after>
package edu.wustl.bulkoperator.templateImport;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import edu.wustl.bulkoperator.dao.DBManagerImpl;
import edu.wustl.bulkoperator.util.BulkOperationConstants;
import edu.wustl.bulkoperator.util.BulkOperationException;
import edu.wustl.bulkoperator.util.BulkOperationUtility;
import edu.wustl.common.exception.ErrorKey;
import edu.wustl.common.util.global.CommonServiceLocator;
import edu.wustl.common.util.global.ApplicationProperties;
import edu.wustl.dao.exception.DAOException;

/**
 * Import Bulk Operation from UI back end target.
 * @author sagar_baldwa
 *
 */
public class ImportBulkOperationTemplate extends AbstractImportBulkOperation
{

	/**
	 * Import Bulk Operation Template.
	 * @param operationName String.
	 * @param dropdownName String.
	 * @param csvFilePath String.
	 * @param xmlFilePath String.
	 * @throws Exception Exception.
	 */
	public ImportBulkOperationTemplate(String operationName, String dropdownName, String csvFile,
			String xmlFile)
	{
		importTemplates(operationName, dropdownName, csvFile, xmlFile,"./"+System.getProperty(BulkOperationConstants.CONFIG_DIR)
				+ File.separator +"bulkOperatorXMLTemplateRules.xml","./"+System.getProperty(BulkOperationConstants.CONFIG_DIR)
				+ File.separator +"BulkOperations.xsd");
	}

	/**
	 * Main method.
	 * @param args Array of Strings.
	 * @throws IOException 
	 */
	public static void main(String[] args) 
	{
		InputStream stream;
		try 
		{
			stream = new FileInputStream(System.getProperty(BulkOperationConstants.CONFIG_DIR)
					+ File.separator +"ApplicationResources.properties");
			ErrorKey.addErrorKeysToMap(stream);
			ApplicationProperties.initBundle("ApplicationResources");
			
		} 
		catch (FileNotFoundException fileNotExp) 
		{
			logger.debug("Error in initializing Application Resource Properties File", fileNotExp);
		} 
		catch (IOException e) 
		{
			logger.debug("Error in initializing Application Resource Properties File", e);
		}
		
		String operationName = args[0];
		String dropdownName = args[1];
		String csvFile = args[2];
		String xmlFile = args[3];
		new ImportBulkOperationTemplate(operationName, dropdownName, csvFile, xmlFile);
	}

	/**
	 * Edit Template.
	 * @param connection Connection.
	 * @param operationName String.
	 * @param dropdownName String.
	 * @param csvFile String.
	 * @param xmlFile String.
	 * @throws BulkOperationException BulkOperationException.
	 * @throws IOException
	 * @throws SQLException
	 * @throws SQLException SQLException.
	 */
	protected void editTemplate(String operationName, String dropdownName, String csvFile,
			String xmlFile) throws BulkOperationException, DAOException, IOException
	{
		PreparedStatement preparedStatement = null;
{'fraction_non_alphanumeric': 0.09555629802873371, 'fraction_numerical': 0.002171734046107584, 'mean_word_length': 5.0535894843276035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 16}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6726246', 'n_tokens_mistral': 1880, 'n_tokens_neox': 1700, 'n_words': 399}