Search in sources :

Example 11 with Concept

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

the class SelectedTerme method creerTermeSpe.

/**
 * *************************************** CREATION
 * ****************************************
 */
/**
 * Crée un nouveau terme spécifique au terme sélectionné
 *
 * @param selecedTerm
 * @return true or false
 */
public boolean creerTermeSpe(MyTreeNode selecedTerm) {
    ConceptHelper instance = new ConceptHelper();
    if (user.nodePreference == null)
        return false;
    instance.setNodePreference(user.getNodePreference());
    // 1 = domaine/Group, 2 = TT (top Term), 3 = Concept/term
    if (selecedTerm.isIsSubGroup() || selecedTerm.isIsGroup()) {
        // ici c'est le cas d'un Group ou Sous Group, on crée un TT Top Terme
        Concept concept = new Concept();
        concept.setIdGroup(selecedTerm.getIdConcept());
        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("");
        if (instance.addTopConcept(connect.getPoolConnexion(), idTheso, concept, terme, 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());
        ConceptHelper ch = new ConceptHelper();
        ArrayList<NodeConceptTree> tempNT = ch.getListTopConcepts(connect.getPoolConnexion(), idC, idTheso, idlangue);
        termesSpecifique = new ArrayList<>();
        HashMap<String, String> tempMap = new HashMap<>();
        for (NodeConceptTree nct : tempNT) {
            tempMap.put(nct.getIdConcept(), nct.getTitle());
        }
        termesSpecifique.addAll(tempMap.entrySet());
    } else {
        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.addConcept(connect.getPoolConnexion(), idP, concept, terme, 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) NodeNT(mom.trd.opentheso.bdd.helper.nodes.NodeNT) NodeConceptTree(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree) FacesMessage(javax.faces.application.FacesMessage) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper)

Example 12 with Concept

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

the class SearchBean method getNom.

public String getNom(String id) {
    String nom;
    ConceptHelper ch = new ConceptHelper();
    Concept c = ch.getThisConcept(connect.getPoolConnexion(), id, theso.getThesaurus().getId_thesaurus());
    if (c == null) {
        nom = new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), id, theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage());
    } else {
        nom = ch.getLexicalValueOfConcept(connect.getPoolConnexion(), id, theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage());
    }
    return nom;
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 13 with Concept

use of mom.trd.opentheso.bdd.datas.Concept 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 14 with Concept

use of mom.trd.opentheso.bdd.datas.Concept 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 15 with Concept

use of mom.trd.opentheso.bdd.datas.Concept 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)

Aggregations

Concept (mom.trd.opentheso.bdd.datas.Concept)30 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)18 Term (mom.trd.opentheso.bdd.datas.Term)15 SQLException (java.sql.SQLException)12 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)12 Connection (java.sql.Connection)11 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)10 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)10 NodeConcept (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConcept)10 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)10 ArrayList (java.util.ArrayList)9 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)9 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)9 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)7 PreparedStatement (java.sql.PreparedStatement)6 Statement (java.sql.Statement)6 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)5 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)5 SKOSMapping (skos.SKOSMapping)5 SKOSTopConcept (skos.SKOSTopConcept)5