Search in sources :

Example 1 with ExportThesaurus

use of mom.trd.opentheso.core.exports.helper.ExportThesaurus in project opentheso by miledrousset.

the class DownloadBean method getAllAltLabels.

public StreamedContent getAllAltLabels(String idTheso, String codeLang) {
    progress_per_100 = 0;
    progress_abs = 0;
    ExportThesaurus exportThesaurus = new ExportThesaurus();
    StringBuilder stringBuilder = exportThesaurus.exportAltLabel(connect.getPoolConnexion(), idTheso, codeLang);
    if (stringBuilder == null)
        return null;
    InputStream stream;
    try {
        stream = new ByteArrayInputStream(stringBuilder.toString().getBytes("UTF-8"));
        file = new DefaultStreamedContent(stream, "text/csv", "AltLabels_" + idTheso + ".csv");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(DownloadBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return file;
}
Also used : DefaultStreamedContent(org.primefaces.model.DefaultStreamedContent) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ExportThesaurus(mom.trd.opentheso.core.exports.helper.ExportThesaurus) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ExportThesaurus (mom.trd.opentheso.core.exports.helper.ExportThesaurus)1 DefaultStreamedContent (org.primefaces.model.DefaultStreamedContent)1