/*
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (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.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The Original Code is Protege-2000.
 *
 * The Initial Developer of the Original Code is Stanford University. Portions
 * created by Stanford University are Copyright (C) 2007.  All Rights Reserved.
 *
 * Protege was developed by Stanford Medical Informatics
 * (http://www.smi.stanford.edu) at the Stanford University School of Medicine
 * with support from the National Library of Medicine, the National Science
 * Foundation, and the Defense Advanced Research Projects Agency.  Current
 * information about Protege can be obtained at http://protege.stanford.edu.
 *
 */

package edu.stanford.smi.protege.action;

import edu.stanford.smi.protege.util.ApplicationProperties;

/**
 * Utility methods for getting/setting the configuration parameters for the export to CSV action (See {@link ExportToCsvAction}). <br>
 * The export configuration is saved in the protege.properties file, so that it is preserved
 * across different Protege sessions.
 *
 * @author Tania Tudorache <tudorache@stanford.edu>
 *
 */
public class ExportToCsvUtil {

	public static final String EXPORT_FILE_PREFIX = "_exported";
	public static final String EXPORT_FILE_EXTENSION = "csv";

	public static final String DEFAULT_SLOT_VALUES_DELIMITER = ",";
	public static final String DEFAULT_SLOTS_DELIMITER = "\\t";

	public static final String SLOTS_DELIMITER_PROPERTY = "query.export.slots.delimiter";
	public static final String SLOT_VALUES_DELIMITER_PROPERTY = "query.export.slot.values.delimiter";
	public static final String EXPORT_FILE_PREFIX_PROPERTY = "query.export.file.prefix";
	public static final String EXPORT_FILE_EXTENSION_PROPERTY = "query.export.file.extension";
	public static final String EXPORT_BROWSER_TEXT_PROPERTY = "query.export.browser.text";
	public static final String EXPORT_METADATA_PROPERTY = "query.export.metadata";

	public static String getSlotValuesDelimiter() {
		return ApplicationProperties.getString(SLOT_VALUES_DELIMITER_PROPERTY, DEFAULT_SLOT_VALUES_DELIMITER);
	}

	public static void setSlotValuesDelimiter(String slotValuesDelimiter) {
		ApplicationProperties.setString(SLOT_VALUES_DELIMITER_PROPERTY, slotValuesDelimiter);
	}


	public static String getSlotsDelimiter() {
		return ApplicationProperties.getString(SLOTS_DELIMITER_PROPERTY, DEFAULT_SLOTS_DELIMITER);
	}

	public static void setSlotsDelimiter(String slotsDelimiter) {
		ApplicationProperties.setString(SLOTS_DELIMITER_PROPERTY, slotsDelimiter);
	}


	public static boolean isExportBrowserTextEnabled() {
		return ApplicationProperties.getBooleanProperty(EXPORT_BROWSER_TEXT_PROPERTY, true);
	}

	public static void setExportBrowserText(boolean exportBrowserText) {
		ApplicationProperties.setBoolean(EXPORT_BROWSER_TEXT_PROPERTY, exportBrowserText);
	}


	public static boolean isExportMetadata() {
		return ApplicationProperties.getBooleanProperty(EXPORT_METADATA_PROPERTY, false);
	}

	public static void setExportMetadata(boolean exportQuery) {
		ApplicationProperties.setBoolean(EXPORT_METADATA_PROPERTY, exportQuery);
	}

	/*
	 * Other getter/setter methods can be added if necessary
	 */

}
