Search in sources :

Example 21 with NodeGroup

use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.

the class GroupHelper method getListConceptGroup.

/**
 * Permet de retourner une ArrayList de NodeConceptGroup par langue et par
 * thésaurus / ou null si rien cette fonction ne retourne pas les détails et
 * les traductions Si le Domaine n'est pas traduit dans la langue en cours,
 * on récupère l'identifiant pour l'afficher à la place
 *
 * @param ds le pool de connexion
 * @param idThesaurus
 * @param idLang
 * @return Objet Class ArrayList NodeConceptGroup
 */
public ArrayList<NodeGroup> getListConceptGroup(HikariDataSource ds, String idThesaurus, String idLang) {
    ArrayList<NodeGroup> nodeConceptGroupList;
    ArrayList tabIdConceptGroup = getListIdOfGroup(ds, idThesaurus);
    nodeConceptGroupList = new ArrayList<>();
    for (Object tabIdGroup1 : tabIdConceptGroup) {
        NodeGroup nodeConceptGroup;
        nodeConceptGroup = getThisConceptGroup(ds, tabIdGroup1.toString(), idThesaurus, idLang);
        if (nodeConceptGroup == null) {
            return null;
        }
        nodeConceptGroupList.add(nodeConceptGroup);
    }
    return nodeConceptGroupList;
}
Also used : ArrayList(java.util.ArrayList) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 22 with NodeGroup

use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.

the class GroupHelper method getGroupTraductionsHistoriqueAll.

/**
 * Cette fonction permet de récupérer l'historique des traductions d'un
 * groupe
 *
 * @param ds
 * @param idGroup
 * @param idThesaurus
 * @param lang
 * @return
 */
public ArrayList<NodeGroup> getGroupTraductionsHistoriqueAll(HikariDataSource ds, String idGroup, String idThesaurus, String lang) {
    Connection conn;
    Statement stmt;
    ArrayList<NodeGroup> nodeGroupList = null;
    try {
        // Get connection from pool
        conn = ds.getConnection();
        try {
            stmt = conn.createStatement();
            try {
                String query = "select lexicalvalue, modified, idgroup, username from concept_group_label_historique, users " + "where id = '" + idGroup + "'" + " and lang = '" + lang + "'" + " and idthesaurus = '" + idThesaurus + "'" + " and concept_group_label_historique.id_user=users.id_user" + "' order by modified DESC";
                ResultSet resultSet = stmt.executeQuery(query);
                if (resultSet != null) {
                    nodeGroupList = new ArrayList<>();
                    while (resultSet.next()) {
                        NodeGroup nodeGroup = new NodeGroup();
                        nodeGroup.getConceptGroup().setIdgroup(idGroup);
                        nodeGroup.setIdUser(resultSet.getString("username"));
                        nodeGroup.setModified(resultSet.getDate("modified"));
                        nodeGroup.getConceptGroup().setId(resultSet.getInt("idgroup"));
                        nodeGroup.getConceptGroup().setIdthesaurus(idThesaurus);
                        nodeGroup.setLexicalValue(resultSet.getString("lexicalvalue"));
                        nodeGroup.setIdLang(lang);
                        nodeGroupList.add(nodeGroup);
                    }
                }
            } finally {
                stmt.close();
            }
        } finally {
            conn.close();
        }
    } catch (SQLException sqle) {
        // Log exception
        log.error("Error while getting All traductions historique of group : " + idGroup, sqle);
    }
    return nodeGroupList;
}
Also used : SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 23 with NodeGroup

use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.

the class GroupHelper method getGroupTraductionsHistoriqueFromDate.

/**
 * Cette fonction permet de récupérer l'historique des traductions d'un
 * groupe à une date précise
 *
 * @param ds
 * @param idGroup
 * @param idThesaurus
 * @param lang
 * @param date
 * @return
 */
public ArrayList<NodeGroup> getGroupTraductionsHistoriqueFromDate(HikariDataSource ds, String idGroup, String idThesaurus, String lang, Date date) {
    Connection conn;
    Statement stmt;
    ArrayList<NodeGroup> nodeGroupList = null;
    try {
        // Get connection from pool
        conn = ds.getConnection();
        try {
            stmt = conn.createStatement();
            try {
                String query = "select lexicalvalue, modified, idgroup, username from concept_group_label_historique, users " + "where id = '" + idGroup + "'" + " and lang = '" + lang + "'" + " and idthesaurus = '" + idThesaurus + "'" + " and concept_group_label_historique.id_user=users.id_user" + " and modified <= '" + date.toString() + "' order by modified DESC";
                ResultSet resultSet = stmt.executeQuery(query);
                if (resultSet != null) {
                    nodeGroupList = new ArrayList<>();
                    while (resultSet.next()) {
                        NodeGroup nodeGroup = new NodeGroup();
                        nodeGroup.getConceptGroup().setIdgroup(idGroup);
                        nodeGroup.setIdUser(resultSet.getString("username"));
                        nodeGroup.setModified(resultSet.getDate("modified"));
                        nodeGroup.getConceptGroup().setId(resultSet.getInt("idgroup"));
                        nodeGroup.getConceptGroup().setIdthesaurus(idThesaurus);
                        nodeGroup.setLexicalValue(resultSet.getString("lexicalvalue"));
                        nodeGroup.setIdLang(lang);
                        nodeGroupList.add(nodeGroup);
                    }
                }
            } finally {
                stmt.close();
            }
        } finally {
            conn.close();
        }
    } catch (SQLException sqle) {
        // Log exception
        log.error("Error while getting date traductions historique of group : " + idGroup, sqle);
    }
    return nodeGroupList;
}
Also used : SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 24 with NodeGroup

use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.

the class SelectedCandidat method showGroup.

/**
 * permet de récupérer les Groups du concept sur lequel il faut accrocher le candidat
 * @param np
 */
private void showGroup(NodeProposition np) {
    boolean first = true;
    ArrayList<NodeGroup> nodeGroups = new GroupHelper().getListGroupOfConcept(connect.getPoolConnexion(), idTheso, np.getIdConceptParent(), langueTheso);
    for (NodeGroup nodeGroup : nodeGroups) {
        if (first) {
            domaine = nodeGroup.getLexicalValue();
            first = false;
        } else {
            domaine = domaine + "; " + nodeGroup.getLexicalValue();
        }
    }
}
Also used : GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 25 with NodeGroup

use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.

the class SelectedCandidat method setLevelInfos.

/**
 * permet d'initialiser les Groupes pour le niveau de concept sélectionné dans le thésauurus
 * @param idConcept
 * @param idLang
 * @return
 */
private boolean setLevelInfos(String idConcept, String idLang) {
    GroupHelper groupHelper = new GroupHelper();
    ArrayList<NodeGroup> nodeGroups = groupHelper.getListGroupOfConcept(connect.getPoolConnexion(), idTheso, idConcept, idLang);
    if (nodeGroups == null)
        return false;
    String tmp = "";
    boolean first = true;
    for (NodeGroup nodeGroup : nodeGroups) {
        if (!first)
            tmp = tmp + "; ";
        tmp = tmp + nodeGroup.getLexicalValue();
        first = false;
    }
    selectedNvx.setGroupLexicalValue(tmp);
    return true;
}
Also used : GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Aggregations

NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)29 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)18 ArrayList (java.util.ArrayList)8 Connection (java.sql.Connection)7 PreparedStatement (java.sql.PreparedStatement)7 ResultSet (java.sql.ResultSet)7 SQLException (java.sql.SQLException)7 Statement (java.sql.Statement)7 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)5 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)4 ConceptGroup (mom.trd.opentheso.bdd.datas.ConceptGroup)3 StatisticHelper (mom.trd.opentheso.bdd.helper.StatisticHelper)2 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)2 NodeLang (mom.trd.opentheso.bdd.helper.nodes.NodeLang)2 NodeThesaurus (mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)2 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)2 TreeNode (org.primefaces.model.TreeNode)2 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 FacesMessage (javax.faces.application.FacesMessage)1