public TransactionResult runQuery(EntityManager em) throws IOException {
Submit sb = Submit.getById(em, id);
if (sb == null) {
return TransactionResult.NONE;
}
SnapshotManager sm = SnapshotManager.loadSnapshot(sb.getLogfileId());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
sm.save(dos);
dos.close();
String additionalS = "";
if(sm.hasNpssContent()){
additionalS = "s";
}
response.setContentType("application/x-nps"+additionalS);
String fileName = String.format("snapshot-%1$s.nps", id.toString());
response.setHeader( "Content-Disposition", "attachment; filename=" + fileName+additionalS);