Search in sources :

Example 6 with NoteHelper

use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.

the class SelectedThesaurus method regenIdConcept.

/**
 * Cette fonction remplace tout les id des concepts du théso
 */
private void regenIdConcept(Connection conn, String idTheso, ArrayList<String> idGroup) throws Exception {
    /*récup les concepts*/
    ConceptHelper conceptHelper = new ConceptHelper();
    ArrayList<String> idConcepts = conceptHelper.getAllIdConceptOfThesaurus(conn, idTheso);
    if (idConcepts == null || idConcepts.isEmpty()) {
        throw new Exception("No concept in this thesaurus");
    }
    /*génération des nouveaux id*/
    ArrayList<String> reservedId = idConcepts;
    reservedId.addAll(idGroup);
    ArrayList<String> newIdConcepts = createNewId(reservedId, idConcepts.size());
    /*maj des tables*/
    NoteHelper noteHelper = new NoteHelper();
    GpsHelper gpsHelper = new GpsHelper();
    ImagesHelper imagesHelper = new ImagesHelper();
    AlignmentHelper alignmentHelper = new AlignmentHelper();
    for (int i = 0; i < idConcepts.size(); i++) {
        String id = idConcepts.get(i);
        String newId = newIdConcepts.get(i);
        // table concept
        conceptHelper.setIdConcept(conn, idTheso, id, newId);
        // table concept_group_concept
        conceptHelper.setIdConceptGroupConcept(conn, idTheso, id, newId);
        // table concept_historique
        conceptHelper.setIdConceptHistorique(conn, idTheso, id, newId);
        // table concept_orphan
        conceptHelper.setIdConceptOrphan(conn, idTheso, id, newId);
        // table gps
        gpsHelper.setIdConceptGPS(conn, idTheso, id, newId);
        // table hierarchical_relationship
        conceptHelper.setIdConceptHieraRelation(conn, idTheso, id, newId);
        // table hierarchical_relationship_historique
        conceptHelper.setIdConceptHieraRelationHisto(conn, idTheso, id, newId);
        // table note
        noteHelper.setIdConceptNote(conn, idTheso, id, newId);
        // table note_historique
        noteHelper.setIdConceptNoteHisto(conn, idTheso, id, newId);
        // table images
        imagesHelper.setIdConceptImage(conn, idTheso, id, newId);
        // table concept_fusion
        conceptHelper.setIdConceptFusion(conn, idTheso, id, newId);
        // table preferred_term
        conceptHelper.setIdConceptPreferedTerm(conn, idTheso, id, newId);
        // table alignement
        alignmentHelper.setIdConceptAlignement(conn, idTheso, id, newId);
    }
}
Also used : ImagesHelper(mom.trd.opentheso.bdd.helper.ImagesHelper) GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) NoteHelper(mom.trd.opentheso.bdd.helper.NoteHelper) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) SQLException(java.sql.SQLException)

Example 7 with NoteHelper

use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.

the class SelectedTerme method ajouterAlignAutoByLot.

/**
 * Permet de creer une alignement, cette funtion s'utilise pour l'alignement
 * par lot l'apelation de la funtion c'est de AlignementParLotBean
 *
 * @param nodeAlignment
 * @return
 */
public boolean ajouterAlignAutoByLot(NodeAlignment nodeAlignment, boolean addDefinition, String id_term) {
    AlignmentHelper alignmentHelper = new AlignmentHelper();
    NoteHelper noteHelper = new NoteHelper();
    if (!alignmentHelper.addNewAlignment(connect.getPoolConnexion(), user.getUser().getId(), nodeAlignment.getConcept_target(), nodeAlignment.getThesaurus_target(), nodeAlignment.getUri_target(), nodeAlignment.getAlignement_id_type(), nodeAlignment.getInternal_id_concept(), idTheso, alignementSource.getId())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Notation Error BDD")));
        return false;
    }
    if (addDefinition) {
        StringPlus stringPlus = new StringPlus();
        String dejaBonString = stringPlus.clearAngles(nodeAlignment.getDef_target());
        if (!noteHelper.addTermNote(connect.getPoolConnexion(), id_term, idlangue, idTheso, dejaBonString, "definition", user.getUser().getId())) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Notation Error BDD")));
            return false;
        }
    }
    messageAlig = alignmentHelper.getMessage();
    return true;
}
Also used : StringPlus(mom.trd.opentheso.bdd.tools.StringPlus) NoteHelper(mom.trd.opentheso.bdd.helper.NoteHelper) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) PrefixString(com.k_int.IR.QueryModels.PrefixString) FacesMessage(javax.faces.application.FacesMessage)

Example 8 with NoteHelper

use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.

the class SelectedTerme method editNoteHisto.

/**
 * Crée ou modifie la note historique du terme courant
 */
public void editNoteHisto() {
    int idUser = user.getUser().getId();
    if (noteHistorique.isEmpty()) {
        deleteThisNoteOfConcept("note");
        return;
    }
    if (new NoteHelper().isNoteExistOfTerm(connect.getPoolConnexion(), idT, idTheso, idlangue, "historyNote")) {
        new NoteHelper().updateTermNote(connect.getPoolConnexion(), idT, idlangue, idTheso, noteHistorique, "historyNote", idUser);
    } else {
        new NoteHelper().addTermNote(connect.getPoolConnexion(), idT, idlangue, idTheso, noteHistorique, "historyNote", idUser);
    }
    majNotes();
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info12")));
}
Also used : NoteHelper(mom.trd.opentheso.bdd.helper.NoteHelper) FacesMessage(javax.faces.application.FacesMessage)

Example 9 with NoteHelper

use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.

the class SelectedTerme method majNotes.

private void majNotes() {
    // NodeNote contient la note avec le type de note, il faut filtrer pour trouver la bonne note
    // For Concept : customnote ; scopeNote ; historyNote
    // For Term : definition; editorialNote; historyNote;
    initNotes();
    nodeNoteTermList = new NoteHelper().getListNotesTerm(connect.getPoolConnexion(), idT, idTheso, idlangue);
    for (NodeNote nodeNoteList1 : nodeNoteTermList) {
        if (nodeNoteList1 != null) {
            // cas d'une noteEditoriale
            if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("editorialNote")) {
                if (nodeNoteList1.getLexicalvalue() != null) {
                    noteEditoriale = nodeNoteList1.getLexicalvalue();
                }
            }
            // cas de definitionNote
            if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("definition")) {
                if (nodeNoteList1.getLexicalvalue() != null) {
                    definition = nodeNoteList1.getLexicalvalue();
                }
            }
            // cas de HistoryNote
            if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("historyNote")) {
                if (nodeNoteList1.getLexicalvalue() != null) {
                    noteHistorique = nodeNoteList1.getLexicalvalue();
                }
            }
        }
    }
    nodeNoteConceptList = new NoteHelper().getListNotesConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
    for (NodeNote nodeNoteList1 : nodeNoteConceptList) {
        if (nodeNoteList1 != null) {
            // cas de Note d'application
            if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("scopeNote")) {
                if (nodeNoteList1.getLexicalvalue() != null) {
                    noteApplication = nodeNoteList1.getLexicalvalue();
                }
            }
            // cas de HistoryNote
            if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("historyNote")) {
                if (nodeNoteList1.getLexicalvalue() != null) {
                    noteHistorique = nodeNoteList1.getLexicalvalue();
                }
            }
            // cas de Note
            if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("note")) {
                if (nodeNoteList1.getLexicalvalue() != null) {
                    note = nodeNoteList1.getLexicalvalue();
                }
            }
        }
    }
}
Also used : NoteHelper(mom.trd.opentheso.bdd.helper.NoteHelper) NodeNote(mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)

Example 10 with NoteHelper

use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.

the class SelectedTerme method deleteThisNoteOfConcept.

/**
 * Cette fonction permet de supprimer une note suivant son type
 *
 * @param noteTypeCode
 */
public void deleteThisNoteOfConcept(String noteTypeCode) {
    int idUser = user.getUser().getId();
    new NoteHelper().deletethisNoteOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue, noteTypeCode);
    majNotes();
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info13")));
}
Also used : NoteHelper(mom.trd.opentheso.bdd.helper.NoteHelper) FacesMessage(javax.faces.application.FacesMessage)

Aggregations

NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)24 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)14 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)12 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)12 Term (mom.trd.opentheso.bdd.datas.Term)11 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)11 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)11 Concept (mom.trd.opentheso.bdd.datas.Concept)9 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)9 FacesMessage (javax.faces.application.FacesMessage)8 SQLException (java.sql.SQLException)5 NodeTermTraduction (mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction)5 SKOSMapping (skos.SKOSMapping)5 SKOSTopConcept (skos.SKOSTopConcept)5 ArrayList (java.util.ArrayList)4 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)4 Connection (java.sql.Connection)3 HierarchicalRelationship (mom.trd.opentheso.bdd.datas.HierarchicalRelationship)3 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)3 SKOSAnnotation (org.semanticweb.skos.SKOSAnnotation)3