Search in sources :

Example 1 with NodeProposition

use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition in project opentheso by miledrousset.

the class LineCdt method getMessage.

public String getMessage() {
    // #MR
    StringBuilder message = new StringBuilder();
    String status1;
    switch(status) {
        case ("a"):
            status1 = "en attente";
            break;
        case ("r"):
            status1 = "refusé";
            break;
        case ("v"):
            status1 = "validé";
            break;
        case ("i"):
            status1 = "inséré";
            break;
        default:
            status1 = "inconnu";
            break;
    }
    message.append("<table style=\"width: 715px; height: 321px;\" border=\"0\">");
    message.append("<tbody>");
    message.append("<tr>");
    message.append("<td><i> Candidat :");
    message.append("</i></td>");
    message.append("<td><b>");
    message.append(valeur_lexical);
    message.append("</b></td>");
    message.append("</tr>");
    message.append("<tr>");
    message.append("<td><i>id :");
    message.append("</i></td>");
    message.append("<td><b>");
    message.append(Id_concept);
    message.append("</b></td>");
    message.append("</tr>");
    message.append("<tr>");
    message.append("<td><i>créé le :");
    message.append("</i></td>");
    message.append("<td><b>");
    message.append(created);
    message.append("</b></td>");
    message.append("</tr>");
    message.append("<tr>");
    message.append("<td><i>modifié le :");
    message.append("</i></td>");
    message.append("<td><b>");
    message.append(modified);
    message.append("</b></td>");
    message.append("</tr>");
    message.append("<tr>");
    message.append("<td><i>Status :");
    message.append("</i></td>");
    message.append("<td><b>");
    message.append(status1);
    message.append("</b></td>");
    message.append("</tr>");
    message.append("<tr>");
    message.append("<td><i>proposé par :");
    message.append("</i>");
    // données concernant les propositions faites par les utilisateurs
    for (NodeProposition nodeProposition1 : nodeProposition) {
        message.append("<tr>");
        message.append("<td><b>");
        message.append(nodeProposition1.getUser());
        message.append("</b></td>");
        message.append("</tr>");
        message.append("<tr>");
        message.append("<td><b>");
        message.append(nodeProposition1.getNote());
        message.append("</b></td>");
        message.append("</tr>");
        message.append("<tr>");
        message.append("<td><b>");
        message.append(nodeProposition1.getLabelConceptParent());
        message.append("</b></td>");
        message.append("</tr>");
    }
    message.append("</td>");
    /* 
        if(note != null && !note.isEmpty()) {
            message.append("<td><b>");
            message.append(note);
            message.append("</b></td>");
            message.append("</tr>");
        }*/
    if (admin_message != null && !admin_message.isEmpty()) {
        message.append("<tr>");
        message.append("<td><i>Message de l'admin :");
        message.append("</i></td>");
        message.append("<td><b>");
        message.append(admin_message);
        message.append("</b></td>");
        message.append("</tr>");
    }
    message.append("<tr>");
    message.append("<td><i>Thésaurus :");
    message.append("</i></td>");
    message.append("<td><b>");
    message.append(title_thesaurus);
    message.append("</b></td>");
    message.append("</tr>");
    message.append("</tbody>");
    message.append("</table>");
    message.append("<hr color=\"blue\"> ");
    message.append("<br>");
    return message.toString();
// ancien formatage
/*
        String ret="<table><legend>information sur le candidat</legend>";
        ret+="<tr><td>id_thesaurus</td><td>"+id_thesaurus+" </td><td> titre thésaurus </td><td>"+title_thesaurus+"</td></tr>";
        ret+="<tr><td>id_concept</td><td>"+Id_concept+" </td><td>valeur lexical du concept</td><td>"+valeur_lexical+"</td></tr>";
        ret+="<tr><td>créer le </td><td>"+created+" </td><td>modifier le </td><td>"+modified+" </td></tr>";
        String stat="";
        switch(status){
            case("a"):stat="<tr><td colspan='2'>Status</td> <td clospan='2' >en attente </td></tr>";
                        break;
            case("r"):stat="<tr><td colspan='2'>Status</td> <td clospan='2' > refusé </td></tr>";
                        break;
            case("v"):stat="<tr><td colspan='2'>Status</td> <td clospan='2' >  validé </td></tr>";
                        break;
            case("i"): stat="<tr><td colspan='2'>Status</td> <td clospan='2' >  inséré </td></tr>";
                        break;
            default:stat="<tr><td colspan='2'>Status</td> <td clospan='2' >  inconnu </td></tr>";
                    break;
        }
        ret+=stat;
        ret+="<tr><td colspan='2'>Note</td> <td clospan='2' >"+note+"</td></tr>";
        ret+="<tr><td colspan='2'>Note</td> <td clospan='2' >"+admin_message+"</td></tr>";
        ret+="</table>";    
        return ret;
        */
}
Also used : NodeProposition(mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition)

Example 2 with NodeProposition

use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition in project opentheso by miledrousset.

the class CandidateHelper method getAllPropositionsOfCandidat.

/**
 * Permet de retourner la liste de toutes les propositions sur un candidat
 *
 * @param ds
 * @param idCandidat
 * @param idThesaurus
 * @return
 */
public ArrayList<NodeProposition> getAllPropositionsOfCandidat(HikariDataSource ds, String idCandidat, String idThesaurus) {
    Statement stmt;
    ResultSet resultSet;
    ArrayList<NodeProposition> nodePropositions = new ArrayList<>();
    try {
        Connection conn = ds.getConnection();
        try {
            stmt = conn.createStatement();
            try {
                String query = "SELECT \n" + "  proposition.concept_parent, \n" + "  proposition.id_group, \n" + "  proposition.note, \n" + "  users.username\n" + "FROM \n" + "  proposition, \n" + "  users\n" + "WHERE \n" + "  users.id_user = proposition.id_user AND\n" + "  proposition.id_concept = '" + idCandidat + "' AND \n" + "  proposition.id_thesaurus = '" + idThesaurus + "';";
                stmt.executeQuery(query);
                resultSet = stmt.getResultSet();
                while (resultSet.next()) {
                    NodeProposition nodeProposition = new NodeProposition();
                    if (!resultSet.getString("concept_parent").isEmpty()) {
                        nodeProposition.setLabelConceptParent(new ConceptHelper().getLexicalValueOfConcept(ds, resultSet.getString("concept_parent"), idThesaurus, "fr"));
                    }
                    nodeProposition.setIdConceptParent(resultSet.getString("concept_parent"));
                    nodeProposition.setIdGroup(resultSet.getString("id_group"));
                    nodeProposition.setUser(resultSet.getString("username"));
                    nodeProposition.setNote(resultSet.getString("note"));
                    nodePropositions.add(nodeProposition);
                }
            } finally {
                stmt.close();
            }
        } finally {
            conn.close();
        }
    } catch (SQLException sqle) {
        // Log exception
        log.error("Error while asking if id of Candidat exist : " + idCandidat, sqle);
    }
    return nodePropositions;
}
Also used : NodeProposition(mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition) SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) ArrayList(java.util.ArrayList) Connection(java.sql.Connection)

Example 3 with NodeProposition

use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition in project opentheso by miledrousset.

the class SelectedCandidat method newPropCandidat.

/**
 * Ajoute une proposition au candidat courant
 *
 * @param langue
 * @return
 */
public boolean newPropCandidat(String langue) {
    try {
        if (selectedNvx != null) {
            if (!selectedNvx.getIdConcept().isEmpty())
                if (!setLevelInfos(selectedNvx.getIdConcept(), langue))
                    return false;
        } else {
            niveauEdit = "";
        }
        Connection conn = connect.getPoolConnexion().getConnection();
        conn.setAutoCommit(false);
        if (selectedNvx != null) {
            niveauEdit = selectedNvx.getIdConcept();
        } else {
            niveauEdit = "";
        }
        if (domaineEdit == null) {
            domaineEdit = "";
        }
        if (!new CandidateHelper().addPropositionCandidat_RollBack(conn, selected.getIdConcept(), theUser.getUser().getId(), idTheso, noteEdit, niveauEdit, domaineEdit)) {
            conn.rollback();
            conn.close();
            return false;
        }
        conn.commit();
        conn.close();
        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));
        modifiedProposition = np.getModified();
        createdProposition = np.getCreated();
        nomsProp = new ArrayList<>();
        for (NodeUser nuse : infoCdt.getNodesUser()) {
            nomsProp.add(nuse.getName());
        }
        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() + ")";
        }
        selected.setNbProp(selected.getNbProp() + 1);
        // envoie d'email d'alerte !!
        /*  int minAlert = new PreferencesHelper().getThesaurusPreference(connect.getPoolConnexion(), idTheso).getNbAlertCdt();
            if (selected.getNbProp() >= minAlert) {
                ArrayList<String> lesMails = new UserHelper().getMailAdmin(connect.getPoolConnexion(), idTheso);
                for (String mail : lesMails) {
                    if (mail != null && !mail.trim().equals("")) {
                        String message =  "Le candidat " + selected.getValue() + " a atteint le seuil d'alerte de " + minAlert + " fois.";
                        envoyerMailAlert(mail, message);
                    }
                }
            }*/
        initNewProposal();
        return true;
    } catch (SQLException ex) {
        Logger.getLogger(SelectedCandidat.class.getName()).log(Level.SEVERE, null, ex);
    }
    return false;
}
Also used : NodeProposition(mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) SQLException(java.sql.SQLException) NodeUser(mom.trd.opentheso.bdd.helper.nodes.NodeUser) Connection(java.sql.Connection) CandidateHelper(mom.trd.opentheso.bdd.helper.CandidateHelper)

Example 4 with NodeProposition

use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition in project opentheso by miledrousset.

the class SelectedCandidat method initEditProp.

public void initEditProp() {
    NodeProposition np = new CandidateHelper().getNodePropositionOfUser(connect.getPoolConnexion(), selected.getIdConcept(), idTheso, theUser.getUser().getId());
    noteEdit = np.getNote();
    niveauEdit = np.getIdConceptParent();
    domaineEdit = np.getIdGroup();
    vue.setEditPropCandidat(true);
}
Also used : NodeProposition(mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition) CandidateHelper(mom.trd.opentheso.bdd.helper.CandidateHelper)

Example 5 with NodeProposition

use of mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition in project opentheso by miledrousset.

the class SelectedCandidat method onChange.

/**
 * ************************** MISE A JOUR ****************************
 */
/**
 * Changement de la proposition courrante à la sélection du nom d'un
 * utilisateur dans la table des propositions
 *
 * @param event
 */
public void onChange(TabChangeEvent event) {
    String nom = (String) event.getData();
    for (NodeUser nu : infoCdt.getNodesUser()) {
        if (nom.equals(nu.getName())) {
            NodeProposition np = new CandidateHelper().getNodePropositionOfUser(connect.getPoolConnexion(), selected.getIdConcept(), idTheso, nu.getId());
            note = np.getNote();
            modifiedProposition = np.getModified();
            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() + ")";
            }
            break;
        }
    }
}
Also used : NodeProposition(mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) NodeUser(mom.trd.opentheso.bdd.helper.nodes.NodeUser) CandidateHelper(mom.trd.opentheso.bdd.helper.CandidateHelper)

Aggregations

NodeProposition (mom.trd.opentheso.bdd.helper.nodes.candidat.NodeProposition)8 CandidateHelper (mom.trd.opentheso.bdd.helper.CandidateHelper)5 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)4 Connection (java.sql.Connection)3 SQLException (java.sql.SQLException)3 NodeUser (mom.trd.opentheso.bdd.helper.nodes.NodeUser)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 Statement (java.sql.Statement)2 FacesMessage (javax.faces.application.FacesMessage)2 ArrayList (java.util.ArrayList)1 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)1 NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)1 NodeMessageAdmin (mom.trd.opentheso.bdd.helper.nodes.candidat.NodeMessageAdmin)1