All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prerna.query.querystruct.AbstractFileQueryStruct Maven / Gradle / Ivy

The newest version!
package prerna.query.querystruct;

import java.util.HashMap;
import java.util.Map;

public abstract class AbstractFileQueryStruct extends SelectQueryStruct {

	public enum ORIG_SOURCE {FILE_UPLOAD, API_CALL}
	
	protected ORIG_SOURCE source = ORIG_SOURCE.FILE_UPLOAD;

	protected String filePath;
	protected Map newHeaderNames = new HashMap();
	protected Map columnTypes = new HashMap();
	protected Map additionalTypes = new HashMap();
	
	/**
	 * Utility to set the column types for a file
	 * @param colNames
	 * @param colTypes
	 */
	public void setSelectorsAndTypes(String[] colNames, String[] colTypes) {
		this.columnTypes = new HashMap();
		int numCols = colNames.length;
		for(int i = 0; i < numCols; i++) {
			this.addSelector("FILE", colNames[i]);
			this.columnTypes.put(colNames[i], colTypes[i]);
		}
	}
	
	/*
	 * Setters and Getters
	 */
	
	public ORIG_SOURCE getSource() {
		return source;
	}
	
	public void setSource(ORIG_SOURCE source) {
		this.source = source;
	}
	
	public String getFilePath() {
		return filePath;
	}
	
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	
	public Map getNewHeaderNames() {
		return newHeaderNames;
	}
	
	public void setNewHeaderNames(Map newHeaderNames) {
		this.newHeaderNames = newHeaderNames;
	}

	public Map getColumnTypes() {
		return columnTypes;
	}
	
	public void setColumnTypes(Map columnTypes) {
		this.columnTypes = columnTypes;
	}
	
	public Map getAdditionalTypes() {
		return additionalTypes;
	}
	
	public void setAdditionalTypes(Map additionalTypes) {
		this.additionalTypes = additionalTypes;
	}
	
	@Override
	public Map getSourceMap() {
		Map sourceMap = new HashMap();
		sourceMap.put("type", this.qsType.toString());
		sourceMap.put("id", this.filePath);
		return sourceMap;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy