
prerna.sablecc2.om.task.ConstantDataTask Maven / Gradle / Ivy
The newest version!
package prerna.sablecc2.om.task;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import prerna.engine.api.IHeadersDataRow;
import prerna.sablecc2.om.task.options.TaskOptions;
public class ConstantDataTask extends AbstractTask {
private transient Object outputData;
private Map formatMap;
/**
* Collect data from an iterator
* Or return defined outputData
*/
@Override
public Map collect(boolean meta) {
Map collectedData = new HashMap(7);
collectedData.put("data", outputData);
if(meta) {
collectedData.put("format", getFormatMap());
TaskOptions thisTaskOptions = getTaskOptions();
if(thisTaskOptions != null) {
collectedData.put("taskOptions", thisTaskOptions.getOptions());
} else {
collectedData.put("taskOptions", new HashMap());
}
collectedData.put("headerInfo", getHeaderInfo());
collectedData.put("sortInfo", getSortInfo());
collectedData.put("filterInfo", getFilterInfo());
}
collectedData.put("taskId", this.id);
collectedData.put("numCollected", this.numCollect);
return collectedData;
}
public void setOutputData(Object outputData) {
this.outputData = outputData;
}
public Object getOutputData() {
return this.outputData;
}
protected Map getFormatMap() {
if(this.formatMap == null) {
formatMap = new HashMap();
if(this.formatter == null) {
formatMap.put("type", "Custom Task Output");
} else {
formatMap.put("type", formatter.getFormatType());
}
}
return formatMap;
}
public void setFormatMap(Map formatMap) {
this.formatMap = formatMap;
}
/*
* Bottom methods are not important
* This is just so I can have operations
* Return data as if it was a "Task"
*/
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy