Search in sources :

Example 6 with DcElement

use of fr.mom.arkeo.soap.DcElement in project opentheso by miledrousset.

the class ArkClient method getArkId.

public String getArkId(String date, String url, String title, String creator, ArrayList<DcElement> dcElementsList, String prefix) {
    Account account;
    try {
        account = login(propertiesArk.getProperty("idNaan"), propertiesArk.getProperty("user"), propertiesArk.getProperty("password"));
        if (account == null)
            return null;
        // System.out.println("authentification.result=" + account.getUser().getFirstname() + " " + account.getUser().getLastname());
        Ark inputArk = new Ark();
        inputArk.setDate(date);
        inputArk.setUrlTarget(url);
        inputArk.setTitle(title);
        // prefixes à définir type DCMI
        // "pcrt");
        inputArk.setType(prefix);
        inputArk.setCreator(creator);
        for (DcElement dcElementsList1 : dcElementsList) {
            inputArk.getDcElements().add(dcElementsList1);
        }
        Ark returnedArk = createArk(account, inputArk);
        if (returnedArk != null)
            return returnedArk.getArk();
        return null;
    } catch (Exception e) {
        System.out.println(e.toString());
    }
    return null;
/*
        for(DcElement dcElement : returnedArk.getDcElements()){
        	System.out.println(dcElement.getName()+" = " +dcElement.getValue());
        }
        */
// Liste des DcElements
/*     
        EL_ABSTRACT = "abstract",
        EL_ACCRIGHTS = "accessRights",
        EL_ACCMETHOD = "accrualMethod",
        EL_ACCPERIOD = "accrualPeriodicity",
        EL_ACCPOLICY = "accrualPolicy",
        EL_ALT = "alternative",
        EL_AUDIENCE = "audience",
        EL_AVAILABLE = "available",
        EL_BIBCITE = "bibliographicCitation",
        EL_CONFORMS = "conformsTo",
        EL_CONTRIB = "contributor",
        EL_COVERAGE = "coverage",
        EL_CREATED = "created",
        EL_CREATOR = "creator",
        EL_DATE = "date",
        EL_DATEACC = "dateAccepted",
        EL_DATECPR = "dateCopyrighted",
        EL_DATESUB = "dateSubmitted",
        EL_DESC = "description",
        EL_EDUCLEVEL = "educationLevel",
        EL_EXTENT = "extent",
        EL_FORMAT = "format",
        EL_HASFORMAT = "hasFormat",
        EL_HASPART = "hasPart",
        EL_HASVERS = "hasVersion",
        EL_ID = "identifier",
        EL_INSTMETHOD = "instructionalMethod",
        EL_ISFMTOF = "isFormatOf",
        EL_ISPARTOF = "isPartOf",
        EL_ISREFBY = "isReferencedBy",
        EL_ISREPBY = "isReplacedBy",
        EL_ISREQBY = "isRequiredBy",
        EL_ISSUED = "issued",
        EL_ISVSNOF = "isVersionOf",
        EL_LANG = "language",
        EL_LICENSE = "license",
        EL_MEDIATOR = "mediator",
        EL_MEDIUM = "medium",
        EL_MOD = "modified",
        EL_PROV = "provenance",
        EL_PUB = "publisher",
        EL_REFS = "references",
        EL_REL = "relation",
        EL_REP = "replaces",
        EL_REQ = "requires",
        EL_RIGHTS = "rights",
        EL_RIGHTSHOLDER = "rightsHolder",
        EL_SOURCE = "source",
        EL_SPATIAL = "spatial",
        EL_SUBJECT = "subject",
        EL_TOC = "tableOfContents",
        EL_TEMPORAL = "temporal",
        EL_TITLE = "title",
        EL_TYPE = "type",
        EL_VALID = "valid";
        */
// System.out.println("ark.result=" + returnedArk.getArk());
}
Also used : DcElement(fr.mom.arkeo.soap.DcElement) Account(fr.mom.arkeo.soap.Account) Ark(fr.mom.arkeo.soap.Ark)

Example 7 with DcElement

use of fr.mom.arkeo.soap.DcElement in project opentheso by miledrousset.

the class ArkClient method updateArkId.

public String updateArkId(String date, String url, String title, String creator, ArrayList<DcElement> dcElementsList, String type) {
    // compte de Frantiq
    Account account = login(propertiesArk.getProperty("idNaan"), propertiesArk.getProperty("user"), propertiesArk.getProperty("password"));
    // System.out.println("authentification.result=" + account.getUser().getFirstname() + " " + account.getUser().getLastname());
    Ark inputArk = new Ark();
    inputArk.setDate(date);
    inputArk.setUrlTarget(url);
    inputArk.setTitle(title);
    // prefixes à définir type DCMI
    // "pcrt");
    inputArk.setType(type);
    inputArk.setCreator(creator);
    for (DcElement dcElementsList1 : dcElementsList) {
        inputArk.getDcElements().add(dcElementsList1);
    }
    Ark returnedArk = updateArk(account, inputArk);
    /*
        for(DcElement dcElement : returnedArk.getDcElements()){
        	System.out.println(dcElement.getName()+" = " +dcElement.getValue());
        }
        */
    if (returnedArk != null)
        return returnedArk.getArk();
    return null;
// Liste des DcElements
/*     
        EL_ABSTRACT = "abstract",
        EL_ACCRIGHTS = "accessRights",
        EL_ACCMETHOD = "accrualMethod",
        EL_ACCPERIOD = "accrualPeriodicity",
        EL_ACCPOLICY = "accrualPolicy",
        EL_ALT = "alternative",
        EL_AUDIENCE = "audience",
        EL_AVAILABLE = "available",
        EL_BIBCITE = "bibliographicCitation",
        EL_CONFORMS = "conformsTo",
        EL_CONTRIB = "contributor",
        EL_COVERAGE = "coverage",
        EL_CREATED = "created",
        EL_CREATOR = "creator",
        EL_DATE = "date",
        EL_DATEACC = "dateAccepted",
        EL_DATECPR = "dateCopyrighted",
        EL_DATESUB = "dateSubmitted",
        EL_DESC = "description",
        EL_EDUCLEVEL = "educationLevel",
        EL_EXTENT = "extent",
        EL_FORMAT = "format",
        EL_HASFORMAT = "hasFormat",
        EL_HASPART = "hasPart",
        EL_HASVERS = "hasVersion",
        EL_ID = "identifier",
        EL_INSTMETHOD = "instructionalMethod",
        EL_ISFMTOF = "isFormatOf",
        EL_ISPARTOF = "isPartOf",
        EL_ISREFBY = "isReferencedBy",
        EL_ISREPBY = "isReplacedBy",
        EL_ISREQBY = "isRequiredBy",
        EL_ISSUED = "issued",
        EL_ISVSNOF = "isVersionOf",
        EL_LANG = "language",
        EL_LICENSE = "license",
        EL_MEDIATOR = "mediator",
        EL_MEDIUM = "medium",
        EL_MOD = "modified",
        EL_PROV = "provenance",
        EL_PUB = "publisher",
        EL_REFS = "references",
        EL_REL = "relation",
        EL_REP = "replaces",
        EL_REQ = "requires",
        EL_RIGHTS = "rights",
        EL_RIGHTSHOLDER = "rightsHolder",
        EL_SOURCE = "source",
        EL_SPATIAL = "spatial",
        EL_SUBJECT = "subject",
        EL_TOC = "tableOfContents",
        EL_TEMPORAL = "temporal",
        EL_TITLE = "title",
        EL_TYPE = "type",
        EL_VALID = "valid";
        */
// System.out.println("ark.result=" + returnedArk.getArk());
}
Also used : DcElement(fr.mom.arkeo.soap.DcElement) Account(fr.mom.arkeo.soap.Account) Ark(fr.mom.arkeo.soap.Ark)

Example 8 with DcElement

use of fr.mom.arkeo.soap.DcElement in project opentheso by miledrousset.

the class ThesaurusHelper method addThesaurus.

/**
 * Permet de créer un nouveau Thésaurus. Retourne l'identifiant du thésaurus
 * ou null
 *
 * @param ds le pool de connexion
 * @param thesaurus
 * @param urlSite
 * @param isArkActive
 * @return String Id du thésaurus rajouté
 */
public String addThesaurus(HikariDataSource ds, Thesaurus thesaurus, String urlSite, boolean isArkActive) {
    // "TH";//"ark:/66666/srvq9a5Ll41sk";
    String idThesaurus = null;
    Connection conn;
    Statement stmt;
    ResultSet resultSet;
    try {
        // Get connection from pool
        conn = ds.getConnection();
        try {
            stmt = conn.createStatement();
            try {
                String query = "select max(id) from thesaurus";
                stmt.executeQuery(query);
                resultSet = stmt.getResultSet();
                resultSet.next();
                int idNumeriqueThesaurus = resultSet.getInt(1);
                idThesaurus = "" + ++idNumeriqueThesaurus;
                /**
                 * récupération du code Ark via WebServices
                 */
                String idArk = "";
                if (isArkActive) {
                    ArrayList<DcElement> dcElementsList = new ArrayList<>();
                    ArkClient ark_Client = new ArkClient();
                    idArk = ark_Client.getArkId(new FileUtilities().getDate(), urlSite + "?idt=" + idThesaurus, "", "", dcElementsList, // pcrt : p= pactols, crt=code DCMI pour collection
                    "pcrt");
                }
                query = "Insert into thesaurus (id_thesaurus," + " id_ark, created, modified)" + " values (" + "'" + idThesaurus + "'" + ",'" + idArk + "'" + "," + "current_date," + "current_date)";
                stmt.executeUpdate(query);
                thesaurus.setId_thesaurus(idThesaurus);
            /*   if(thesaurus.getTitle().isEmpty()){
                        thesaurus.setTitle("Theso_" + idThesaurus);
                    }
                    addThesaurusTraduction(ds, thesaurus);*/
            } finally {
                stmt.close();
            }
        } finally {
            conn.close();
        }
    } catch (SQLException sqle) {
        // Log exception
        log.error("Error while adding Thesaurus : " + idThesaurus, sqle);
        idThesaurus = null;
    }
    return idThesaurus;
}
Also used : DcElement(fr.mom.arkeo.soap.DcElement) FileUtilities(mom.trd.opentheso.bdd.tools.FileUtilities) SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) ArrayList(java.util.ArrayList) ArkClient(mom.trd.opentheso.ws.ark.ArkClient)

Example 9 with DcElement

use of fr.mom.arkeo.soap.DcElement in project opentheso by miledrousset.

the class ToolsHelper method GenerateArkIds.

/**
 * Cette fonction permet de regénerer ou générer tous les identifiants Ark
 * du thésaurus
 *
 * @param ds
 * @param idThesaurus
 * @return ArrayList de NodePermute
 */
public boolean GenerateArkIds(HikariDataSource ds, String idThesaurus) {
    ConceptHelper conceptHelper = new ConceptHelper();
    TermHelper termHelper = new TermHelper();
    ArrayList<NodeTermTraduction> nodeTermTraductionList;
    // Génération des Id Ark pour les concepts
    ArrayList<String> tabIdConcept = conceptHelper.getAllIdConceptOfThesaurus(ds, idThesaurus);
    String idArk;
    ArkClient ark_Client = new ArkClient();
    ArrayList<DcElement> dcElementsList = new ArrayList<>();
    for (String idConcept : tabIdConcept) {
        dcElementsList.clear();
        nodeTermTraductionList = termHelper.getAllTraductionsOfConcept(ds, idConcept, idThesaurus);
        for (NodeTermTraduction nodeTermTraduction : nodeTermTraductionList) {
            DcElement dcElement = new DcElement();
            // cette fonction permet de remplir la table Permutée
            dcElement.setName("description");
            dcElement.setValue(nodeTermTraduction.getLexicalValue());
            dcElement.setLanguage(nodeTermTraduction.getLang());
            dcElementsList.add(dcElement);
        }
        // String date, String url, String title, String creator, String description, String type
        idArk = ark_Client.getArkId(new FileUtilities().getDate(), "http://pactols.frantiq.fr/" + "?idc=" + idConcept + "&idt=" + idThesaurus, idConcept, "Frantiq", dcElementsList, // pcrt : p= pactols, crt=code DCMI pour collection
        "pcrt");
        conceptHelper.updateArkIdOfConcept(ds, idConcept, idThesaurus, idArk);
    }
    return true;
}
Also used : DcElement(fr.mom.arkeo.soap.DcElement) FileUtilities(mom.trd.opentheso.bdd.tools.FileUtilities) ArrayList(java.util.ArrayList) NodeTermTraduction(mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction) ArkClient(mom.trd.opentheso.ws.ark.ArkClient)

Aggregations

DcElement (fr.mom.arkeo.soap.DcElement)9 ArrayList (java.util.ArrayList)7 FileUtilities (mom.trd.opentheso.bdd.tools.FileUtilities)6 ArkClient (mom.trd.opentheso.ws.ark.ArkClient)6 SQLException (java.sql.SQLException)5 Connection (java.sql.Connection)4 PreparedStatement (java.sql.PreparedStatement)4 Statement (java.sql.Statement)4 ResultSet (java.sql.ResultSet)3 Account (fr.mom.arkeo.soap.Account)2 Ark (fr.mom.arkeo.soap.Ark)2 ConceptGroupLabel (mom.trd.opentheso.bdd.datas.ConceptGroupLabel)1 NodeMetaData (mom.trd.opentheso.bdd.helper.nodes.NodeMetaData)1 NodeConcept (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConcept)1 NodeTermTraduction (mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction)1 StringPlus (mom.trd.opentheso.bdd.tools.StringPlus)1