branch develop updated (e5eac8c -> 88a3288)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository coselmar. See https://gitlab.nuiton.org/codelutin/coselmar.git from e5eac8c refs #9206 So Tika-parsers is not an option, fix shame mistake on FileInfos attribtues, be able to manage temporary dir for file with FileInfos new 88a3288 refs #9206 Fix NPE when CSV file is not found in zip + review tool description The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 88a32880eae900e1b05965a01524a4c462884e11 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Jun 9 11:26:06 2017 +0200 refs #9206 Fix NPE when CSV file is not found in zip + review tool description Summary of changes: .../beans/MassiveDocumentsImportResult.java | 1 + .../coselmar/services/v1/DocumentsWebService.java | 8 +++- coselmar-ui/src/main/webapp/i18n/en.js | 49 +++++++++++++++------ coselmar-ui/src/main/webapp/i18n/fr.js | 50 ++++++++++++++++------ .../src/main/webapp/views/admin/admintools.html | 6 ++- 5 files changed, 85 insertions(+), 29 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See https://gitlab.nuiton.org/codelutin/coselmar.git commit 88a32880eae900e1b05965a01524a4c462884e11 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Jun 9 11:26:06 2017 +0200 refs #9206 Fix NPE when CSV file is not found in zip + review tool description --- .../beans/MassiveDocumentsImportResult.java | 1 + .../coselmar/services/v1/DocumentsWebService.java | 8 +++- coselmar-ui/src/main/webapp/i18n/en.js | 49 +++++++++++++++------ coselmar-ui/src/main/webapp/i18n/fr.js | 50 ++++++++++++++++------ .../src/main/webapp/views/admin/admintools.html | 6 ++- 5 files changed, 85 insertions(+), 29 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/MassiveDocumentsImportResult.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/MassiveDocumentsImportResult.java index 97b3b88..29bdc91 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/MassiveDocumentsImportResult.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/MassiveDocumentsImportResult.java @@ -47,6 +47,7 @@ public class MassiveDocumentsImportResult { public enum ImportSystemErrorType { UNABLE_TO_READ_ZIP, + UNABLE_TO_FIND_CSV, UNABLE_TO_READ_CSV, UNABLE_TO_READ_ZIP_ENTRY, ; diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java index 153af10..f522483 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java @@ -981,6 +981,11 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { // Get descriptions.csv : it should contains all DocumentBean information ZipEntry descriptionEntry = zipFile.getEntry(DESCRIPTION_CSV_FILE_NAME); + if (descriptionEntry == null) { + importResult.setSystemErrorType(MassiveDocumentsImportResult.ImportSystemErrorType.UNABLE_TO_FIND_CSV); + return importResult; + } + InputStream descriptionInputStream; try { descriptionInputStream = zipFile.getInputStream(descriptionEntry); @@ -989,8 +994,7 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { if (log.isErrorEnabled()) { log.error(message, e); } - importResult.addMissingFile(DESCRIPTION_CSV_FILE_NAME); - importResult.setSystemErrorType(MassiveDocumentsImportResult.ImportSystemErrorType.UNABLE_TO_READ_CSV); + importResult.setSystemErrorType(MassiveDocumentsImportResult.ImportSystemErrorType.UNABLE_TO_FIND_CSV); return importResult; // Direct break : cannot continue without this file } diff --git a/coselmar-ui/src/main/webapp/i18n/en.js b/coselmar-ui/src/main/webapp/i18n/en.js index e4f2c97..3b6b6f6 100644 --- a/coselmar-ui/src/main/webapp/i18n/en.js +++ b/coselmar-ui/src/main/webapp/i18n/en.js @@ -325,28 +325,51 @@ var translateEN = { "admin.tools.message.massimport.errors" : "Error during documents import. Please try again. If problem persist, see server administrator.", "admin.tools.message.massimport.fail" : "Some error occur during import.", "admin.tools.message.massimport.zipReadFail" : "Unable to open zipfile, maybe it is corrupt ?", +"admin.tools.message.massimport.csvFindFail" : "Unable to retrieve 'description.csv' file in zip.", "admin.tools.message.massimport.csvReadFail" : "Unable to read 'description.csv' file, please verify file format.", "admin.tools.message.massimport.fileReadFail" : "Unable to read some files from zip.", "admin.tools.message.massimport.missingFiles" : "Files not found from zip : ", "admin.tools.presentation.luceneRefresh" : "<p>Search Index makes search easier and faster.</p>\ <p>Refresh it guaranties to be weel synch with information from database.</p>", -"admin.tools.presentation.documentsimport" : "<p>This allows to add several documents in one time in the application.</p>\ - <p>A Zip file is required, containing :\ +"admin.tools.presentation.documentsimport" : "<p>Documents Mass Import is a functionality reserved to Admin and available inside 'Admin' menu entry.</p>\ + <p>A Zip file should be made, containing :\ <ul>\ - <li>a CSV file named 'description.csv' with on each line metadata related to a file (in the zip) ;</li>\ - <li>all document files to import.</li>\ + <li>a CSV file named 'description.csv' containing on each line metadata related to a file.\ + This file is UTF-8 encoded and using ';' as separator</li>\ + <li>all document files described in 'description.csv'.</li>\ </ul>\ + Name of the zip filz is free.\ </p>\ - <p>CSV file should have following headers and columns: \ - <strong>name;type;keywords;authors;summary;license;copyright;publicationDate;comment;citation;fileName</strong>.<br/> \ - And some columns must have specific format : \ + <p>The 'description.csv' file should contain following columns (* = mandatory fields) : \ <ul>\ - <li><strong>TYPE</strong> can only have one of values 'PERIODICAL_PUBLICATION', 'MEETING_PUBLICATION', 'THESIS',\ - 'REPORT', 'SCIENTIFIC_REPORT', 'SCIENTIFIC_WORK', 'CHAPTER_WORK', 'CONTRACT_REPORT', 'EXPERTISE',\ - 'POSTER', 'CONFERENCE_ARTICLE', 'CONFERENCE_SUMMARY', 'DATA', 'OTHER' ;</li>\ - <li><strong>keywords</strong> must be separated with coma (<strong>,</strong>) ;</li>\ - <li><strong>publicationDate</strong> format must be YYYY/MM/DD (2017/06/01) ;</li>\ - <li>If a text contains a semi-colon(<strong>;</strong>), it have to be borned with quotes (\"text ; rest\").\ + <li><strong>name*</strong> : document title (field Title)</li>\ + <li><strong>type*</strong> : document type (field Type) only with values described in next paragraph</li>\ + <li><strong>keywords*</strong> : keywords, separated with coma (<strong>,</strong>) (field Keywords)</li>\ + <li><strong>authors</strong> : authors, separated with coma (<strong>,</strong>) (field Authors)</li>\ + <li><strong>summary*</strong> : summary (field Summary). If text contains semi-colon ((<strong>;</strong>), born it with double-quote (<strong>\"</strong>, exemple : \"this is my text ; and rest\")</li>\ + <li><strong>license</strong> : license type (field Licence)</li>\ + <li><strong>copyright</strong> : copyright (field Copyright)</li>\ + <li><strong>publicationDate</strong> : publication date (field Publication Date). Format YYYY/MM/DD</li>\ + <li><strong>comment</strong> : comment (field Comment)</li>\ + <li><strong>citation*</strong> : citation (field Citation)</li>\ + <li><strong>fileName*</strong> : linked file name (must be exactly same as in the zip)</li>\ + </ul>\ + Different values allowed for document <strong>Type</strong> are :\ + <ul>\ + <li><strong>PERIODICAL_PUBLICATION</strong> (publication in periodical)</li>\ + <li><strong>MEETING_PUBLICATION</strong> (publication in meeting or symposium)</li>\ + <li><strong>THESIS</strong></li>\ + <li><strong>REPORT</strong></li>\ + <li><strong>SCIENTIFIC_REPORT</strong> (scientific report)</li>\ + <li><strong>SCIENTIFIC_WORK</strong> (scientific work)</li>\ + <li><strong>CHAPTER_WORK</strong> (work chapter)</li>\ + <li><strong>CONTRACT_REPORT</strong> (contract report)</li>\ + <li><strong>EXPERTISE</strong> (expertise/opinion)</li>\ + <li><strong>POSTER</strong></li>\ + <li><strong>CONFERENCE_ARTICLE</strong> (conference article)</li>\ + <li><strong>CONFERENCE_SUMMARY</strong> (conference summary)</li>\ + <li><strong>DATA</strong></li>\ + <li><strong>OTHER</strong></li>\ </ul>\ </p>", diff --git a/coselmar-ui/src/main/webapp/i18n/fr.js b/coselmar-ui/src/main/webapp/i18n/fr.js index 3783bc6..28f9b75 100644 --- a/coselmar-ui/src/main/webapp/i18n/fr.js +++ b/coselmar-ui/src/main/webapp/i18n/fr.js @@ -325,29 +325,53 @@ var translateFR = { "admin.tools.message.massimport.errors" : "Des erreurs sont survenues durant l'import. Veuillez contacter l'administrateur serveur.", "admin.tools.message.massimport.fail" : "Des erreurs sont survenues durant le traitement des fichiers.", "admin.tools.message.massimport.zipReadFail" : "Impossible de lire le fichier zip, peut-être est-il corrompu ?", +"admin.tools.message.massimport.csvFindFail" : "Le fichier 'description.csv' est manquant.", "admin.tools.message.massimport.csvReadFail" : "Erreur dans le traitement du fichier 'description.csv'. Veuillez vérifier le format des données.", "admin.tools.message.massimport.fileReadFail" : "Erreur dans le traitement de fichiers contenus dans le zip.", "admin.tools.message.massimport.missingFiles" : "Fichiers non retrouvés dans le zip : ", "admin.tools.presentation.luceneRefresh" : "<p>L'index de recherche permet d'accélérer la fonctionnalité de recherche.</p>\ <p>Le rafraîchissement de cet index permet d'assurer la bonne synchronisation avec les informations\ stockées en base de données.</p>", -"admin.tools.presentation.documentsimport" : "<p>Cette fonctionnalité permet d'ajouter plusieurs documents à la base de connaissance.</p>\ - <p>Un fichier Zip est attendu, contenant :\ +"admin.tools.presentation.documentsimport" : "La fonctionnalité d ajout de documents en masse par import est réservée au profil Admin et est accessible depuis le menu 'Admin'.\ + </p>\ + <p>Il faut constituer un fichier Zip qui contient :\ <ul>\ - <li>Un fichier CSV 'description.csv' contenant pour chaque lignes les metadata relatives à un fichier ;</li>\ - <li>L'ensemble des fichiers à importer.</li>\ + <li>Un fichier CSV 'description.csv' contenant pour chaque lignes les metadata relatives à un fichier. \ + Ce fichier csv est en encodage UFT8, séparateur ';'.</li>\ + <li>l'ensemble des fichiers listés dans le fichier 'description.csv'.</li>\ </ul>\ + Le nom du fichier Zip est libre.\ </p>\ - <p>Le fichier CSV doit répondre aux colonnes suivantes : \ - <strong>name;type;keywords;authors;summary;license;copyright;publicationDate;comment;citation;fileName</strong>.<br/> \ - Certaines colonnes doivent répondre à un format spécifique : \ + <p>Le fichier description.csv contiendra les colonnes suivantes (* = champs obligatoires) : \ <ul>\ - <li><strong>TYPE</strong> comprendra les valeurs 'PERIODICAL_PUBLICATION', 'MEETING_PUBLICATION', 'THESIS',\ - 'REPORT', 'SCIENTIFIC_REPORT', 'SCIENTIFIC_WORK', 'CHAPTER_WORK', 'CONTRACT_REPORT', 'EXPERTISE',\ - 'POSTER', 'CONFERENCE_ARTICLE', 'CONFERENCE_SUMMARY', 'DATA', 'OTHER' ;</li>\ - <li>les <strong>keywords</strong> doivent être séparés par des virgule (<strong>,</strong>) ;</li>\ - <li>le format de la <strong>publicationDate</strong> doit être YYYY/MM/DD (2017/06/01) ;</li>\ - <li>Si un texte comprend des points-virgule (<strong>;</strong>), il doit être écrit encadrés par des guillemets (\"texte ; continue\").\ + <li><strong>name*</strong> : titre du document (champ Title)</li>\ + <li><strong>type*</strong> : type de document (champ Type) aux valeurs décrites ci-après</li>\ + <li><strong>keywords*</strong> : mots clefs, séparés par des virgules (champ Keywords)</li>\ + <li><strong>authors</strong> : auteurs, séparés par des virgules (champ Authors)</li>\ + <li><strong>summary*</strong> : résumé (champ Summary). Ne pas utiliser de ; dans le texte, sinon encapsuler tout le texte entre des \" (exemple : \"text ; rest\")</li>\ + <li><strong>license</strong> : type de licence (champ Licence)</li>\ + <li><strong>copyright</strong> : copyright( champ Copyright)</li>\ + <li><strong>publicationDate</strong> : date de publication (champ Publication Date). Format YYYY/MM/DD</li>\ + <li><strong>comment</strong> : commentaire (champ Comment)</li>\ + <li><strong>citation*</strong> : citation (champ Citation)</li>\ + <li><strong>fileName*</strong> : nom du fichier lié (doit être exactement le même que dans le zip)</li>\ + </ul>\ + Les différentes valeurs possibles pour le <strong>Type</strong> de document sont :\ + <ul>\ + <li><strong>PERIODICAL_PUBLICATION</strong> (publication dans une revue)</li>\ + <li><strong>MEETING_PUBLICATION</strong> (publication dans des colloques ou séminaires)</li>\ + <li><strong>THESIS</strong> (thèse)</li>\ + <li><strong>REPORT</strong> (rapport)</li>\ + <li><strong>SCIENTIFIC_REPORT</strong> (rapport scientifique)</li>\ + <li><strong>SCIENTIFIC_WORK</strong> (ouvrage scientifique)</li>\ + <li><strong>CHAPTER_WORK</strong> (chapitre d'ouvrage)</li>\ + <li><strong>CONTRACT_REPORT</strong> (rapport de contrat)</li>\ + <li><strong>EXPERTISE</strong> (expertise/avis)</li>\ + <li><strong>POSTER</strong> (poster)</li>\ + <li><strong>CONFERENCE_ARTICLE</strong> (acte de colloque)</li>\ + <li><strong>CONFERENCE_SUMMARY</strong> (communication sans actes)</li>\ + <li><strong>DATA</strong> (données)</li>\ + <li><strong>OTHER</strong> (autre)</li>\ </ul>\ </p>", diff --git a/coselmar-ui/src/main/webapp/views/admin/admintools.html b/coselmar-ui/src/main/webapp/views/admin/admintools.html index 625fa52..b58922f 100644 --- a/coselmar-ui/src/main/webapp/views/admin/admintools.html +++ b/coselmar-ui/src/main/webapp/views/admin/admintools.html @@ -83,7 +83,7 @@ {{ 'admin.tools.message.massimport.done' | translate }} </div> <div ng-show="status.massimport === 'error'"> - {{ 'admin.tools.message.massimport.error' | translate }} + {{ 'admin.tools.message.massimport.errors' | translate }} </div> <div ng-show="status.massimport === 'fail'"> @@ -92,6 +92,10 @@ <div ng-show="status.importResult && status.importResult.errorSystem && status.importResult.systemErrorType == 'UNABLE_TO_READ_ZIP'"> {{ 'admin.tools.message.massimport.zipReadFail' | translate }} </div> + <!-- Unable to find CSV data --> + <div ng-show="status.importResult && status.importResult.errorSystem && status.importResult.systemErrorType == 'UNABLE_TO_FIND_CSV'"> + {{ 'admin.tools.message.massimport.csvFindFail' | translate }} + </div> <!-- Unable to read CSV data --> <div ng-show="status.importResult && status.importResult.errorSystem && status.importResult.systemErrorType == 'UNABLE_TO_READ_CSV'"> {{ 'admin.tools.message.massimport.csvReadFail' | translate }} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm