public Response Get(string taskType, string taskName = null, string template = null, string alias = null) { CheckMinerOwnerShip(); // when exporting we dont need to know what was task type var name = taskName ?? taskType; var definition = new ExportTaskDefinition(name, template, alias); var response = new TaskResponse { OutputFilePath = this.LISpMiner.Export(definition) }; return response; }
public string Export(ExportTaskDefinition definition) { if (definition == null || string.IsNullOrEmpty(definition.TaskName)) { throw new ArgumentException("No LISpMiner instance or task defined."); } var exporter = this.CreateExporter(); try { var output = string.Format("{0}/results_{1}_{2:yyyyMMdd-Hmmss}.xml", GetDataFolder(), definition.TaskFileName, DateTime.Now); exporter.Output = output; exporter.Template = string.Format(@"{0}\Sewebar\Template\{1}", exporter.LMExecutablesPath, definition.Template); exporter.TaskName = definition.TaskName; exporter.NoEscapeSeqUnicode = true; // try to export results exporter.Execute(); if (!File.Exists(output)) { throw new LISpMinerException("Results generation did not succeed. Task possibly does not exist but no appLog generated."); } return(output); } finally { // clean up exporter.Output = String.Empty; exporter.Template = String.Empty; exporter.TaskName = String.Empty; } }