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());
}
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());
}
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;
}
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;
}
Aggregations