Search in sources :

Example 6 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class WriteFileSKOS_Frantiq method writeThesaurus.

public boolean writeThesaurus(NodeThesaurus nodeThesaurus) {
    // Ecriture de la balise de declaration du thesaurus
    String xml = "    <skos:ConceptScheme rdf:about=\"" + URI + "idt=" + nodeThesaurus.getIdThesaurus() + "\">\n";
    // balises DublinCore pour le libellé du thésaurus
    for (Thesaurus listThesaurusTraduction : nodeThesaurus.getListThesaurusTraduction()) {
        if (!listThesaurusTraduction.getTitle().trim().isEmpty()) {
            xml += "        <dc:title xml:lang=";
            xml += "\"" + listThesaurusTraduction.getLanguage() + "\">";
            xml += listThesaurusTraduction.getTitle();
            xml += "</dc:title>";
            xml += "\n";
        }
    }
    skosBuff.append(xml);
    return true;
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) NodeThesaurus(mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)

Example 7 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class SelectedThesaurus method getThisTheso.

/**
 * *************************************** AUTRE
 * ****************************************
 */
/**
 * Récupère le thésaurus courant
 *
 * @return le thésaurus s'il existe, null sinon
 */
public Thesaurus getThisTheso() {
    String idTemp = "", lTemp = "";
    if (thesaurus == null || thesaurus.getLanguage() == null || thesaurus.getId_thesaurus() == null) {
        return null;
    }
    if (thesaurus.getLanguage() != null) {
        lTemp = thesaurus.getLanguage();
    }
    if (thesaurus.getId_thesaurus() != null) {
        idTemp = thesaurus.getId_thesaurus();
    }
    Thesaurus tempT = new ThesaurusHelper().getThisThesaurus(connect.getPoolConnexion(), idTemp, lTemp);
    return tempT;
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper)

Example 8 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class showPermuted method loadStatPermuted.

public void loadStatPermuted(String idTheso, String idLange) throws SQLException {
    Thesaurus datatheso = new Thesaurus();
    Connexion conn = new Connexion();
    String id_theso = datatheso.getId_thesaurus();
    String langue = datatheso.getLanguage();
    statTheso = new ArrayList<>();
    ArrayList<NodeGroup> lng = new GroupHelper().getListConceptGroup2(connect.getPoolConnexion(), idTheso, idLange);
    StatisticHelper sh = new StatisticHelper();
    for (NodeGroup ng : lng) {
        prendrePermuted nst = new prendrePermuted();
        nst.setOrd(ng.getOrde());
        nst.setId_concept(ng.getId_concept());
        nst.setId_group(ng.getId_group());
        nst.setId_theso(idTheso);
        nst.setId_lang(idLange);
        nst.setLexical_value(ng.getLexicalValue());
        nst.setIspreferredterm(ng.isIspreferredterm());
        nst.setOriginal_value(ng.getOriginal_value());
        statTheso.add(nst);
    }
    vue.setStatPermuted(true);
    vue.setStatTheso(false);
    vue.setStatCpt(false);
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) StatisticHelper(mom.trd.opentheso.bdd.helper.StatisticHelper) Connexion(mom.trd.opentheso.bdd.helper.Connexion) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup) mom.trd.opentheso.core.exports.privatesdatas.prendrePermuted(mom.trd.opentheso.core.exports.privatesdatas.prendrePermuted)

Example 9 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class AccessThesaurusHelper method getAThesaurus.

/**
 * Fonction getAThesaurus
 * #JM
 * permet de récupérer un thésaurus d'après son identifiant
 * @param ds
 * @param idTheso
 * @param idLang
 * @return
 */
public Thesaurus getAThesaurus(HikariDataSource ds, String idTheso, String idLang) {
    Connection conn;
    PreparedStatement stmt;
    Thesaurus th = new Thesaurus();
    ResultSet rs;
    try {
        conn = ds.getConnection();
        try {
            String sql = "SELECT *  FROM thesaurus INNER JOIN thesaurus_label ON thesaurus.id_thesaurus=thesaurus_label.id_thesaurus WHERE thesaurus.id_thesaurus=? AND lang=?";
            stmt = conn.prepareStatement(sql);
            stmt.setString(1, idTheso);
            stmt.setString(2, idLang);
            try {
                rs = stmt.executeQuery();
                if (rs.next()) {
                    th.setContributor(rs.getString("contributor"));
                    th.setCoverage(rs.getString("coverage"));
                    th.setCreated(rs.getDate("created"));
                    th.setCreator(rs.getString("creator"));
                    th.setDescription(rs.getString("description"));
                    th.setFormat(rs.getString("format"));
                    th.setId_ark(rs.getString("id_ark"));
                    th.setId_thesaurus(rs.getString("id_thesaurus"));
                    th.setLanguage(rs.getString("lang"));
                    th.setModified(rs.getDate("modified"));
                    th.setPublisher(rs.getString("publisher"));
                    th.setRelation(rs.getString("relation"));
                    th.setRights(rs.getString("rights"));
                    th.setSource(rs.getString("source"));
                    th.setSubject(rs.getString("subject"));
                    th.setTitle(rs.getString("title"));
                    th.setType(rs.getString("type"));
                    th.setVisibility(rs.getBoolean("private"));
                } else {
                    log.error("la requete n'a pas trouver de thesaurus associé à l'idenitifiant");
                }
            } finally {
                stmt.close();
            }
        } finally {
            conn.close();
        }
    } catch (SQLException e) {
        log.error("error while retrieving a thesaurus from the bdd " + th.toString(), e);
    }
    return th;
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 10 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class BaseDeDonnesBean method pdf.

/**
 * permet de generer une document pour pouvoir le telecharger
 * le format c'est pdf
 * @return
 * @throws SQLException
 * @throws Exception
 */
public StreamedContent pdf() throws SQLException, Exception {
    Thesaurus thesaurus = new Thesaurus();
    ExportStatistiques expo = new ExportStatistiques();
    expo.recuperatefils(connect.getPoolConnexion(), theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage(), 2);
    Document pdf = new Document(PageSize.LETTER);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter writer;
    Paragraph para = new Paragraph(expo.getDocument());
    writer = PdfWriter.getInstance(pdf, baos);
    if (!pdf.isOpen()) {
        pdf.open();
    }
    pdf.addTitle("theso");
    pdf.add(para);
    // Adding content to pdf
    pdf.close();
    InputStream stream = new ByteArrayInputStream(baos.toByteArray());
    fileDownload = new DefaultStreamedContent(stream, "application/pdf", "Thésaurus" + thesaurus.getId_thesaurus() + ".pdf");
    return fileDownload;
}
Also used : DefaultStreamedContent(org.primefaces.model.DefaultStreamedContent) PdfWriter(com.itextpdf.text.pdf.PdfWriter) Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) ByteArrayInputStream(java.io.ByteArrayInputStream) ExportStatistiques(mom.trd.opentheso.core.exports.helper.ExportStatistiques) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Document(com.itextpdf.text.Document) Paragraph(com.itextpdf.text.Paragraph)

Aggregations

Thesaurus (mom.trd.opentheso.bdd.datas.Thesaurus)19 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)10 NodeThesaurus (mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)6 Connection (java.sql.Connection)4 SQLException (java.sql.SQLException)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 UserHelper (mom.trd.opentheso.bdd.helper.UserHelper)2 SKOSResource (mom.trd.opentheso.skosapi.SKOSResource)2 Document (com.itextpdf.text.Document)1 Paragraph (com.itextpdf.text.Paragraph)1 PdfWriter (com.itextpdf.text.pdf.PdfWriter)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 FacesMessage (javax.faces.application.FacesMessage)1 Languages_iso639 (mom.trd.opentheso.bdd.datas.Languages_iso639)1 AccessThesaurusHelper (mom.trd.opentheso.bdd.helper.AccessThesaurusHelper)1