Search in sources :

Example 1 with ExportFromBDD_Frantiq

use of mom.trd.opentheso.core.exports.old.ExportFromBDD_Frantiq in project opentheso by miledrousset.

the class DownloadBean method thesoSkosFrantiq.

/**
 * Cette fonction permet d'exporter un thésaurus au format SKOS à partir de
 * son identifiant. Le résultat est enregistré dans la variable 'skos' du
 * downloadBean si la taille est petite, ou dans la variable 'file' du
 * downloadBean sinon. Dans le premier cas on affiche la variable, dans le
 * second cas l'utilisateur télécharge de fichier.
 *
 * @param idTheso
 */
public void thesoSkosFrantiq(String idTheso) {
    /**
     * Cette initialisation est pour exporter les PACTOLS au format accepté
     * par Koha
     */
    ExportFromBDD_Frantiq exportFromBDD = new ExportFromBDD_Frantiq();
    /**
     * ici c'est la classe à utiliser pour un export standard au foramt SKOS
     */
    // ExportFromBDD exportFromBDD = new ExportFromBDD();
    exportFromBDD.setServerAdress(serverAdress);
    exportFromBDD.setServerArk(serverArk);
    exportFromBDD.setArkActive(arkActive);
    StringBuffer temp = exportFromBDD.exportThesaurus(connect.getPoolConnexion(), idTheso);
    if (temp.length() <= 1500000) {
        skos = temp.toString();
        vue.setThesoToSkosCsv(true);
    } else {
        InputStream stream;
        try {
            stream = new ByteArrayInputStream(temp.toString().getBytes("UTF-8"));
            file = new DefaultStreamedContent(stream, "application/xml ", "downloadedSkos.xml");
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(DownloadBean.class.getName()).log(Level.SEVERE, null, ex);
        }
        vue.setThesoToSkosCsvFile(true);
    }
}
Also used : DefaultStreamedContent(org.primefaces.model.DefaultStreamedContent) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ExportFromBDD_Frantiq(mom.trd.opentheso.core.exports.old.ExportFromBDD_Frantiq)

Example 2 with ExportFromBDD_Frantiq

use of mom.trd.opentheso.core.exports.old.ExportFromBDD_Frantiq in project opentheso by miledrousset.

the class TimerExportThesaurus method export.

public void export() {
    ExportFromBDD_Frantiq exportFromBDD_Frantiq = new ExportFromBDD_Frantiq();
    exportFromBDD_Frantiq.setServerAdress(prefs.getProperty("serverAdress"));
    exportFromBDD_Frantiq.setServerArk(prefs.getProperty("serverArk"));
    if ("true".equals(prefs.getProperty("arkActive"))) {
        exportFromBDD_Frantiq.setArkActive(true);
    } else
        exportFromBDD_Frantiq.setArkActive(false);
    StringBuffer stringBuffer = exportFromBDD_Frantiq.exportThesaurus(ds, "1");
// System.out.println(stringBuffer);
}
Also used : ExportFromBDD_Frantiq(mom.trd.opentheso.core.exports.old.ExportFromBDD_Frantiq)

Aggregations

ExportFromBDD_Frantiq (mom.trd.opentheso.core.exports.old.ExportFromBDD_Frantiq)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 DefaultStreamedContent (org.primefaces.model.DefaultStreamedContent)1