Search in sources :

Example 16 with Term

use of mom.trd.opentheso.bdd.datas.Term in project opentheso by miledrousset.

the class SelectedThesaurus method getArrayFacette.

public ArrayList<Entry<String, String>> getArrayFacette() {
    if (connect.getPoolConnexion() != null) {
        if (thesaurus == null) {
            return arrayFacette;
        }
        ArrayList<NodeFacet> temp = new FacetHelper().getAllFacetsOfThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        Map<String, String> mapTemp = new HashMap<>();
        Term value;
        for (NodeFacet nf : temp) {
            value = new TermHelper().getThisTerm(connect.getPoolConnexion(), nf.getIdConceptParent(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
            if (value == null) {
                mapTemp.put(String.valueOf(nf.getIdFacet()), nf.getLexicalValue() + " (" + nf.getIdConceptParent() + ")");
            } else {
                mapTemp.put(String.valueOf(nf.getIdFacet()), nf.getLexicalValue() + " (" + value.getLexical_value() + ")");
            }
        }
        arrayFacette = new ArrayList<>(mapTemp.entrySet());
    }
    return arrayFacette;
}
Also used : HashMap(java.util.HashMap) NodeFacet(mom.trd.opentheso.bdd.helper.nodes.NodeFacet) FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) Term(mom.trd.opentheso.bdd.datas.Term) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 17 with Term

use of mom.trd.opentheso.bdd.datas.Term in project opentheso by miledrousset.

the class SelectedCandidat method toInsert.

/**
 * Passe un candidat de son état courant à l'état inséré. Les modifications
 * nécessaires en bases de données sont traitées ici.
 *
 * @return
 */
public boolean toInsert() {
    setPreferences();
    if (selectedNvx == null) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sCdt.error4")));
        return false;
    }
    niveauEdit = selectedNvx.getIdConcept();
    /*else {
            niveauEdit = null;
        }*/
    /*   if (domaineEdit == null || domaineEdit.trim().equals("")) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sCdt.error1")));
            return false;
        }*/
    GroupHelper groupHelper = new GroupHelper();
    ArrayList<String> idGroups = groupHelper.getListIdGroupOfConcept(connect.getPoolConnexion(), idTheso, niveauEdit);
    if (tradInsert.isEmpty()) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sCdt.error2")));
        return false;
    }
    if (new TermHelper().isTermExist(connect.getPoolConnexion(), selected.getValue().trim(), idTheso, langueTheso)) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error2")));
        return false;
    }
    if (idGroups.isEmpty()) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", "No Group Error !!"));
        return false;
    }
    HashMap<String, String> trad = new HashMap<>();
    if (tradInsert.contains(langueTheso)) {
        trad.put(langueTheso, selected.getValue());
        tradInsert.remove(langueTheso);
    }
    for (String l : tradInsert) {
        for (NodeTraductionCandidat ntc : infoCdt.getNodeTraductions()) {
            if (l.equals(ntc.getIdLang())) {
                trad.put(l, ntc.getTitle());
            }
        }
    }
    ArrayList<Entry<String, String>> temp = new ArrayList<>(trad.entrySet());
    ConceptHelper instance = new ConceptHelper();
    instance.setNodePreference(user.getNodePreference());
    Concept concept = new Concept();
    concept.setIdGroup(idGroups.get(0));
    concept.setIdThesaurus(idTheso);
    concept.setStatus("D");
    concept.setNotation("");
    String langueTemp = temp.get(0).getKey();
    Term terme = new Term();
    terme.setId_thesaurus(idTheso);
    terme.setLang(temp.get(0).getKey());
    terme.setLexical_value(temp.get(0).getValue());
    temp.remove(0);
    String idc;
    // if (niveauEdit == null || niveauEdit.trim().equals("")) { // Top concept
    // idc = instance.addTopConcept(connect.getPoolConnexion(), idTheso, concept, terme, serverAdress, arkActive, theUser.getUser().getId());
    // } else { // concept
    idc = instance.addConcept(connect.getPoolConnexion(), niveauEdit, concept, terme, theUser.getUser().getId());
    // permet d'ajouter les domaines au nouveau concept
    for (String idGroup : idGroups) {
        groupHelper.addConceptGroupConcept(connect.getPoolConnexion(), idGroup, niveauEdit, idTheso);
    }
    if (!temp.isEmpty()) {
        String idt = new TermHelper().getThisTerm(connect.getPoolConnexion(), idc, idTheso, langueTemp).getId_term();
        for (Entry<String, String> e : temp) {
            terme = new Term();
            terme.setId_concept(idc);
            terme.setId_term(idt);
            terme.setId_thesaurus(idTheso);
            terme.setLang(e.getKey());
            terme.setLexical_value(e.getValue());
            new TermHelper().addTraduction(connect.getPoolConnexion(), terme, theUser.getUser().getId());
        }
    }
    CandidateHelper ch = new CandidateHelper();
    ch.updateCandidatStatus(connect.getPoolConnexion(), "i", idTheso, selected.getIdConcept());
    ch.addAdminMessage(connect.getPoolConnexion(), selected.getIdConcept(), idTheso, theUser.getUser().getId(), msgValid);
    // message d'alerte
    /*    ArrayList<NodeUser> contribs = ch.getListUsersOfCandidat(connect.getPoolConnexion(),
            selected.getIdConcept(), idTheso);*/
    /*    for (NodeUser nodeUser : contribs) {
            if (!lesMails.contains(contrib)) {
                lesMails.add(contrib);
            }
        }*/
    /*
        for (NodeUser nodeUser : contribs) {
            if (nodeUser.getMail() != null &&  !nodeUser.getMail().trim().equals("")) {
                String message =  "Votre candidat " + selected.getValue() + " a été intégré au thésaurus par le(a) terminologue : " + theUser.getUser().getName() + ".";
                envoyerMailAlert(nodeUser.getMail(), message);
            }
        } */
    msgValid = "";
    selected.setEtat("i");
    vue.setAddInsertCdt(false);
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sCdt.info6")));
    return true;
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) NodeTraductionCandidat(mom.trd.opentheso.bdd.helper.nodes.candidat.NodeTraductionCandidat) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Term(mom.trd.opentheso.bdd.datas.Term) Entry(java.util.Map.Entry) FacesMessage(javax.faces.application.FacesMessage) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) CandidateHelper(mom.trd.opentheso.bdd.helper.CandidateHelper) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 18 with Term

use of mom.trd.opentheso.bdd.datas.Term in project opentheso by miledrousset.

the class SelectedTerme method majTerme.

/**
 * *************************************** MISE A JOUR
 * ****************************************
 */
/**
 * Met à jour le terme à la sélection d'un node de l'arbre (traitement
 * différent si Domaine/TopConcept/Concept)
 *
 * @param sN
 */
public void majTerme(MyTreeNode sN) {
    // contrôler si la connexion est toujour valide
    // connect.
    selectedNode = sN;
    reInitTerme();
    majPref();
    idC = sN.getIdConcept();
    idTheso = sN.getIdTheso();
    idlangue = sN.getLangue();
    idDomaine = sN.getIdCurrentGroup();
    idTopConcept = sN.getIdTopConcept();
    type = sN.getTypeConcept();
    status = "";
    notation = "";
    latitudLongitud = null;
    totalConceptOfBranch = "";
    totalNoticesOfBranch = "";
    majTAsso();
    GroupHelper groupHelper = new GroupHelper();
    ConceptHelper conceptHelper = new ConceptHelper();
    if (groupHelper.isIdOfGroup(connect.getPoolConnexion(), idC, idTheso)) {
        microTheso = new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), idDomaine, idTheso, idlangue);
        NodeGroup ncg = new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(), idC, idTheso, idlangue);
        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        nom = ncg.getLexicalValue();
        idArk = ncg.getConceptGroup().getIdARk();
        nomEdit = nom;
        idT = "";
        if (ncg.getCreated() != null && ncg.getModified() != null) {
            dateC = dateFormat.format(ncg.getCreated());
            dateM = dateFormat.format(ncg.getModified());
        }
        majGroupTGen();
        majLangueGroup();
        majTSpeGroup();
        majNotes();
    } else {
        Concept concept = conceptHelper.getThisConcept(connect.getPoolConnexion(), idC, idTheso);
        if (concept == null) {
            return;
        }
        status = concept.getStatus();
        notation = concept.getNotation();
        if (!idDomaine.equals("Orphan")) {
            majGroup();
            majTGen();
        } else {
            microTheso = idDomaine;
        }
        Term t = new TermHelper().getThisTerm(connect.getPoolConnexion(), idC, idTheso, idlangue);
        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        nom = t.getLexical_value();
        nomEdit = nom;
        idT = t.getId_term();
        dateC = dateFormat.format(t.getCreated());
        dateM = dateFormat.format(t.getModified());
        creator = t.getCreator();
        contributor = t.getContributor();
        images = new ImagesHelper().getImage(connect.getPoolConnexion(), idC, idTheso, user.getUser().getId());
        majNotes();
        majLangueConcept();
        majSyno();
        updateGps();
        majTSpeConcept();
        align = new AlignmentHelper().getAllAlignmentOfConcept(connect.getPoolConnexion(), idC, idTheso);
        // ResourceBundle bundlePref = getBundlePref();
        if (user.getNodePreference().isZ3950actif()) {
            majNoticeZ3950();
        }
        if (user.getNodePreference().isBddActive()) {
            majNoticeBdd();
        }
        idArk = conceptHelper.getIdArkOfConcept(connect.getPoolConnexion(), idC, idTheso);
        idHandle = conceptHelper.getIdHandleOfConcept(connect.getPoolConnexion(), idC, idTheso);
        reInitFacette();
        initTree();
    }
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) ImagesHelper(mom.trd.opentheso.bdd.helper.ImagesHelper) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) DateFormat(java.text.DateFormat) SimpleDateFormat(java.text.SimpleDateFormat) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) Term(mom.trd.opentheso.bdd.datas.Term) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) SimpleDateFormat(java.text.SimpleDateFormat) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 19 with Term

use of mom.trd.opentheso.bdd.datas.Term in project opentheso by miledrousset.

the class SelectedTerme method creerSpecialTermeSpe.

/**
 * relation special type NTG NTP NTI ...
 *
 * @param selecedTerm
 * @param BTname
 * @param NTname
 * @return
 */
public boolean creerSpecialTermeSpe(MyTreeNode selecedTerm, String BTname, String NTname) {
    ConceptHelper instance = new ConceptHelper();
    if (user.nodePreference == null)
        return false;
    instance.setNodePreference(user.getNodePreference());
    Concept concept = new Concept();
    concept.setIdGroup(selecedTerm.getIdCurrentGroup());
    concept.setIdThesaurus(idTheso);
    concept.setStatus("D");
    concept.setNotation("");
    Term terme = new Term();
    terme.setId_thesaurus(idTheso);
    terme.setLang(idlangue);
    terme.setLexical_value(valueEdit);
    terme.setSource("");
    terme.setStatus("");
    // String idTC = idTopConcept;
    String idP = idC;
    if (instance.addConceptSpecial(connect.getPoolConnexion(), idP, concept, terme, BTname, NTname, user.getUser().getId()) == null) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", instance.getMessage()));
        return false;
    }
    // instance.insertID_grouptoPermuted(connect.getPoolConnexion(), concept.getIdThesaurus(), concept.getIdConcept());
    concept.getUserName();
    ArrayList<NodeNT> tempNT = new RelationsHelper().getListNT(connect.getPoolConnexion(), idC, idTheso, idlangue);
    termesSpecifique = new ArrayList<>();
    HashMap<String, String> tempMap = new HashMap<>();
    for (NodeNT nnt : tempNT) {
        tempMap.put(nnt.getIdConcept(), nnt.getTitle() + " (" + nnt.getRole() + ")");
    }
    termesSpecifique.addAll(tempMap.entrySet());
    vue.setAddTSpe(false);
    valueEdit = "";
    return true;
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) HashMap(java.util.HashMap) Term(mom.trd.opentheso.bdd.datas.Term) PrefixString(com.k_int.IR.QueryModels.PrefixString) FacesMessage(javax.faces.application.FacesMessage) NodeNT(mom.trd.opentheso.bdd.helper.nodes.NodeNT) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper)

Example 20 with Term

use of mom.trd.opentheso.bdd.datas.Term in project opentheso by miledrousset.

the class SelectedTerme method modifierSynonyme.

public void modifierSynonyme() {
    int idUser = user.getUser().getId();
    Term term = new Term();
    term.setLexical_value(valueOfSynonymesToModify);
    term.setId_term(idT);
    term.setId_thesaurus(idTheso);
    term.setLang(idlangue);
    if (!new TermHelper().updateTermSynonyme(connect.getPoolConnexion(), oldValue, term, idUser)) {
    // ca va pas
    }
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.modifySyn")));
    majSyno();
}
Also used : Term(mom.trd.opentheso.bdd.datas.Term) FacesMessage(javax.faces.application.FacesMessage) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Aggregations

Term (mom.trd.opentheso.bdd.datas.Term)31 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)22 Concept (mom.trd.opentheso.bdd.datas.Concept)15 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)15 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)13 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)12 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)11 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)10 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)10 FacesMessage (javax.faces.application.FacesMessage)9 SQLException (java.sql.SQLException)8 Connection (java.sql.Connection)7 ArrayList (java.util.ArrayList)7 PrefixString (com.k_int.IR.QueryModels.PrefixString)5 HashMap (java.util.HashMap)5 NodeTermTraduction (mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction)5 SKOSMapping (skos.SKOSMapping)5 SKOSTopConcept (skos.SKOSTopConcept)5 Statement (java.sql.Statement)4 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)4