Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 0.0.3-maintenance
  • 1.0-maintenance
  • 2.0-maintenance
  • AOU-1412_Add_checksum_of_DataFile_when_importing_in_Fedora
  • HBO-test-jenkins-library
  • HCA-PortingSolidify-3.2
  • HCA-PortingSolidify-3.5
  • adf-1418-do-not-index-certain-files
  • adf-1464-job-clean-download-files
  • adf-1867-list-publications-stats
  • adf-763-1127-improve-license-mapping-during-imports
  • adf-907-notifications-mark-as-read
  • adf-956-add-imprimatur-and-mode-de-diffussion-for-thesis
  • adf-956-new-document-types-imprimatur-and-mode-de-diffusion
  • adf-979-add-depositor-in-notifications-email
  • adf-squash-commits-jb
  • adf-validator-name
  • aou-1512_fix_coherence_orders_for_indexed_structures
  • contributors-with-names
  • jbc-bibliography-tmpl
  • jbc-csl-correctionsDD
  • jbc-update-coverpage
  • master
  • remove-not-neccessary-ExtendWith-annotations
  • rod-refactor-fedora-storage-get-datastream-index
  • rodn-113-indexing-service
  • rodn-1136-author-can-send-in-validation
  • rodn-1253-fix-validator-comments-notifications
  • rodn-1634-bibliography-add-sort-by-validation-date
  • rodn-1829-scheduled-task-to-export-to-orcid
  • rodn-833-add-validation-rules-before-submit
  • rodn-access-contributor-by-orcid-old
  • rodn-finalize-swiss-library-exports-task
  • rodn-fix-IT
  • rodn-improve-access-it
  • rodn-index-contributors-without-director
  • rodn-index-fix-indexing-with-large-fulltext
  • rodn-index-subtype-code
  • rodn-language-refactoring
  • rodn-merge-users-it
  • rodn-orcid-export-master-with-other-id
  • rodn-orcid-solidify-webhooks
  • rodn-prevent-hibernate-circular-exception
  • rodn-refactor-labels
  • rodn-search-accent-insensitive
  • rodn-shared-reference-to-collection-debug
  • rodn-solidify-3.5
  • rodn-solidify-es-8
  • rodn-use-index-to-find-validable-publications
  • rodn-use-solidify-global-banner
  • unit-test-bibtex-escaper
  • aou-0.0.1
  • aou-0.0.2
  • aou-0.0.3
  • aou-0.0.3-patch1
  • aou-0.0.4
  • aou-0.0.5
  • aou-1.0.0
  • aou-1.0.1
  • aou-1.0.10
  • aou-1.0.11
  • aou-1.0.12
  • aou-1.0.13
  • aou-1.0.14
  • aou-1.0.15
  • aou-1.0.16
  • aou-1.0.17
  • aou-1.0.18
  • aou-1.0.19
  • aou-1.0.2
  • aou-1.0.20
  • aou-1.0.21
  • aou-1.0.3
  • aou-1.0.4
  • aou-1.0.5
  • aou-1.0.6
  • aou-1.0.7
  • aou-1.0.8
  • aou-1.0.9
  • aou-1.1.0
  • aou-2.0.0
  • aou-2.0.0-RC1
  • aou-2.0.0-RC2
  • aou-2.0.0-RC3
  • aou-2.0.1
  • aou-2.0.10
  • aou-2.0.11
  • aou-2.0.12
  • aou-2.0.13
  • aou-2.0.14
  • aou-2.0.15
  • aou-2.0.16
  • aou-2.0.17
  • aou-2.0.18
  • aou-2.0.19
  • aou-2.0.2
  • aou-2.0.20
  • aou-2.0.21
  • aou-2.0.22
  • aou-2.0.23
  • aou-2.0.24
  • aou-2.0.25
  • aou-2.0.26
  • aou-2.0.27
  • aou-2.0.28
  • aou-2.0.29
  • aou-2.0.3
  • aou-2.0.30
  • aou-2.0.31
  • aou-2.0.32
  • aou-2.0.33
  • aou-2.0.34
  • aou-2.0.4
  • aou-2.0.5
  • aou-2.0.6
  • aou-2.0.7
  • aou-2.0.8
  • aou-2.0.9
  • aou-2.1.0
  • aou-2.1.1
  • aou-2.1.10
  • aou-2.1.11
  • aou-2.1.12
  • aou-2.1.13
  • aou-2.1.14
  • aou-2.1.15
  • aou-2.1.16
  • aou-2.1.17
  • aou-2.1.18
  • aou-2.1.19
  • aou-2.1.2
  • aou-2.1.20
  • aou-2.1.21
  • aou-2.1.22
  • aou-2.1.23
  • aou-2.1.24
  • aou-2.1.25
  • aou-2.1.26
  • aou-2.1.27
  • aou-2.1.28
  • aou-2.1.29
  • aou-2.1.3
  • aou-2.1.30
  • aou-2.1.31
  • aou-2.1.32
  • aou-2.1.33
  • aou-2.1.4
  • aou-2.1.5
  • aou-2.1.6
  • aou-2.1.7
  • aou-2.1.8
151 results

Target

Select target project
  • aou/aou-backend
1 result
Select Git revision
  • 0.0.3-maintenance
  • 1.0-maintenance
  • 2.0-maintenance
  • AOU-1412_Add_checksum_of_DataFile_when_importing_in_Fedora
  • HBO-test-jenkins-library
  • HCA-PortingSolidify-3.2
  • HCA-PortingSolidify-3.5
  • adf-1418-do-not-index-certain-files
  • adf-1464-job-clean-download-files
  • adf-1867-list-publications-stats
  • adf-763-1127-improve-license-mapping-during-imports
  • adf-907-notifications-mark-as-read
  • adf-956-add-imprimatur-and-mode-de-diffussion-for-thesis
  • adf-956-new-document-types-imprimatur-and-mode-de-diffusion
  • adf-979-add-depositor-in-notifications-email
  • adf-squash-commits-jb
  • adf-validator-name
  • aou-1512_fix_coherence_orders_for_indexed_structures
  • contributors-with-names
  • jbc-bibliography-tmpl
  • jbc-csl-correctionsDD
  • jbc-update-coverpage
  • master
  • remove-not-neccessary-ExtendWith-annotations
  • rod-refactor-fedora-storage-get-datastream-index
  • rodn-113-indexing-service
  • rodn-1136-author-can-send-in-validation
  • rodn-1253-fix-validator-comments-notifications
  • rodn-1634-bibliography-add-sort-by-validation-date
  • rodn-1829-scheduled-task-to-export-to-orcid
  • rodn-833-add-validation-rules-before-submit
  • rodn-access-contributor-by-orcid-old
  • rodn-finalize-swiss-library-exports-task
  • rodn-fix-IT
  • rodn-improve-access-it
  • rodn-index-contributors-without-director
  • rodn-index-fix-indexing-with-large-fulltext
  • rodn-index-subtype-code
  • rodn-language-refactoring
  • rodn-merge-users-it
  • rodn-orcid-export-master-with-other-id
  • rodn-orcid-solidify-webhooks
  • rodn-prevent-hibernate-circular-exception
  • rodn-refactor-labels
  • rodn-search-accent-insensitive
  • rodn-shared-reference-to-collection-debug
  • rodn-solidify-3.5
  • rodn-solidify-es-8
  • rodn-use-index-to-find-validable-publications
  • rodn-use-solidify-global-banner
  • unit-test-bibtex-escaper
  • aou-0.0.1
  • aou-0.0.2
  • aou-0.0.3
  • aou-0.0.3-patch1
  • aou-0.0.4
  • aou-0.0.5
  • aou-1.0.0
  • aou-1.0.1
  • aou-1.0.10
  • aou-1.0.11
  • aou-1.0.12
  • aou-1.0.13
  • aou-1.0.14
  • aou-1.0.15
  • aou-1.0.16
  • aou-1.0.17
  • aou-1.0.18
  • aou-1.0.19
  • aou-1.0.2
  • aou-1.0.20
  • aou-1.0.21
  • aou-1.0.3
  • aou-1.0.4
  • aou-1.0.5
  • aou-1.0.6
  • aou-1.0.7
  • aou-1.0.8
  • aou-1.0.9
  • aou-1.1.0
  • aou-2.0.0
  • aou-2.0.0-RC1
  • aou-2.0.0-RC2
  • aou-2.0.0-RC3
  • aou-2.0.1
  • aou-2.0.10
  • aou-2.0.11
  • aou-2.0.12
  • aou-2.0.13
  • aou-2.0.14
  • aou-2.0.15
  • aou-2.0.16
  • aou-2.0.17
  • aou-2.0.18
  • aou-2.0.19
  • aou-2.0.2
  • aou-2.0.20
  • aou-2.0.21
  • aou-2.0.22
  • aou-2.0.23
  • aou-2.0.24
  • aou-2.0.25
  • aou-2.0.26
  • aou-2.0.27
  • aou-2.0.28
  • aou-2.0.29
  • aou-2.0.3
  • aou-2.0.30
  • aou-2.0.31
  • aou-2.0.32
  • aou-2.0.33
  • aou-2.0.34
  • aou-2.0.4
  • aou-2.0.5
  • aou-2.0.6
  • aou-2.0.7
  • aou-2.0.8
  • aou-2.0.9
  • aou-2.1.0
  • aou-2.1.1
  • aou-2.1.10
  • aou-2.1.11
  • aou-2.1.12
  • aou-2.1.13
  • aou-2.1.14
  • aou-2.1.15
  • aou-2.1.16
  • aou-2.1.17
  • aou-2.1.18
  • aou-2.1.19
  • aou-2.1.2
  • aou-2.1.20
  • aou-2.1.21
  • aou-2.1.22
  • aou-2.1.23
  • aou-2.1.24
  • aou-2.1.25
  • aou-2.1.26
  • aou-2.1.27
  • aou-2.1.28
  • aou-2.1.29
  • aou-2.1.3
  • aou-2.1.30
  • aou-2.1.31
  • aou-2.1.32
  • aou-2.1.33
  • aou-2.1.4
  • aou-2.1.5
  • aou-2.1.6
  • aou-2.1.7
  • aou-2.1.8
151 results
Show changes
Commits on Source (3)
Showing
with 405 additions and 246 deletions
......@@ -9,12 +9,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
......@@ -33,6 +33,7 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -360,8 +361,12 @@ public class StructureService extends AouResourceService<Structure> {
LocalDate validUntil = null;
if (!item.isNull(JSON_FILE_FIELD_VALID_UNTIL)) {
Integer year = item.getInt(JSON_FILE_FIELD_VALID_UNTIL);
validUntil = LocalDate.of(year, 12, 31);
try {
Integer year = item.getInt(JSON_FILE_FIELD_VALID_UNTIL);
validUntil = LocalDate.of(year, 12, 31);
} catch (JSONException e) {
validUntil = LocalDate.parse(item.getString(JSON_FILE_FIELD_VALID_UNTIL));
}
}
this.createStructure(resId, parentId, status, cnStructC, cStruct, name, acronym, dewey, validUntil, sortValue);
......
......@@ -130,13 +130,13 @@ public class ExportMetadataController extends SolidifyController {
return switch (format) {
case XML -> "metadata.xml";
case JSON -> "metadata.json";
case CSV -> "metadata.csv";
case TSV -> "metadata.tsv";
};
}
private String getContentType(ExportFormat format) {
return switch (format) {
case CSV -> "text/csv";
case TSV -> "text/tab-separated-values";
case XML -> "application/xml";
case JSON -> "application/json";
};
......
......@@ -28,17 +28,17 @@ import java.util.List;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Service;
import ch.unige.solidify.exception.SolidifyRuntimeException;
import ch.unige.aou.AouMetadataVersion;
import ch.unige.aou.controller.AdminController;
import ch.unige.aou.model.access.ExportFormat;
import ch.unige.aou.model.index.PublicationIndexEntry;
import ch.unige.aou.model.xml.deposit.v2_4.DepositDoc;
import ch.unige.aou.model.xml.list_deposits.Publications;
import ch.unige.aou.service.MetadataService;
import ch.unige.aou.service.metadata.MetadataExtractor;
import ch.unige.aou.service.metadata.PublicationsAdapter;
import ch.unige.aou.service.metadata.Xml2CsvConvertor;
import ch.unige.aou.service.metadata.Xml2TsvConvertor;
@Service
@ConditionalOnBean(AdminController.class)
......@@ -56,13 +56,13 @@ public class ExportMetadataService {
return switch (format) {
case JSON -> this.exportMetadataInJson(indexResults);
case XML -> this.exportMetadataInXml(indexResults);
case CSV -> this.exportMetadataInCsv(indexResults);
case TSV -> this.exportMetadataInTsv(indexResults);
};
}
private String exportMetadataInCsv(List<PublicationIndexEntry> indexResults) {
private String exportMetadataInTsv(List<PublicationIndexEntry> indexResults) {
Publications publications = this.getPublications(indexResults);
return Xml2CsvConvertor.convertToCSV(publications);
return Xml2TsvConvertor.convertToTSV(publications);
}
private String exportMetadataInXml(List<PublicationIndexEntry> indexResults) {
......@@ -80,8 +80,10 @@ public class ExportMetadataService {
final MetadataExtractor metadataExtractor = this.metadataService.getMetadataExtractor(AouMetadataVersion.getDefaultVersion());
for (PublicationIndexEntry index: indexResults) {
final Object depositDoc = metadataExtractor.createDepositDocObjectFromXml(index.getXmlMetadata());
this.publicationsAdapter.removeSensitiveInformationFromDepositDoc((DepositDoc) depositDoc);
this.publicationsAdapter.addPublication(publications, depositDoc, index.getArchiveId());
}
return publications;
}
}
......@@ -268,13 +268,13 @@
{
"id": "43",
"parentId": "30",
"status": "ACTIVE",
"status": "HISTORICAL",
"cStruct": "161",
"cnStructC": "512",
"name": "D\u00e9partement de biologie mol\u00e9culaire",
"acronym": null,
"dewey": "570",
"validUntil": null,
"validUntil": "2020",
"lft": "37",
"rght": "38",
"sortValue": 190
......@@ -324,13 +324,13 @@
{
"id": "46",
"parentId": "30",
"status": "ACTIVE",
"status": "HISTORICAL",
"cStruct": "165",
"cnStructC": "347",
"name": "D\u00e9partement de biologie cellulaire",
"acronym": null,
"dewey": "570",
"validUntil": null,
"validUntil": "2020",
"lft": "45",
"rght": "46",
"sortValue": 230
......@@ -688,13 +688,13 @@
{
"id": "202",
"parentId": "201",
"status": "ACTIVE",
"status": "HISTORICAL",
"cStruct": "22A92",
"cnStructC": "15602",
"name": "Unit\u00e9 des internistes g\u00e9n\u00e9ralistes et p\u00e9diatres",
"acronym": null,
"dewey": "613",
"validUntil": null,
"validUntil": "2020",
"lft": "97",
"rght": "98",
"sortValue": 490
......@@ -2112,5 +2112,65 @@
"lft": "302",
"rght": "303",
"sortValue": 1500
},
{
"id": "2cf4110a-abc2-4313-a3cf-77ad940393bb",
"parentId": "11",
"status": "ACTIVE",
"cStruct": "16120",
"cnStructC": "0CR",
"name": "Service des Relations Internationales & Partenariats",
"acronym": "SRIP",
"dewey": "320",
"validUntil": null,
"sortValue": 1510
},
{
"id": "3eb925bf-9188-464b-a497-86ee1d993031",
"parentId": "1",
"status": "ACTIVE",
"cStruct": "0M3",
"cnStructC": "16423",
"name": "Centre Maurice Chalumeau en sciences des sexualités",
"acronym": null,
"dewey": "306.7",
"validUntil": null,
"sortValue": 2620
},
{
"id": "7daed2ee-1311-4824-9df9-2e51260a966a",
"parentId": "30",
"status": "ACTIVE",
"cStruct": "16484",
"cnStructC": "168",
"name": "Département de biologie moléculaire et cellulaire",
"acronym": "MOCEL",
"dewey": "570",
"validUntil": null,
"sortValue": 240
},
{
"id": "8c5189d4-0ec1-424f-82f8-924b0d97c05d",
"parentId": "1",
"status": "HISTORICAL",
"cStruct": "0D4",
"cnStructC": "1401",
"name": "Centre universitaire d'écologie humaine et sciences de l'environnement",
"acronym": "CUEH",
"dewey": "333.7-333.9",
"validUntil": "2009",
"sortValue": 2195
},
{
"id": "f1b73ff3-6e14-4dab-95fa-f3eb13e955f9",
"parentId": "11",
"status": "ACTIVE",
"cStruct": "0C42",
"cnStructC": "10080",
"name": "Centre pour la formation continue et à distance",
"acronym": null,
"dewey": "374",
"validUntil": null,
"sortValue": 1475
}
]
......@@ -296,7 +296,7 @@ public class AouConstants {
public static final String DOCUMENT_FILE_TYPE_BOOK_CHAPTER_SUBMITTED_VERSION = "Book chapter (Submitted version)";
public static final String DOCUMENT_FILE_TYPE_ENCYCLOPEDIA_ENTRY_SUBMITTED_VERSION = "Encyclopedia entry (Submitted version)";
public static final String[] SUBMITTED_VERSION_DOCUMENT_FILE_TYPES = {
private static final String[] SUBMITTED_VERSION_DOCUMENT_FILE_TYPES = {
DOCUMENT_FILE_TYPE_ARTICLE_SUBMITTED_VERSION,
DOCUMENT_FILE_TYPE_PROCEEDINGS_SUBMITTED_VERSION,
DOCUMENT_FILE_TYPE_PROCEEDINGS_CHAPTER_SUBMITTED_VERSION,
......@@ -305,6 +305,10 @@ public class AouConstants {
DOCUMENT_FILE_TYPE_ENCYCLOPEDIA_ENTRY_SUBMITTED_VERSION
};
public static String[] getSubmittedVersionDocumentFileTypes() {
return SUBMITTED_VERSION_DOCUMENT_FILE_TYPES.clone();
}
// Document file versions
public static final String DOCUMENT_PUBLISHED_VERSION_EN = "Published version";
public static final String DOCUMENT_ACCEPTED_VERSION_EN = "Accepted version";
......@@ -413,6 +417,8 @@ public class AouConstants {
public static final String INDEX_FIELD_CONTRIBUTORS_CN_INDIVIDU = "contributors.cnIndividu";
public static final String INDEX_FIELD_EMBARGO_END_DATES = "embargoEndDates";
public static final String INDEX_FIELD_HTML_META_HEADERS = "htmlMetaHeaders";
public static final String INDEX_FIELD_STRUCTURES_WITH_PARENT = "structuresWithParentsNames";
public static final String INDEX_FIELD_TITLE = "title";
public static final String INDEX_FIELD_ALIAS_UNIGE_DIRECTORS = "unigeDirector";
public static final String INDEX_FIELD_ALIAS_GLOBAL_SEARCH = "globalSearch";
......@@ -507,91 +513,107 @@ public class AouConstants {
public static final String TEMPORARY_TEST_DATA_LABEL = "[Temporary Test Data] ";
public static final String NO_REPLY_PREFIX = "noreply-";
public static final String TEST_RES_ID = "test";
public static final String TEST_DEPOSIT_JSON_FORM_DATA_TEMPLATE = "{\n"
+ " \"contributors\": {\n"
+ " \"contributors\": [\n"
+ " {\n"
+ " \"contributor\": {\n"
+ " \"cnIndividu\": \"12345\",\n"
+ " \"email\": \"john.doe@example.com\",\n"
+ " \"firstname\": \"John\",\n"
+ " \"institution\": \"unige\",\n"
+ " \"lastname\": \"Doe\",\n"
+ " \"orcid\": \"1234-1234-1234-1234\",\n"
+ " \"role\": \"author\"\n"
+ " }\n"
+ " }\n"
+ " ]\n"
+ " },\n"
+ " \"description\": {\n"
+ " \"languages\": [ {\n"
+ " \"language\" : \"ENG\"\n"
+ " }],\n"
+ " \"dates\": [{\n"
+ " \"date\": \"24.07.2009\",\n"
+ " \"type\": \"PUBLICATION\"\n"
+ " }],\n"
+ " \"container\": {\n"
+ " \"identifiers\": {\n"
+ " \"issn\": \"0028-0836\"\n"
+ " },\n"
+ " \"issue\": \"8\",\n"
+ " \"title\": \"Nature\"\n"
+ " },\n"
+ " \"collections\": [{\n"
+ " \"name\": \"Collection1\"\n"
+ " }, {\n"
+ " \"name\": \"Collection2\",\n"
+ " \"number\": \"888\"\n"
+ " }"
+ " ]\n"
+ " },\n"
+ " \"type\": {\n"
+ " \"subsubtype\": \"A1-LETTRE\",\n"
+ " \"subtype\": \"A1\",\n"
+ " \"title\": {\"lang\": \"FRA\", \"text\" : \"%s\"},\n"
+ " \"type\": \"ARTICLE\"\n"
+ " }\n"
+ "}";
public static final String STRUCTURE_JSON_V2_0 = "\"academicStructures\": [\n"
+ " {\n"
+ " \"code\": \"%s\",\n"
+ " \"oldCode\": \"%s\",\n"
+ " \"name\": \"%s\"\n"
+ " }\n"
+ " ],";
public static final String TEST_DEPOSIT_JSON_FORM_DATA_TEMPLATE = """
{
"contributors": {
"contributors": [
{
"contributor": {
"cnIndividu": "12345",
"email": "john.doe@example.com",
"firstname": "John",
"institution": "unige",
"lastname": "Doe",
"orcid": "1234-1234-1234-1234",
"role": "author"
}
}
]
},
"description": {
"languages": [{
"language" : "ENG"
}],
"dates": [{
"date": "24.07.2009",
"type": "PUBLICATION"
}],
"container": {
"identifiers": {
"issn": "0028-0836"
},
"issue": "8",
"title": "Nature"
},
"collections": [
{
"name": "Collection1"
},
{
"name": "Collection2",
"number": "888"
}
]
},
"type": {
"subsubtype": "A1-LETTRE",
"subtype": "A1",
"title": { "lang": "FRA", "text" : "%s"},
"type": "ARTICLE"
}
}"
""";
public static final String STRUCTURE_JSON_V2_0 = """
"academicStructures": [
{
"code": "%s",
"oldCode": "%s",
"name": "%s"
}
],
""";
public static final String STRUCTURE_JSON_V2_1 = "\"academicStructures\": [\"%s\"],";
public static final String RESEARCH_GROUP_JSON = "\"groups\": [\n"
+ " {\n"
+ " \"code\": \"%s\",\n"
+ " \"name\": \"%s\"\n"
+ " }\n"
+ " ],";
public static final String RESEARCH_GROUP_JSON = """
"groups": [
{
"code": "%s",
"name": "%s"
}
],
""";
public static final String TEST_DEPOSIT_TITLE = "Test deposit";
public static final String TEST_DEPOSIT_JSON_FORM_DATA = String.format(TEST_DEPOSIT_JSON_FORM_DATA_TEMPLATE, TEST_DEPOSIT_TITLE);
public static final String TEST_DEPOSIT_XML_METADATA_TEMPLATE_2_3 = "<deposit_doc xmlns=\"https://archive-ouverte.unige.ch/deposit/v2.3\">"
+ " <type>Diplôme</type>"
+ " <subtype>Thèse</subtype>"
+ " <title>%s</title>"
+ " <languages><language>eng</language></languages>"
+ " <pages>"
+ " <paging>p. 12345 -67</paging>"
+ " </pages>"
+ "</deposit_doc>";
public static final String TEST_DEPOSIT_XML_METADATA_TEMPLATE_2_4 = "<deposit_doc xmlns=\"https://archive-ouverte.unige.ch/deposit/v2.4\">"
+ " <type>Diplôme</type>"
+ " <subtype>Thèse</subtype>"
+ " <title>%s</title>"
+ " <languages><language>eng</language></languages>"
+ " <pages>"
+ " <paging>p. 12345 -67</paging>"
+ " </pages>"
+ "</deposit_doc>";
public static final String TEST_DEPOSIT_XML_METADATA_TEMPLATE_2_3 = """
<deposit_doc xmlns="https://archive-ouverte.unige.ch/deposit/v2.3">
<type>Diplôme</type>
<subtype>Thèse</subtype>
<title>%s</title>
<languages>
<language>eng</language>
</languages>
<pages>
<paging>p. 12345 -67</paging>
</pages>
</deposit_doc>
""";
public static final String TEST_DEPOSIT_XML_METADATA_TEMPLATE_2_4 = """
<deposit_doc xmlns="https://archive-ouverte.unige.ch/deposit/v2.4">
<type>Diplôme</type>
<subtype>Thèse</subtype>
<title>%s</title>
<languages>
<language>eng</language>
</languages>
<pages>
<paging>p. 12345 -67</paging>
</pages>
</deposit_doc>
""";
// Exception error message
public static final String BAD_SEARCH_REQUEST = "Bad search request";
......
......@@ -26,7 +26,7 @@ package ch.unige.aou.model.access;
public enum ExportFormat {
JSON("json"),
XML("xml"),
CSV("csv");
TSV("tsv");
private final String name;
......
......@@ -60,7 +60,7 @@ public class PublicationIndexEntry extends IndexMetadata implements OAIRecord {
@JsonIgnore
public String getTitle() {
return this.getMetadata().get("title").toString();
return this.getMetadata().get(AouConstants.INDEX_FIELD_TITLE).toString();
}
@JsonIgnore
......@@ -106,10 +106,9 @@ public class PublicationIndexEntry extends IndexMetadata implements OAIRecord {
public List<String> getContributorsCnIndividus() {
if (this.getMetadata().containsKey(AouConstants.INDEX_FIELD_CONTRIBUTORS)) {
List<Map<String, String>> propContributors = (List<Map<String, String>>) this.getMetadata().get(AouConstants.INDEX_FIELD_CONTRIBUTORS);
List<String> listCnIndividu = propContributors.stream()
return propContributors.stream()
.filter(m -> m.containsKey(AouConstants.INDEX_FIELD_ALIAS_CN_INDIVIDU))
.map(m -> m.get(AouConstants.INDEX_FIELD_ALIAS_CN_INDIVIDU)).toList();
return listCnIndividu;
}
return new ArrayList<>();
}
......@@ -181,8 +180,7 @@ public class PublicationIndexEntry extends IndexMetadata implements OAIRecord {
return creation;
} else {
return OffsetDateTime.parse(
(String) this.getMetadata(updateFile.split(SolidifyConstants.REGEX_FIELD_PATH_SEP))
).toInstant()
(String) this.getMetadata(updateFile.split(SolidifyConstants.REGEX_FIELD_PATH_SEP))).toInstant()
.atOffset(ZoneOffset.UTC)
.withNano(0);
}
......@@ -195,8 +193,7 @@ public class PublicationIndexEntry extends IndexMetadata implements OAIRecord {
return validationDate;
} else {
return OffsetDateTime.parse(
(String) this.getMetadata(updateFile.split(SolidifyConstants.REGEX_FIELD_PATH_SEP))
).toInstant()
(String) this.getMetadata(updateFile.split(SolidifyConstants.REGEX_FIELD_PATH_SEP))).toInstant()
.atOffset(ZoneOffset.UTC)
.withNano(0);
}
......@@ -209,8 +206,7 @@ public class PublicationIndexEntry extends IndexMetadata implements OAIRecord {
return lastIndexation;
} else {
return OffsetDateTime.parse(
(String) this.getMetadata(lastIndexationDateStr.split(SolidifyConstants.REGEX_FIELD_PATH_SEP))
).toInstant()
(String) this.getMetadata(lastIndexationDateStr.split(SolidifyConstants.REGEX_FIELD_PATH_SEP))).toInstant()
.atOffset(ZoneOffset.UTC)
.withNano(0);
}
......@@ -218,8 +214,8 @@ public class PublicationIndexEntry extends IndexMetadata implements OAIRecord {
@JsonIgnore
public String getContainerTitle() {
if (this.getMetadata("container", "title") != null) {
return this.getMetadata("container", "title").toString();
if (this.getMetadata("container", AouConstants.INDEX_FIELD_TITLE) != null) {
return this.getMetadata("container", AouConstants.INDEX_FIELD_TITLE).toString();
}
return null;
}
......
......@@ -474,6 +474,7 @@
<xs:complexType>
<xs:all>
<xs:element ref="diffusion" minOccurs="0"/>
<xs:element ref="structures" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
......@@ -489,4 +490,19 @@
</xs:simpleType>
</xs:element>
<xs:element name="structures">
<xs:complexType>
<xs:sequence>
<xs:element ref="structure" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="structure">
<xs:simpleType>
<xs:restriction base="xs:string" />
</xs:simpleType>
</xs:element>
</xs:schema>
......@@ -669,17 +669,32 @@
</marc:datafield>
</xsl:for-each>
<!-- 928 - Stuctures academiques -->
<!-- 928 - Structures academiques -->
<xsl:for-each select="aou_deposit:academic_structures/aou_deposit:academic_structure[aou_deposit:name!='']">
<marc:datafield tag="928" ind1=" " ind2=" ">
<xsl:variable name="structure_position">
<xsl:value-of select="position()"/>
</xsl:variable>
<marc:subfield code="a">
<xsl:value-of select="./aou_deposit:name"/>
</marc:subfield>
<marc:subfield code="b">
<xsl:value-of select="(../../aou_deposit:additionalMetadata/aou_deposit:structures/aou_deposit:structure)[position()=$structure_position]"/>
</marc:subfield>
<marc:subfield code="c">
<xsl:value-of select="./aou_deposit:code"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
<!-- 929 - Structures -->
<xsl:for-each select="aou_deposit:additionalMetadata/aou_deposit:structures/aou_deposit:structure">
<marc:datafield tag="929" ind1=" " ind2=" ">
<marc:subfield code="a">
<xsl:value-of select="."/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
<!-- 980 - Type du document -->
<marc:datafield tag="980" ind1=" " ind2=" ">
......
......@@ -696,18 +696,24 @@
</marc:datafield>
</xsl:for-each>
<!-- 928 - Stuctures academiques -->
<!-- 928 - Structures academiques -->
<xsl:for-each select="aou_deposit:academic_structures/aou_deposit:academic_structure[aou_deposit:name!='']">
<marc:datafield tag="928" ind1=" " ind2=" ">
<xsl:variable name="structure_position">
<xsl:value-of select="position()"/>
</xsl:variable>
<marc:subfield code="a">
<xsl:value-of select="./aou_deposit:name"/>
</marc:subfield>
<marc:subfield code="b">
<xsl:value-of select="(../../aou_deposit:additionalMetadata/aou_deposit:structures/aou_deposit:structure)[position()=$structure_position]"/>
</marc:subfield>
<marc:subfield code="c">
<xsl:value-of select="./aou_deposit:code"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
<!-- 980 - Type du document -->
<marc:datafield tag="980" ind1=" " ind2=" ">
<!-- Temporaire jusqu'à la correction C4 -> L4 dans interface de consultation -->
......
......@@ -558,6 +558,10 @@ p.intro {
<tr><td class="key">Abstract</td><td class="value"><i><xsl:value-of select="@lang"/></i> : <xsl:value-of select="."/></td></tr>
</xsl:template>
<xsl:template match="aou_deposit:keyword" xmlns:aou_deposit="https://archive-ouverte.unige.ch/deposit/v2.4">
<tr><td class="key">Keyword</td><td class="value"><xsl:value-of select="."/></td></tr>
</xsl:template>
<xsl:template match="aou_deposit:publisher_version_url" xmlns:aou_deposit="https://archive-ouverte.unige.ch/deposit/v2.4">
<tr><td class="key">Publisher</td><td class="value"><xsl:value-of select="."/></td></tr>
</xsl:template>
......@@ -570,6 +574,18 @@ p.intro {
<tr><td class="key">Structure</td><td class="value"><xsl:value-of select="./aou_deposit:name"/> (<i><xsl:value-of select="./aou_deposit:code"/></i>)</td></tr>
</xsl:template>
<xsl:template match="aou_deposit:structure" xmlns:aou_deposit="https://archive-ouverte.unige.ch/deposit/v2.4">
<tr><td class="key">Structure with parent structure(s)</td><td class="value"><xsl:value-of select="."/></td></tr>
</xsl:template>
<xsl:template match="aou_deposit:group" xmlns:aou_deposit="https://archive-ouverte.unige.ch/deposit/v2.4">
<tr><td class="key">Group</td><td class="value"><xsl:value-of select="./aou_deposit:name"/> (<i><xsl:value-of select="./aou_deposit:resId"/></i>)</td></tr>
</xsl:template>
<xsl:template match="aou_deposit:diffusion" xmlns:aou_deposit="https://archive-ouverte.unige.ch/deposit/v2.4">
<tr><td class="key">Diffusion</td><td class="value"><xsl:value-of select="."/></td></tr>
</xsl:template>
<xsl:template match="aou_deposit:file" xmlns:aou_deposit="https://archive-ouverte.unige.ch/deposit/v2.4">
<xsl:choose>
<xsl:when test="contains(./aou_deposit:type,'Published')">
......
......@@ -4,7 +4,7 @@
xmlns:publications="https://archive-ouverte.unige.ch/deposit/list-deposits">
<xsl:output method="text" encoding="UTF-8"/>
<!-- Header of the CSV -->
<!-- Header of the TSV -->
<xsl:template match="/">
<xsl:text>archiveId,type,subtype,title,language,first_online,publication_date,author_lastname,author_firstname,author_institution,doi,pmid,issn,abstract,keywords&#10;</xsl:text>
<xsl:apply-templates select="//publications:publication"/>
......
......@@ -66,8 +66,14 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.xml.parsers.ParserConfigurationException;
import jakarta.xml.bind.JAXB;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
......@@ -76,11 +82,6 @@ import org.springframework.stereotype.Service;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import jakarta.xml.bind.JAXB;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import ch.unige.solidify.SolidifyConstants;
import ch.unige.solidify.exception.SolidifyProcessingException;
import ch.unige.solidify.exception.SolidifyRestException;
......@@ -996,7 +997,7 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
fulltextVersions.add(fulltextVersion);
}
//Check if file is principal
// Check if file is principal
if (!hasPrincipalFile && this.isPrincipalFile(publicationSubtypeId, metadataFile)) {
hasPrincipalFile = true;
break;
......@@ -1058,8 +1059,7 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
|| metadataFile.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_ARTICLE)
|| metadataFile.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_BOOK)
|| metadataFile.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_BOOK_CHAPTER)
|| metadataFile.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_PROCEEDINGS_CHAPTER)
);
|| metadataFile.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_PROCEEDINGS_CHAPTER));
}
private void fillEmbargoEndDates(Object depositDoc, DepositDocAdapter depositDocAdapter, Map<String, Object> properties) {
......@@ -1090,9 +1090,10 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
Map<String, List<String>> accessLevelByTypes = new HashMap<>();
// Discard files that must not be considered to compute access level
List<MetadataFile> files = depositDocAdapter.getFiles(depositDoc).stream().filter(f ->
!f.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_IMPRIMATUR_VALUE)
&& !f.getType().equals(DOCUMENT_FILE_TYPE_PUBLICATION_MODE_VALUE)).collect(Collectors.toList());
List<MetadataFile> files = depositDocAdapter.getFiles(depositDoc).stream()
.filter(f -> !f.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_IMPRIMATUR_VALUE)
&& !f.getType().equals(DOCUMENT_FILE_TYPE_PUBLICATION_MODE_VALUE))
.collect(Collectors.toList());
// compute a Map with a list of access levels for each type of file
for (MetadataFile metadataFile : files) {
......@@ -1161,8 +1162,9 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
List<MetadataFile> principalFiles = this.getPrincipalFiles(depositDoc, depositDocAdapter);
// Remove Preprints and Submitted version from principal files used to compute Open Access value
List<MetadataFile> cleanedPrincipalFiles = principalFiles.stream()
.filter(mf -> !mf.getType().equals(DOCUMENT_FILE_TYPE_PREPRINT) && Arrays.stream(AouConstants.SUBMITTED_VERSION_DOCUMENT_FILE_TYPES)
.noneMatch(type -> type.equals(mf.getType()))).collect(Collectors.toList());
.filter(mf -> !mf.getType().equals(DOCUMENT_FILE_TYPE_PREPRINT) && Arrays.stream(AouConstants.getSubmittedVersionDocumentFileTypes())
.noneMatch(type -> type.equals(mf.getType())))
.toList();
// Any file with current access public ?
if (cleanedPrincipalFiles.stream().anyMatch(mf -> mf.getCurrentAccessLevel().equals(DocumentFile.AccessLevel.PUBLIC.metadataValue()))) {
......@@ -1435,8 +1437,7 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
private void fillCitationFirstPage(Map<String, String> htmlHeadersMap, Object depositDoc, DepositDocAdapter depositDocAdapter) {
if (this.isArticleOrJournal(depositDoc, depositDocAdapter)
|| this.isChapitreLivreOrContributionDict(depositDoc, depositDocAdapter)
|| this.isChapitreActesOrPresentationOrPoster(depositDoc, depositDocAdapter)
) {
|| this.isChapitreActesOrPresentationOrPoster(depositDoc, depositDocAdapter)) {
String firstPage = null;
String other = depositDocAdapter.getPagingOther(depositDoc);
if (!StringTool.isNullOrEmpty(other)) {
......@@ -1463,8 +1464,7 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
}
}
private void fillCitationDissertationInstitution(Map<String, String> htmlHeadersMap, Object depositDoc, DepositDocAdapter
depositDocAdapter) {
private void fillCitationDissertationInstitution(Map<String, String> htmlHeadersMap, Object depositDoc, DepositDocAdapter depositDocAdapter) {
if (AouConstants.DEPOSIT_TYPE_DIPLOME_NAME.equals(depositDocAdapter.getType(depositDoc))) {
this.putIfNotNull(htmlHeadersMap, "citation_dissertation_institution", AouConstants.UNIVERSITY_OF_GENEVA_FR);
}
......@@ -1488,8 +1488,7 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
List<MetadataFile> files = depositDocAdapter.getFiles(depositDoc);
List<MetadataFile> publicFiles = files.stream().filter(f -> !f.getType().equals(AouConstants.DOCUMENT_FILE_TYPE_VIGNETTE)
&& DocumentFile.AccessLevel.fromMetadataValue(f.getAccessLevel()) == DocumentFile.AccessLevel.PUBLIC
&& !this.getCurrentDiffusion(f).equals(AouConstants.EMBARGOED_ACCESS_TEXT)
).collect(Collectors.toList());
&& !this.getCurrentDiffusion(f).equals(AouConstants.EMBARGOED_ACCESS_TEXT)).collect(Collectors.toList());
List<String> pdfUrls = new ArrayList<>();
for (MetadataFile file : publicFiles) {
......@@ -1533,8 +1532,7 @@ public class CommonMetadataService extends AouService implements OAIMetadataServ
if (AouConstants.DEPOSIT_TYPE_RAPPORT_NAME.equals(depositDocAdapter.getType(depositDoc))
|| this.isLivreOrOuvrageCollectifOrActesConference(depositDoc, depositDocAdapter)
|| this.isChapitreLivreOrContributionDict(depositDoc, depositDocAdapter)
|| this.isChapitreActesOrPresentationOrPoster(depositDoc, depositDocAdapter)
) {
|| this.isChapitreActesOrPresentationOrPoster(depositDoc, depositDocAdapter)) {
String publisherName = depositDocAdapter.getPublisherName(depositDoc);
if (!StringTool.isNullOrEmpty(publisherName)) {
this.putIfNotNull(htmlHeadersMap, "citation_publisher", publisherName);
......
......@@ -32,17 +32,18 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.Marshaller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.unige.solidify.exception.SolidifyRuntimeException;
import ch.unige.solidify.util.StringTool;
......@@ -849,6 +850,23 @@ public class DepositDocV2Adapter implements DepositDocAdapter {
depositDoc.getAdditionalMetadata().setDiffusion(additionalMetadata.get(AouConstants.INDEX_FIELD_DIFFUSION).toString());
}
// Structures with parent name
if (additionalMetadata.containsKey(AouConstants.INDEX_FIELD_STRUCTURES_WITH_PARENT)) {
this.ensureStructuresExists(depositDoc);
for (List<String> structure : (List<List<String>>) additionalMetadata.get(AouConstants.INDEX_FIELD_STRUCTURES_WITH_PARENT)) {
StringBuilder sb = new StringBuilder();
for (String structureItem : structure) {
if (sb.isEmpty()) {
sb.append(structureItem);
} else {
sb.insert(0, " / ");
sb.insert(0, structureItem);
}
}
depositDoc.getAdditionalMetadata().getStructures().getStructure().add(sb.toString());
}
}
// Contributors' ORCID
if (additionalMetadata.containsKey(AouConstants.INDEX_FIELD_CONTRIBUTORS) && !((List) additionalMetadata.get(
AouConstants.INDEX_FIELD_CONTRIBUTORS)).isEmpty()) {
......@@ -875,6 +893,13 @@ public class DepositDocV2Adapter implements DepositDocAdapter {
}
}
private void ensureStructuresExists(DepositDoc depositDoc) {
this.ensureAdditionalMetadataExists(depositDoc);
if (depositDoc.getAdditionalMetadata().getStructures() == null) {
depositDoc.getAdditionalMetadata().setStructures(this.factory.createStructures());
}
}
@Override
public String serializeDepositDocToXml(Object depositDocObject) {
try {
......
......@@ -59,9 +59,11 @@ import ch.unige.aou.AouConstants;
import ch.unige.aou.AouMetadataVersion;
import ch.unige.aou.model.xml.deposit.v2_4.Abstracts;
import ch.unige.aou.model.xml.deposit.v2_4.AcademicStructures;
import ch.unige.aou.model.xml.deposit.v2_4.AccessLevel;
import ch.unige.aou.model.xml.deposit.v2_4.AuthorRole;
import ch.unige.aou.model.xml.deposit.v2_4.Classifications;
import ch.unige.aou.model.xml.deposit.v2_4.Collections;
import ch.unige.aou.model.xml.deposit.v2_4.Contributor;
import ch.unige.aou.model.xml.deposit.v2_4.Contributors;
import ch.unige.aou.model.xml.deposit.v2_4.Corrections;
import ch.unige.aou.model.xml.deposit.v2_4.Datasets;
......@@ -69,6 +71,7 @@ import ch.unige.aou.model.xml.deposit.v2_4.DateWithType;
import ch.unige.aou.model.xml.deposit.v2_4.Dates;
import ch.unige.aou.model.xml.deposit.v2_4.DepositDoc;
import ch.unige.aou.model.xml.deposit.v2_4.DepositIdentifiers;
import ch.unige.aou.model.xml.deposit.v2_4.FileType;
import ch.unige.aou.model.xml.deposit.v2_4.Files;
import ch.unige.aou.model.xml.deposit.v2_4.Fundings;
import ch.unige.aou.model.xml.deposit.v2_4.Groups;
......@@ -212,4 +215,21 @@ public class PublicationsAdapter {
return mapper;
}
public void removeSensitiveInformationFromDepositDoc(DepositDoc depositDoc) {
depositDoc.setDoctorAddress(null);
depositDoc.setDoctorEmail(null);
if (depositDoc.getFiles() != null) {
depositDoc.getFiles().getFile().removeIf(file -> file.getType().equals(FileType.AGREEMENT) && file.getAccessLevel().equals(AccessLevel.PRIVATE));
}
if (depositDoc.getContributors() != null) {
depositDoc.getContributors().getContributorOrCollaboration().stream().filter(c -> c instanceof Contributor)
.forEach(c -> {
((Contributor) c).setCnIndividu(null);
((Contributor) c).setEmail(null);
((Contributor) c).setInstitution(null);
((Contributor) c).setStructure(null);
});
}
}
}
......@@ -171,7 +171,7 @@ spring.jmx.default-domain=${aou.application.name)-${aou.env}
# spring.profiles.include=person-search-rock, client-backend, storage-file, orcid, email-service, index-elasticsearch
# Storage
ou.storage.url=file://${aou.home}/storage
aou.storage.url=file://${aou.home}/storage
aou.thesisNfsSharePath=file:///${aou.home}/thesis
......