use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeCandidatValue in project opentheso by miledrousset.
the class SelectedCandidat method initSelectedCandidat.
@PostConstruct
public void initSelectedCandidat() {
selected = new NodeCandidatValue();
selected.setEtat("");
selected.setIdConcept("");
selected.setValue("");
selected.setNbProp(0);
infoCdt = new NodeCandidat();
infoCdt.setNodesUser(new ArrayList<>());
infoCdt.setNodeTraductions(new ArrayList<>());
selectedNvx = new NodeAutoCompletion();
tradInsert = new ArrayList<>();
setPreferences();
nomsProp = new ArrayList<>();
}
use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeCandidatValue in project opentheso by miledrousset.
the class SelectedCandidat method reInit.
/**
* Réinitialise le candidat (tout est vide)
*/
public void reInit() {
selected = new NodeCandidatValue();
selected.setEtat("");
selected.setIdConcept("");
selected.setValue("");
selected.setNbProp(0);
infoCdt = new NodeCandidat();
infoCdt.setNodesUser(new ArrayList<>());
infoCdt.setNodeTraductions(new ArrayList<>());
selectedNvx = new NodeAutoCompletion();
note = "";
niveau = "";
domaine = "";
nomsProp = new ArrayList<>();
}
use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeCandidatValue in project opentheso by miledrousset.
the class SelectedThesaurus method creerCandidat.
/**
* Création d'un nouveau candidat avec vérification de la valeur en entrée
*/
public List<NodeCandidatValue> creerCandidat() {
if (candidat.getValueEdit() == null || candidat.getValueEdit().trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error2")));
} else if (new CandidateHelper().isCandidatExist(connect.getPoolConnexion(), candidat.getValueEdit(), thesaurus.getId_thesaurus(), thesaurus.getLanguage())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error3")));
vue.setAddCandidat(false);
String idCandidat = new CandidateHelper().getIdCandidatFromTitle(connect.getPoolConnexion(), new StringPlus().addQuotes(candidat.getValueEdit().trim()), thesaurus.getId_thesaurus());
if (idCandidat == null) {
cleanEditCandidat();
return null;
} else {
candidat.getSelected().setIdConcept(idCandidat);
vue.setAddPropCandidat(true);
// creerPropCdt();
return null;
}
} else if (new TermHelper().isTermExist(connect.getPoolConnexion(), candidat.getValueEdit(), thesaurus.getId_thesaurus(), thesaurus.getLanguage())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error4")));
} else {
String temp = candidat.getValueEdit();
if (!candidat.newCandidat(thesaurus.getId_thesaurus(), thesaurus.getLanguage())) {
return null;
}
vue.setAddCandidat(false);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("theso.info2.1") + " " + temp + " " + langueBean.getMsg("theso.info2.2")));
}
cleanEditCandidat();
List<NodeCandidatValue> candidats = new ArrayList<>();
if (thesaurus.getId_thesaurus() != null && thesaurus.getLanguage() != null && connect.getPoolConnexion() != null) {
candidats = new CandidateHelper().getListCandidatsWaiting(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
}
return candidats;
}
use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeCandidatValue in project opentheso by miledrousset.
the class CandidateHelper method getListMyCandidatsWait.
/**
* Permet de retourner une ArrayList de NodeConceptCandidat par thésaurus et
* par id_user c'est la liste des candidats en attente (status = a) 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
* @param idThesaurus
* @param idLang
* @param id_user
* @return
*/
public ArrayList<NodeCandidatValue> getListMyCandidatsWait(HikariDataSource ds, String idThesaurus, String idLang, Integer id_user) {
Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<NodeCandidatValue> nodeCandidatLists = null;
ArrayList tabIdConcept = new ArrayList();
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select concept_candidat.id_concept from concept_candidat, proposition" + " where concept_candidat.id_concept = proposition.id_concept and" + " concept_candidat.id_thesaurus= proposition.id_thesaurus" + " and proposition.id_user =" + id_user + " and proposition.id_thesaurus ='" + idThesaurus + "' and concept_candidat.status='a'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
while (resultSet.next()) {
tabIdConcept.add(resultSet.getString("id_concept"));
}
nodeCandidatLists = new ArrayList<>();
for (Object tabIdConcept1 : tabIdConcept) {
NodeCandidatValue nodeCandidatValue;
nodeCandidatValue = getThisCandidat(ds, tabIdConcept1.toString(), idThesaurus, idLang);
if (nodeCandidatValue == null) {
return null;
}
nodeCandidatValue.setEtat("a");
nodeCandidatValue.setNbProp(getNbPropCandidat(ds, idThesaurus, tabIdConcept1.toString()));
nodeCandidatLists.add(nodeCandidatValue);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting List Group or Domain of thesaurus : " + idThesaurus, sqle);
}
return nodeCandidatLists;
}
use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeCandidatValue in project opentheso by miledrousset.
the class SearchCandidatBean method getTextSearchIn.
private List<NodeCandidatValue> getTextSearchIn(List<NodeCandidatValue> candidats, String textSearch) {
textSearch = (textSearch.isEmpty() ? "" : textSearch);
List<NodeCandidatValue> ret = new ArrayList<>();
for (NodeCandidatValue cdt : candidats) {
if (cdt.getValue().matches(".*" + textSearch + ".*")) {
ret.add(cdt);
}
}
return ret;
}
Aggregations