use of mom.trd.opentheso.core.exports.helper.ExportTxtHelper in project opentheso by miledrousset.
the class DownloadBean method thesoTxtCsv.
/**
* Permet d'exporter le thésauurus au format txt (tabulé et hiérarchisé)
* avec des options de colonnes supplémentaires NT, BT, RT, Notes, traductions
* ceci figure dans le tableau (String[] selectedOptions)
* @param idTheso
* @param selectedGroups
* @param codeLang
* @param selectedOptions
* @return
* MR
*/
public StreamedContent thesoTxtCsv(String idTheso, List<NodeGroup> selectedGroups, String codeLang, ArrayList<String> selectedOptions) {
progress_per_100 = 0;
progress_abs = 0;
NodePreference nodePreference = new PreferencesHelper().getThesaurusPreference(connect.getPoolConnexion(), idTheso);
if (nodePreference == null)
return null;
ExportTxtHelper exportTxtHelper = new ExportTxtHelper();
exportTxtHelper.setThesaurusDatas(connect.getPoolConnexion(), idTheso, codeLang, selectedGroups, nodePreference, selectedOptions);
exportTxtHelper.exportToTxtCsv();
InputStream stream;
try {
stream = new ByteArrayInputStream(exportTxtHelper.getTxtBuff().toString().getBytes("UTF-8"));
file = new DefaultStreamedContent(stream, "text/csv", "Txt_" + idTheso + ".csv");
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(DownloadBean.class.getName()).log(Level.SEVERE, null, ex);
}
return file;
}
Aggregations