use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition in project opentheso by miledrousset.
the class CandidateHelper method getNodePropositionOfUser.
/**
* Permet de retourner une ArrayList de NodeConceptCandidat par thésaurus Si
* le Candidat 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 idConcept
* @param idThesaurus
* @param idUser
* @return Objet Class ArrayList NodeProposition
*/
public NodeProposition getNodePropositionOfUser(HikariDataSource ds, String idConcept, String idThesaurus, int idUser) {
Connection conn;
Statement stmt;
ResultSet resultSet;
NodeProposition nodeProposition = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT proposition.id_user," + " users.username, proposition.note," + " proposition.created," + " proposition.modified," + " proposition.concept_parent," + " proposition.id_group" + " FROM proposition, users WHERE " + " proposition.id_user = users.id_user" + " and proposition.id_concept = '" + idConcept + "'" + " and proposition.id_thesaurus = '" + idThesaurus + "'" + " and proposition.id_user = " + idUser;
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
if (resultSet.next()) {
nodeProposition = new NodeProposition();
nodeProposition.setId_user(resultSet.getInt("id_user"));
nodeProposition.setUser(resultSet.getString("username"));
nodeProposition.setNote(resultSet.getString("note"));
nodeProposition.setCreated(resultSet.getDate("created"));
nodeProposition.setModified(resultSet.getDate("modified"));
nodeProposition.setIdConceptParent(resultSet.getString("concept_parent"));
nodeProposition.setIdGroup(resultSet.getString("id_group"));
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting List of node Proposition Candidats of Concept Candidat : " + idConcept, sqle);
}
return nodeProposition;
}
use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition 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();
}
}
}
use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition 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")));
}
Aggregations