use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeMessageAdmin in project opentheso by miledrousset.
the class CandidateHelper method getMessageAdmin.
/**
* Cette fonction permet de retourner le nombre de candidats d'un concept
*
* @param ds
* @param idConcept
* @param idThesaurus
* @return Objet class NodeMessageAdmin
*/
public NodeMessageAdmin getMessageAdmin(HikariDataSource ds, String idThesaurus, String idConcept) {
Connection conn;
Statement stmt;
ResultSet resultSet;
NodeMessageAdmin nodeMessageAdmin = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT users.username, users.id_user," + " concept_candidat.admin_message" + " FROM concept_candidat, users WHERE" + " concept_candidat.admin_id = users.id_user" + " and concept_candidat.id_concept = '" + idConcept + "'" + " and concept_candidat.id_thesaurus = '" + idThesaurus + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet.next()) {
nodeMessageAdmin = new NodeMessageAdmin();
nodeMessageAdmin.setId_user(resultSet.getInt("id_user"));
nodeMessageAdmin.setUser(resultSet.getString("username"));
nodeMessageAdmin.setMessage(resultSet.getString("admin_message"));
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting Admin Message of candidat : " + idConcept, sqle);
}
return nodeMessageAdmin;
}
use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeMessageAdmin in project opentheso by miledrousset.
the class SelectedCandidat method maj.
/**
* $$$$$$$$$ fonction à revoir, trop de connection, à optimiser $$$$$$$$$
*/
/**
* Récupération des informations d'un candidat lors de sa sélection dans la
* table des candidats
*
* @param theso
* @param langue
*/
public void maj(String theso, String langue) {
// if(theso == null) return;
idTheso = theso;
langueTheso = langue;
infoCdt.setNodesUser(new CandidateHelper().getListUsersOfCandidat(connect.getPoolConnexion(), selected.getIdConcept(), theso));
infoCdt.setNodeTraductions(new CandidateHelper().getNodeTraductionCandidat(connect.getPoolConnexion(), selected.getIdConcept(), idTheso, langue));
nomsProp = new ArrayList<>();
if (infoCdt.getNodesUser().isEmpty())
reInit();
for (NodeUser nuse : infoCdt.getNodesUser()) {
nomsProp.add(nuse.getName());
}
if (selected.getIdConcept() != null && !selected.getIdConcept().isEmpty() && !infoCdt.getNodesUser().isEmpty()) {
NodeProposition np = new CandidateHelper().getNodePropositionOfUser(connect.getPoolConnexion(), selected.getIdConcept(), theso, infoCdt.getNodesUser().get(0).getId());
if (np == null) {
// erreur
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error-BDD")));
return;
}
note = np.getNote();
niveau = new ConceptHelper().getLexicalValueOfConcept(connect.getPoolConnexion(), np.getIdConceptParent(), idTheso, langue) + " (" + np.getIdConceptParent() + ")";
if (!np.getIdConceptParent().isEmpty()) {
niveau = new ConceptHelper().getLexicalValueOfConcept(connect.getPoolConnexion(), np.getIdConceptParent(), idTheso, langueTheso) + " (" + np.getIdConceptParent() + ")";
showGroup(np);
// domaine = new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), np.getIdGroup(), idTheso, langueTheso) + " (" + np.getIdGroup() + ")";
}
modifiedProposition = np.getModified();
createdProposition = np.getCreated();
if (selected.getEtat().equals("r") || selected.getEtat().equals("v") || selected.getEtat().equals("i")) {
msgAdm = new CandidateHelper().getMessageAdmin(connect.getPoolConnexion(), idTheso, selected.getIdConcept());
} else {
msgAdm = new NodeMessageAdmin();
}
}
}
Aggregations