Skip to content
Snippets Groups Projects
Verified Commit f03c10e9 authored by Tobias Grantner's avatar Tobias Grantner
Browse files

Adjusted metadata xml export and citation export to include DOIs

parent ec945b72
No related branches found
No related tags found
2 merge requests!163Relase 1.3.0,!150Resolve "Use DOIs as PIDs"
[# th:each="creator,idx: ${creators}"][# th:if="${idx.index} > 0 and ${idx.index} != ${idx.size} - 1 and ${idx.index} != 0"], [/][# th:if="${idx.index} == ${idx.size} - 1 and ${idx.size} != 1"] & [/][[${creator.firstname.substring(0,1)}]]., [[${creator.lastname}]][/][# th:if="${creators.size()} > 0"]. [/]([[${publicationYear}]]). [[${title}]]. [[${publisher}]]. [[${doi}]] [# th:each="creator,idx: ${creators}"][# th:if="${idx.index} > 0 and ${idx.index} != ${idx.size} - 1 and ${idx.index} != 0"], [/][# th:if="${idx.index} == ${idx.size} - 1 and ${idx.size} != 1"] & [/][[${creator.firstname.substring(0,1)}]]., [[${creator.lastname}]][/][# th:if="${creators.size()} > 0"]. [/]([[${publicationYear}]]). [[${title}]]. [[${publisher}]]. [[${identifierType} == 'doi' ? 'https://doi.org/' : '']][[${identifier}]]
\ No newline at end of file \ No newline at end of file
@misc{dbrepo[[${publicationYear}]], @misc{dbrepo[[${publicationYear}]],
author = {[# th:each="creator,idx: ${creators}"][# th:if="${idx.index} > 0"] and [/][[${creator.lastname}]], [[${creator.firstname}]][/]}, author = {[# th:each="creator,idx: ${creators}"][# th:if="${idx.index} > 0"] and [/][[${creator.lastname}]], [[${creator.firstname}]][/]},
title = {[[${title}]]}, title = {[[${title}]]},
howpublished = {\url{[[${doi}]]}}, [[${identifierType}]] = {[[${identifierType} == 'url' ? '\url{' : '']][[${identifier}]][[${identifierType} == 'url' ? '}' : '']]},
month = {[[${publicationMonth}]]}, month = {[[${publicationMonth}]]},
year = {[[${publicationYear}]]} year = {[[${publicationYear}]]}
} }
\ No newline at end of file
[1] [# th:each="creator,idx: ${creators}"][# th:if="${idx.index} > 0"] and [/][[${creator.firstname.substring(0,1)}]]. [[${creator.lastname}]][/][# th:if="${creators.size()} > 0"], [/]“[[${title}]]“, [[${publisher}]], [[${publicationYear}]], doi: [[${doi}]]. [1] [# th:each="creator,idx: ${creators}"][# th:if="${idx.index} > 0"] and [/][[${creator.firstname.substring(0,1)}]]. [[${creator.lastname}]][/][# th:if="${creators.size()} > 0"], [/]“[[${title}]]“, [[${publisher}]], [[${publicationYear}]], [[${identifierType} == 'url' ? 'Available: ' : '']][[${identifier}]].
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4"
xsi:schemaLocation="http://datacite.org/schema/kernel-4 https://schema.datacite.org/meta/kernel-4.4/metadata.xsd"> xsi:schemaLocation="http://datacite.org/schema/kernel-4 https://schema.datacite.org/meta/kernel-4.4/metadata.xsd">
<identifier identifierType="PID">[[${doi}]]</identifier> <identifier th:attr="identifierType=${identifierType}">[[${identifier}]]</identifier>
<creators th:if="${not #lists.isEmpty(creators)}"> <creators th:if="${not #lists.isEmpty(creators)}">
<creator th:each="creator: ${creators}"> <creator th:each="creator: ${creators}">
<creatorName nameType="Personal">[[${creator.lastname}]], [[${creator.firstname}]]</creatorName> <creatorName nameType="Personal">[[${creator.lastname}]], [[${creator.firstname}]]</creatorName>
......
...@@ -37,7 +37,6 @@ import java.util.Optional; ...@@ -37,7 +37,6 @@ import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@Profile("!doi")
@Service @Service
public class IdentifierServiceImpl implements IdentifierService { public class IdentifierServiceImpl implements IdentifierService {
...@@ -180,9 +179,11 @@ public class IdentifierServiceImpl implements IdentifierService { ...@@ -180,9 +179,11 @@ public class IdentifierServiceImpl implements IdentifierService {
/* context */ /* context */
final Context context = new Context(); final Context context = new Context();
if(identifier.getDoi() != null) { if(identifier.getDoi() != null) {
context.setVariable("doi", identifier.getDoi()); context.setVariable("identifierType", "DOI");
context.setVariable("identifier", identifier.getDoi());
} else { } else {
context.setVariable("doi", endpointConfig.getWebsiteUrl() + "/pid/" + identifier.getId()); context.setVariable("identifierType", "PID");
context.setVariable("identifier", endpointConfig.getWebsiteUrl() + "/pid/" + identifier.getId());
} }
context.setVariable("creators", identifier.getCreators()); context.setVariable("creators", identifier.getCreators());
context.setVariable("title", identifier.getTitle()); context.setVariable("title", identifier.getTitle());
...@@ -207,7 +208,13 @@ public class IdentifierServiceImpl implements IdentifierService { ...@@ -207,7 +208,13 @@ public class IdentifierServiceImpl implements IdentifierService {
final Identifier identifier = find(id); final Identifier identifier = find(id);
/* context */ /* context */
final Context context = new Context(); final Context context = new Context();
context.setVariable("doi", endpointConfig.getWebsiteUrl() + "/pid/" + identifier.getId()); if(identifier.getDoi() != null) {
context.setVariable("identifierType", "doi");
context.setVariable("identifier", identifier.getDoi());
} else {
context.setVariable("identifierType", "url");
context.setVariable("identifier", endpointConfig.getWebsiteUrl() + "/pid/" + identifier.getId());
}
context.setVariable("creator", identifier.getCreator()); context.setVariable("creator", identifier.getCreator());
context.setVariable("creators", identifier.getCreators()); context.setVariable("creators", identifier.getCreators());
context.setVariable("title", identifier.getTitle()); context.setVariable("title", identifier.getTitle());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment