use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class TermeConverter method getAsObject.
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
if (value != null && value.trim().length() > 0) {
NodeAutoCompletion nac = new NodeAutoCompletion();
nac.setIdConcept(value);
nac.setIdGroup(value);
return nac;
} else {
return null;
}
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class GroupHelper method getAutoCompletionOtherGroup.
/**
* Cette fonction permet de récupérer la liste des domaines sauf celui en
* cours pour l'autocomplétion
*
* @param ds
* @param idThesaurus
* @param idGroup
* @param text
* @param idLang
* @return Objet class Concept
*/
public List<NodeAutoCompletion> getAutoCompletionOtherGroup(HikariDataSource ds, String idThesaurus, // le Group à ignorer
String idGroup, String idLang, String text) {
Connection conn;
Statement stmt;
ResultSet resultSet;
List<NodeAutoCompletion> nodeAutoCompletionList = null;
text = new StringPlus().convertString(text);
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT concept_group_label.idgroup," + " concept_group_label.lexicalvalue FROM concept_group_label" + " WHERE " + " concept_group_label.idthesaurus = '" + idThesaurus + "'" + " AND concept_group_label.lang = '" + idLang + "'" + " AND concept_group_label.idgroup != '" + idGroup + "'" + " AND unaccent_string(concept_group_label.lexicalvalue) ILIKE unaccent_string('" + text + "%')" + " ORDER BY concept_group_label.lexicalvalue ASC LIMIT 20";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
nodeAutoCompletionList = new ArrayList<>();
while (resultSet.next()) {
if (resultSet.getRow() != 0) {
NodeAutoCompletion nodeAutoCompletion = new NodeAutoCompletion();
nodeAutoCompletion.setIdConcept("");
nodeAutoCompletion.setTermLexicalValue("");
nodeAutoCompletion.setGroupLexicalValue(resultSet.getString("lexicalvalue"));
nodeAutoCompletion.setIdGroup(resultSet.getString("idgroup"));
nodeAutoCompletionList.add(nodeAutoCompletion);
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting List of autocompletion of Text : " + text, sqle);
}
return nodeAutoCompletionList;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class GroupHelper method getAutoCompletionGroup.
/**
* Cette fonction permet de récupérer la liste des domaines pour
* l'autocomplétion
*
* @param ds
* @param idThesaurus
* @param text
* @param idLang
* @return Objet class Concept
*/
public List<NodeAutoCompletion> getAutoCompletionGroup(HikariDataSource ds, String idThesaurus, String idLang, String text) {
Connection conn;
Statement stmt;
ResultSet resultSet;
List<NodeAutoCompletion> nodeAutoCompletionList = null;
text = new StringPlus().convertString(text);
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT concept_group_label.idgroup," + " concept_group_label.lexicalvalue FROM concept_group_label" + " WHERE " + " concept_group_label.idthesaurus = '" + idThesaurus + "'" + " AND concept_group_label.lang = '" + idLang + "'" + " AND unaccent_string(concept_group_label.lexicalvalue) ILIKE unaccent_string('" + text + "%')" + " ORDER BY concept_group_label.lexicalvalue ASC LIMIT 20";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
nodeAutoCompletionList = new ArrayList<>();
while (resultSet.next()) {
if (resultSet.getRow() != 0) {
NodeAutoCompletion nodeAutoCompletion = new NodeAutoCompletion();
nodeAutoCompletion.setIdConcept("");
nodeAutoCompletion.setTermLexicalValue("");
nodeAutoCompletion.setGroupLexicalValue(resultSet.getString("lexicalvalue"));
nodeAutoCompletion.setIdGroup(resultSet.getString("idgroup"));
nodeAutoCompletionList.add(nodeAutoCompletion);
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting List of autocompletion of Text : " + text, sqle);
}
return nodeAutoCompletionList;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class SelectedCandidat method editMyProp.
/**
* Permet d'éditer sa propre proposition
*
* @param langue
*/
public void editMyProp(String langue) {
if (selectedNvx != null) {
niveauEdit = selectedNvx.getIdConcept();
} else {
niveauEdit = "";
}
if (domaineEdit == null) {
domaineEdit = "";
}
new CandidateHelper().updatePropositionCandidat(connect.getPoolConnexion(), selected.getIdConcept(), theUser.getUser().getId(), idTheso, noteEdit, niveauEdit, domaineEdit);
NodeProposition np = new CandidateHelper().getNodePropositionOfUser(connect.getPoolConnexion(), selected.getIdConcept(), idTheso, infoCdt.getNodesUser().get(0).getId());
infoCdt.setNodesUser(new CandidateHelper().getListUsersOfCandidat(connect.getPoolConnexion(), selected.getIdConcept(), idTheso));
note = np.getNote();
niveau = new ConceptHelper().getLexicalValueOfConcept(connect.getPoolConnexion(), np.getIdConceptParent(), idTheso, langue) + " (" + np.getIdConceptParent() + ")";
domaine = new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), np.getIdGroup(), idTheso, langue) + " (" + np.getIdGroup() + ")";
vue.setEditPropCandidat(false);
selectedNvx = new NodeAutoCompletion();
domaineEdit = "";
niveauEdit = "";
noteEdit = "";
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sCdt.info8")));
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class TermHelper method getAutoCompletionTerm.
/**
* Cette fonction permet de récupérer une liste des terms pour
* l'autocomplétion en se limitant à un Group et en ignorant le terme lui
* même et ses BT
*
* @param ds
* @param idSelectedConcept
* @param idBTs
* @param idThesaurus
* @param text
* @param idGroup
* @param idLang
* @return Objet class Concept
*/
public List<NodeAutoCompletion> getAutoCompletionTerm(HikariDataSource ds, // le concept à ignorer
String idSelectedConcept, // le concept à ignorer
ArrayList<String> idBTs, String idThesaurus, String idLang, String idGroup, String text) {
Connection conn;
Statement stmt;
ResultSet resultSet;
List<NodeAutoCompletion> nodeAutoCompletionList = new ArrayList<>();
text = new StringPlus().convertString(text);
String BT = "";
for (String idBt : idBTs) {
if (!BT.isEmpty()) {
BT = BT + ",'" + idBt + "'";
} else {
BT = "'" + idBt + "'";
}
}
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT DISTINCT term.lexical_value, concept.id_concept, idgroup " + "FROM preferred_term, term, concept,concept_group_concept WHERE " + "preferred_term.id_term = term.id_term AND " + "concept_group_concept.idconcept = concept.id_concept AND " + "concept_group_concept.idthesaurus = term.id_thesaurus" + "preferred_term.id_thesaurus = term.id_thesaurus AND " + "concept.id_concept = preferred_term.id_concept AND " + "concept.id_thesaurus = preferred_term.id_thesaurus AND " + "term.id_thesaurus = '" + idThesaurus + "' AND " + "term.lang = '" + idLang + "' AND " + "concept_group_concept.idgroup = '" + idGroup + "' AND " + "concept.id_concept != '" + idSelectedConcept + "' AND " + "concept.id_concept not in (" + BT + ") AND " + "concept.status != 'hidden' AND " + "unaccent_string(term.lexical_value) ILIKE unaccent_string('" + text + "%')" + " ORDER BY term.lexical_value ASC LIMIT 20";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
while (resultSet.next()) {
if (resultSet.getRow() != 0) {
NodeAutoCompletion nodeAutoCompletion = new NodeAutoCompletion();
nodeAutoCompletion.setIdConcept(resultSet.getString("id_concept"));
nodeAutoCompletion.setTermLexicalValue(resultSet.getString("lexical_value"));
nodeAutoCompletion.setGroupLexicalValue(new GroupHelper().getLexicalValueOfGroup(ds, resultSet.getString("idgroup"), idThesaurus, idLang));
nodeAutoCompletion.setIdGroup(resultSet.getString("idgroup"));
// if(!nodeAutoCompletionList.contains(nodeAutoCompletion))
nodeAutoCompletionList.add(nodeAutoCompletion);
}
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting List of autocompletion of Text : " + text, sqle);
}
return nodeAutoCompletionList;
}
Aggregations