IDEMPIERE-2871 Import CSV process not returning log file when run via web services

This commit is contained in:
Diego Ruiz 2015-09-30 13:22:57 +02:00
parent 9a464977a4
commit 16791faf20
2 changed files with 23 additions and 4 deletions

View File

@ -46,6 +46,7 @@ import org.compiere.model.GridTab;
import org.compiere.model.GridWindow;
import org.compiere.model.MImportTemplate;
import org.compiere.model.MLookup;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.Env;
@ -144,6 +145,11 @@ public class ImportCSVProcess extends SvrProcess implements DataStatusListener {
if (processUI != null)
processUI.download(outFile);
else if( getProcessInfo() != null ){
ProcessInfo m_pi = getProcessInfo();
m_pi.setExportFile(outFile);
m_pi.setExportFileExtension("csv");
}
m_file_istream.close();
}

View File

@ -364,10 +364,23 @@ public class Process {
}
else
{
r.setSummary(pi.getSummary());
r.setError(pi.getSummary());
r.setLogInfo(pi.getLogInfo(true));
r.setIsError( false );
try{
if( pi.getExportFile() != null ){
r.setData(java.nio.file.Files.readAllBytes(pi.getExportFile().toPath()));
r.setReportFormat(pi.getExportFileExtension());
}
r.setSummary(pi.getSummary());
r.setError(pi.getSummary());
r.setLogInfo(pi.getLogInfo(true));
r.setIsError( false );
}
catch (Exception e)
{
r.setError("Cannot get the export file:" + e.getMessage());
r.setLogInfo(pi.getLogInfo(true) );
r.setIsError( true );
return res;
}
}
}