From 02f558c7eafc7f01d58bac985cafbe1f49123d6a Mon Sep 17 00:00:00 2001 From: Elliot Metsger Date: Sun, 24 Jun 2018 19:41:14 -0400 Subject: [PATCH] Correct parsing of the metadata JSON blob from the UI. (#121) * Correct parsing of the metadata JSON blob from the UI. The metadata blob used for updated testing is copied verbatim from: https://github.com/OA-PASS/nihms-submission/issues/119#issuecomment-399133248 Changes include: - No longer using or supporting Manuscript.manuscriptUrl - Publication resource is no longer consulted for metadata - DOI is parsed from crossref metadata - Journal ID is no longer parsed - No longer consult 'JScholarship' metadata in the blob, it has nothing needed by Deposit Services - Embarog metadata is parsed from the common metadata - Article metadata no longer has a boolean for 'underEmbargo', it simply provides the 'embargoLiftDate'; the caller is responsible for determining if the embargo still applies. Closes #119 * Latest blob, update tests. * Update to latest blob? * nlmta --- .../SubmissionProcessorIT-no-files.json | 2 +- .../service/SubmissionProcessorIT-orig.json | 2 +- .../service/SubmissionProcessorIT.json | 2 +- .../nihms/model/DepositMetadata.java | 81 ++-- .../nihms/model/JournalPublicationType.java | 60 +++ .../mets/DspaceMetadataDomWriterTest.java | 10 +- .../nihms/builder/fs/ModelBuilder.java | 362 +++++++++--------- .../fs/FilesystemModelBuilderTest.java | 117 ++++-- .../SampleSubmissionData-missing-doi.json | 148 +++++++ .../SampleSubmissionData-null-doi.json | 2 +- .../SampleSubmissionData-untrimmed-doi.json | 2 +- ...ssionData-with-figure-and-table-files.json | 2 +- ...ionData-with-missing-common-md-fields.json | 149 +++++++ ...issionData-with-null-common-md-fields.json | 2 +- .../test/resources/SampleSubmissionData.json | 2 +- .../builder/fedora/FcrepoModelBuilderIT.java | 95 ++++- .../builder/fedora/SampleSubmissionData.json | 2 +- .../nihmsnative/NihmsMetadataSerializer.java | 11 +- .../nihmsnative/NihmsAssemblerIT.java | 16 +- .../NihmsMetadataSerializerTest.java | 9 +- .../pass/deposit/DepositTestUtil.java | 12 +- 21 files changed, 799 insertions(+), 289 deletions(-) create mode 100644 deposit-model/src/main/java/org/dataconservancy/nihms/model/JournalPublicationType.java create mode 100644 fedora-builder/src/test/resources/SampleSubmissionData-missing-doi.json create mode 100644 fedora-builder/src/test/resources/SampleSubmissionData-with-missing-common-md-fields.json diff --git a/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-no-files.json b/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-no-files.json index 0bac20a8..a707ef3d 100644 --- a/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-no-files.json +++ b/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-no-files.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\":\"common\", \"data\":{\"title\":\"Electrogenerated chemiluminescence of Ru(bpy)32+ at a black phosphorus quantum dot modified electrode and its sensing application\", \"journal-title\":\"The Analyst\", \"volume\":\"143\", \"issue\":\"1\", \"ISSN\":\"0003-2654,1364-5528\", \"abstract\":\"Strong anodic electrogenerated chemiluminescence (ECL) of Ru(bpy)32+ can be obtained under neutral conditions at a black phosphorus quantum dot (BPQD) modified electrode due to the catalytic effect of BPQDs. Dopamine exhibits an apparent inhibiting effect on the ECL signal, and as a result, can be sensitively detected.\", \"authors\":[{\"author\":\"Lei Zhang\"}, {\"author\":\"KaiJin Tian\"}, {\"author\":\"YongPing Dong\", \"orcid\":\"http://orcid.org/0000-0002-0455-9982\"}, {\"author\":\"HouCheng Ding\"}, {\"author\":\"ChengMing Wang\"}], \"Embargo-end-date\":\"2018-06-30\"}}, {\"id\":\"crossref\", \"data\":{\"doi\":\"10.1039/c7an01617d\", \"publisher\":\"Royal Society of Chemistry (RSC)\", \"journal-title-short\":\"Analyst\"}}, {\"id\":\"JScholarship\", \"data\":{\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\":\"true\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-orig.json b/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-orig.json index edff8f34..87b1079a 100644 --- a/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-orig.json +++ b/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT-orig.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\":\"common\", \"data\":{\"title\":\"Electrogenerated chemiluminescence of Ru(bpy)32+ at a black phosphorus quantum dot modified electrode and its sensing application\", \"journal-title\":\"The Analyst\", \"volume\":\"143\", \"issue\":\"1\", \"ISSN\":\"0003-2654,1364-5528\", \"abstract\":\"Strong anodic electrogenerated chemiluminescence (ECL) of Ru(bpy)32+ can be obtained under neutral conditions at a black phosphorus quantum dot (BPQD) modified electrode due to the catalytic effect of BPQDs. Dopamine exhibits an apparent inhibiting effect on the ECL signal, and as a result, can be sensitively detected.\", \"authors\":[{\"author\":\"Lei Zhang\"}, {\"author\":\"KaiJin Tian\"}, {\"author\":\"YongPing Dong\", \"orcid\":\"http://orcid.org/0000-0002-0455-9982\"}, {\"author\":\"HouCheng Ding\"}, {\"author\":\"ChengMing Wang\"}], \"Embargo-end-date\":\"2018-06-30\"}}, {\"id\":\"crossref\", \"data\":{\"doi\":\"10.1039/c7an01617d\", \"publisher\":\"Royal Society of Chemistry (RSC)\", \"journal-title-short\":\"Analyst\"}}, {\"id\":\"JScholarship\", \"data\":{\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\":\"true\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT.json b/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT.json index cbd7cdbe..d979782c 100644 --- a/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT.json +++ b/deposit-messaging/src/test/resources/org/dataconservancy/pass/deposit/messaging/service/SubmissionProcessorIT.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\":\"common\", \"data\":{\"title\":\"Electrogenerated chemiluminescence of Ru(bpy)32+ at a black phosphorus quantum dot modified electrode and its sensing application\", \"journal-title\":\"The Analyst\", \"volume\":\"143\", \"issue\":\"1\", \"ISSN\":\"0003-2654,1364-5528\", \"abstract\":\"Strong anodic electrogenerated chemiluminescence (ECL) of Ru(bpy)32+ can be obtained under neutral conditions at a black phosphorus quantum dot (BPQD) modified electrode due to the catalytic effect of BPQDs. Dopamine exhibits an apparent inhibiting effect on the ECL signal, and as a result, can be sensitively detected.\", \"authors\":[{\"author\":\"Lei Zhang\"}, {\"author\":\"KaiJin Tian\"}, {\"author\":\"YongPing Dong\", \"orcid\":\"http://orcid.org/0000-0002-0455-9982\"}, {\"author\":\"HouCheng Ding\"}, {\"author\":\"ChengMing Wang\"}], \"Embargo-end-date\":\"2018-06-30\"}}, {\"id\":\"crossref\", \"data\":{\"doi\":\"10.1039/c7an01617d\", \"publisher\":\"Royal Society of Chemistry (RSC)\", \"journal-title-short\":\"Analyst\"}}, {\"id\":\"JScholarship\", \"data\":{\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\":\"true\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/deposit-model/src/main/java/org/dataconservancy/nihms/model/DepositMetadata.java b/deposit-model/src/main/java/org/dataconservancy/nihms/model/DepositMetadata.java index 7d5f9b76..60c300f8 100644 --- a/deposit-model/src/main/java/org/dataconservancy/nihms/model/DepositMetadata.java +++ b/deposit-model/src/main/java/org/dataconservancy/nihms/model/DepositMetadata.java @@ -19,7 +19,9 @@ import java.net.URI; import java.net.URL; import java.time.ZonedDateTime; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * Encapsulates required and optional metadata for submitting a manuscript. @@ -27,18 +29,44 @@ public class DepositMetadata { /** - * Journal type: electronic or print + * ISSN associated with a publication type */ - public enum JOURNAL_PUBLICATION_TYPE { - /** - * print publication - */ - ppub, + public static class IssnPubType { - /** - * electronic publication - */ - epub + public String issn; + + public JournalPublicationType pubType; + + public IssnPubType(String issn, JournalPublicationType pubType) { + this.issn = issn; + this.pubType = pubType; + } + + @Override + public String toString() { + return "IssnPubType{" + "issn='" + issn + '\'' + ", pubType=" + pubType + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + IssnPubType that = (IssnPubType) o; + + if (!issn.equals(that.issn)) + return false; + return pubType == that.pubType; + } + + @Override + public int hashCode() { + int result = issn.hashCode(); + result = 31 * result + pubType.hashCode(); + return result; + } } /** @@ -190,13 +218,14 @@ public static class Journal { public String journalTitle; /** - * Journal publication type + * ISSN mapped to journal publication type */ - public JOURNAL_PUBLICATION_TYPE pubType; + public Map issnPubTypes = new HashMap<>(2); /** * Serial number for the journal */ + @Deprecated public String issn; public String getJournalId() { @@ -219,18 +248,20 @@ public void setJournalTitle(String journalTitle) { this.journalTitle = journalTitle; } - public JOURNAL_PUBLICATION_TYPE getPubType() { - return pubType; + public Map getIssnPubTypes() { + return issnPubTypes; } - public void setPubType(JOURNAL_PUBLICATION_TYPE pubType) { - this.pubType = pubType; + public void setIssnPubTypes(Map issnPubTypes) { + this.issnPubTypes = issnPubTypes; } + @Deprecated public String getIssn() { return issn; } + @Deprecated public void setIssn(String issn) { this.issn = issn; } @@ -248,12 +279,6 @@ public static class Article { */ public String title; - public boolean underEmbargo = false; - - public boolean agreementToEmbargo = false; - - public String embargoTerms = ""; - public ZonedDateTime embargoLiftDate = null; public String getTitle() { return title; } @@ -268,18 +293,6 @@ public void setDoi(URI doi) { this.doi = doi; } - public boolean getUnderEmbargo() { return underEmbargo; } - - public void setUnderEmbargo(boolean underEmbargo) { this.underEmbargo = underEmbargo; } - - public boolean getAgreementToEmbargo() { return agreementToEmbargo; } - - public void setAgreementToEmbargo(boolean underEmbargo) { this.agreementToEmbargo = agreementToEmbargo; } - - public void setEmbargoTerms(String embargoTerms) { this.embargoTerms = embargoTerms; } - - public String getEmbargoTerms() { return embargoTerms; } - public ZonedDateTime getEmbargoLiftDate() { return embargoLiftDate; } public void setEmbargoLiftDate(ZonedDateTime embargoLiftDate) { this.embargoLiftDate = embargoLiftDate; } diff --git a/deposit-model/src/main/java/org/dataconservancy/nihms/model/JournalPublicationType.java b/deposit-model/src/main/java/org/dataconservancy/nihms/model/JournalPublicationType.java new file mode 100644 index 00000000..40fd10fb --- /dev/null +++ b/deposit-model/src/main/java/org/dataconservancy/nihms/model/JournalPublicationType.java @@ -0,0 +1,60 @@ +/* + * Copyright 2018 Johns Hopkins University + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.dataconservancy.nihms.model; + +import java.util.Arrays; + +/** + * Journal type: electronic or print + * + * @author Elliot Metsger (emetsger@jhu.edu) + */ +public enum JournalPublicationType { + + PPUB("Print"), + + EPUB("Electronic"); + + private String typeDescription; + + JournalPublicationType(String typeDescription) { + this.typeDescription = typeDescription; + } + + public String getTypeDescription() { + return typeDescription; + } + + /** + * Parse an {@code Extension} from the string form as it would be used in a file name. Note that this form should + * be all lower-case, with no preceding or succeeding periods. + * + * @param typeDescription the string form of a journal publication type + * @return the corresponding {@code JournalPublicationType} + * @throws IllegalArgumentException if the {@code typeDescription} does not correspond to an existing {@code JournalPublicationType} + */ + public static JournalPublicationType parseTypeDescription(String typeDescription) { + return Arrays.stream(values()) + .filter(candidatePubType -> candidatePubType.getTypeDescription().equals(typeDescription)) + .findAny() + .orElseThrow(() -> new IllegalArgumentException("No JournalPublicationType exists for '" + typeDescription + "'")); + } + + @Override + public String toString() { + return "JournalPublicationType{" + "typeDescription='" + typeDescription + '\'' + "} " + super.toString(); + } +} diff --git a/dspace-mets-assembler/src/test/java/org/dataconservancy/pass/deposit/assembler/dspace/mets/DspaceMetadataDomWriterTest.java b/dspace-mets-assembler/src/test/java/org/dataconservancy/pass/deposit/assembler/dspace/mets/DspaceMetadataDomWriterTest.java index 02557ca3..145d2757 100644 --- a/dspace-mets-assembler/src/test/java/org/dataconservancy/pass/deposit/assembler/dspace/mets/DspaceMetadataDomWriterTest.java +++ b/dspace-mets-assembler/src/test/java/org/dataconservancy/pass/deposit/assembler/dspace/mets/DspaceMetadataDomWriterTest.java @@ -24,6 +24,7 @@ import org.dataconservancy.nihms.assembler.PackageStream; import org.dataconservancy.nihms.model.DepositMetadata; import org.dataconservancy.nihms.model.DepositSubmission; +import org.dataconservancy.nihms.model.JournalPublicationType; import org.dataconservancy.pass.deposit.DepositTestUtil; import org.dataconservancy.pass.deposit.assembler.shared.ChecksumImpl; import org.junit.Before; @@ -51,6 +52,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @@ -181,9 +183,11 @@ public void writeSampleMets() throws Exception { when(article.getTitle()).thenReturn("Two stupendous minds."); when(article.getDoi()).thenReturn(URI.create("https://dx.doi.org/123/456")); when(article.getEmbargoLiftDate()).thenReturn(ZonedDateTime.now()); - - when(journal.getIssn()).thenReturn("1236-5678"); - when(journal.getJournalType()).thenReturn(DepositMetadata.JOURNAL_PUBLICATION_TYPE.ppub.name()); + when(journal.getIssnPubTypes()).thenReturn(new HashMap() { + { + put("1236-5678", new DepositMetadata.IssnPubType("1236-5678", JournalPublicationType.PPUB)); + } + }); when(journal.getJournalTitle()).thenReturn("American Journal of XYZ Research"); when(journal.getJournalId()).thenReturn("Am J of XYZ Res"); diff --git a/fedora-builder/src/main/java/org/dataconservancy/nihms/builder/fs/ModelBuilder.java b/fedora-builder/src/main/java/org/dataconservancy/nihms/builder/fs/ModelBuilder.java index d159a080..eb2ce01c 100644 --- a/fedora-builder/src/main/java/org/dataconservancy/nihms/builder/fs/ModelBuilder.java +++ b/fedora-builder/src/main/java/org/dataconservancy/nihms/builder/fs/ModelBuilder.java @@ -26,21 +26,18 @@ import org.dataconservancy.nihms.model.DepositManifest; import org.dataconservancy.nihms.model.DepositMetadata; import org.dataconservancy.nihms.model.DepositSubmission; -import org.dataconservancy.pass.model.Deposit; +import org.dataconservancy.nihms.model.JournalPublicationType; import org.dataconservancy.pass.model.File; import org.dataconservancy.pass.model.Funder; import org.dataconservancy.pass.model.Grant; -import org.dataconservancy.pass.model.Journal; import org.dataconservancy.pass.model.PassEntity; -import org.dataconservancy.pass.model.Publication; import org.dataconservancy.pass.model.Repository; import org.dataconservancy.pass.model.Submission; import org.dataconservancy.pass.model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.net.MalformedURLException; import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; @@ -50,20 +47,58 @@ import java.util.HashMap; import java.util.Optional; +import static org.dataconservancy.nihms.model.JournalPublicationType.parseTypeDescription; + /*** * Base class for copying deposit-submission data from Fedora-based sources into the deposit data model. * Copies relevant fields from a collection of PassEntity objects, starting with the Submission entity * that is the root of the data tree. * - * Presently, neither the Fedora data model nor the deposit submission data model are finalized, - * so many fields from the models are still unused or unset. These fields are identified in - * comments in this class. - * * @author Ben Trumbore (wbt3@cornell.edu) */ abstract class ModelBuilder { - // Creates a DepositMetadata person with the person's context passed as parameters. + private static final Logger LOG = LoggerFactory.getLogger(ModelBuilder.class); + + private static final String ISSN_MAP_KEY = "issn-map"; + + private static final String MANUSCRIPT_TITLE_KEY = "title"; + + private static final String ABSTRACT_KEY = "abstract"; + + private static final String JOURNAL_TITLE_KEY = "journal-title"; + + private static final String DOI_KEY = "doi"; + + private static final String COMMON_ID_KEY = "common"; + + private static final String DATA_KEY = "data"; + + private static final String CROSSREF_KEY = "crossref"; + + private static final String EMBARGO_END_DATE_KEY = "Embargo-end-date"; + + private static final String ID_KEY = "id"; + + private static final String AUTHORS_KEY = "authors"; + + private static final String AUTHOR_KEY = "author"; + + private static final String PUB_TYPE_KEY = "pub-type"; + + private static final String EMBARGO_END_DATE_PATTERN = "yyyy-MM-dd"; + + private static final String PMC_KEY = "pmc"; + + private static final String NLMTA_KEY = "nlmta"; + + /** + * Creates a DepositMetadata person with the person's context passed as parameters. + * + * @param userEntity + * @param type + * @return + */ private DepositMetadata.Person createPerson(User userEntity, DepositMetadata.PERSON_TYPE type) { DepositMetadata.Person person = new DepositMetadata.Person(); person.setFirstName(userEntity.getFirstName()); @@ -71,21 +106,16 @@ private DepositMetadata.Person createPerson(User userEntity, DepositMetadata.PER person.setLastName(userEntity.getLastName()); person.setEmail(userEntity.getEmail()); person.setType(type); - // Available User data for which there is no place in the existing DepositMetadata.Person: - // Leave commented out until this metadata is to be used. Protect against NPEs. -// String username = userEntity.getUsername(); -// String displayName = userEntity.getDisplayName(); -// String affiliation = userEntity.getAffiliation(); -// String institutionalId = userEntity.getInstitutionalId(); -// String localKey = userEntity.getLocalKey(); -// String orcidId = userEntity.getOrcidId(); -// for (User.Role role : userEntity.getRoles()) { -// } return person; } - // Creates a Person representing an author with the given name. + /** + * Creates a Person representing an author with the given name. + * + * @param fullName + * @return + */ private DepositMetadata.Person createAuthor(String fullName) { DepositMetadata.Person person = new DepositMetadata.Person(); person.setFullName(fullName); @@ -93,7 +123,13 @@ private DepositMetadata.Person createAuthor(String fullName) { return person; } - // Convenience method for retrieving a boolean property. Should the default be true or false? + /** + * Convenience method for retrieving a boolean property. + * + * @param parent + * @param name + * @return + */ private Optional getBooleanProperty(JsonObject parent, String name) { if (parent.has(name)) { return Optional.of(parent.get(name).getAsBoolean()); @@ -101,127 +137,164 @@ private Optional getBooleanProperty(JsonObject parent, String name) { return Optional.empty(); } - // Convenience method for retrieving a string property. Should the default be empty or null? + /** + * Convenience method for retrieving a string property. + * + * @param parent + * @param name + * @return + */ private Optional getStringProperty(JsonObject parent, String name) { - if (parent.has(name)) { + if (parent.has(name) && !parent.get(name).isJsonNull()) { return Optional.of(parent.get(name).getAsString()); } return Optional.empty(); } - // The following four methods are based on a single sample of PASS submission metadata at - // https://github.com/OA-PASS/pass-ember/issues/194. + /** + * Convenience method for retrieving an object property. + * + * @param parent + * @param name + * @return + */ + private Optional getObjectProperty(JsonObject parent, String name) { + if (parent.has(name) && !parent.get(name).isJsonNull() && parent.get(name).isJsonObject()) { + return Optional.of(parent.get(name).getAsJsonObject()); + } + + return Optional.empty(); + } + + /** + * Convenience method for retrieving an array property. + * + * @param parent + * @param name + * @return + */ + private Optional getArrayProperty(JsonObject parent, String name) { + if (parent.has(name) && !parent.get(name).isJsonNull() && parent.get(name).isJsonArray()) { + return Optional.of(parent.get(name).getAsJsonArray()); + } + + return Optional.empty(); + } + private void processCommonMetadata(DepositMetadata metadata, JsonObject submissionData) throws InvalidModel { // Is this tile for manuscript or article or both? - getStringProperty(submissionData, "title") + getStringProperty(submissionData, MANUSCRIPT_TITLE_KEY) .ifPresent(title -> { metadata.getManuscriptMetadata().setTitle(title); metadata.getArticleMetadata().setTitle(title); }); - getStringProperty(submissionData, "abstract") + getStringProperty(submissionData, ABSTRACT_KEY) .ifPresent(abs -> metadata.getManuscriptMetadata().setMsAbstract(abs)); - getStringProperty(submissionData, "journal-title") + getStringProperty(submissionData, JOURNAL_TITLE_KEY) .ifPresent(jTitle -> metadata.getJournalMetadata().setJournalTitle(jTitle)); - // Leave commented out until this metadata is to be used. Protect against NPEs. -// String journalTitleShort = getStringProperty(submissionData, "journal-title-short"); -// String volume = getStringProperty(submissionData, "volume"); -// String issue = getStringProperty(submissionData, "issue"); -// String subjects = getStringProperty(submissionData, "subjects"); + getArrayProperty(submissionData, AUTHORS_KEY).ifPresent(authors -> { + authors.forEach(authorElement -> { + getStringProperty(authorElement.getAsJsonObject(), AUTHOR_KEY) + .ifPresent(name -> metadata.getPersons().add(createAuthor(name))); + }); + }); + + getObjectProperty(submissionData, ISSN_MAP_KEY).ifPresent(issnMapObject -> { + issnMapObject.keySet().forEach(issn -> { + getObjectProperty(issnMapObject, issn).ifPresent(issnObj -> { + getArrayProperty(issnObj, PUB_TYPE_KEY).ifPresent(typeArray -> { + if (typeArray.size() < 1) { + return; + } + String typeDesc = typeArray.get(0).getAsString(); + try { + DepositMetadata.IssnPubType pubType = + new DepositMetadata.IssnPubType(issn, parseTypeDescription(typeDesc)); + metadata.getJournalMetadata().getIssnPubTypes().putIfAbsent(issn, pubType); + } catch (IllegalArgumentException e) { + LOG.warn("Unable to parse a JournalPublicationType from the type description " + "'{}'", + typeDesc, e); + return; + } + }); + }); + }); + }); - getStringProperty(submissionData, "URL").ifPresent(url -> { + getStringProperty(submissionData, EMBARGO_END_DATE_KEY).ifPresent(endDate -> { try { - metadata.getManuscriptMetadata().setManuscriptUrl(new URL(url)); - } catch (MalformedURLException e) { - InvalidModel im = new InvalidModel(String.format("Data file '%s' contained an invalid URL.", url), e); + // TODO - Resolve inconsistent date/date-time formats in metadata and deposit data model + // TODO - Fix assumption of local timezone + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(EMBARGO_END_DATE_PATTERN); + LocalDateTime localEndDate = LocalDate.parse(endDate, formatter).atStartOfDay(); + ZonedDateTime zonedEndDate = localEndDate.atZone(ZoneId.of("America/New_York")); + metadata.getArticleMetadata().setEmbargoLiftDate(zonedEndDate); + } catch (Exception e) { + InvalidModel im = new InvalidModel(String.format("Data file contained an invalid Date: '%s'.", + endDate), e); throw new RuntimeException(im.getMessage(), im); } }); - - // Leave commented out until this metadata is to be used. Protect against NPEs. - JsonArray authors = submissionData.get("authors").getAsJsonArray(); - for (JsonElement element : authors) { - JsonObject author = element.getAsJsonObject(); - getStringProperty(author, "author") - .ifPresent(name -> metadata.getPersons().add(createAuthor(name))); - // String orcid = getStringProperty(author, "orcid"); - } } - private void processNihMetadata(DepositMetadata metadata, JsonObject submissionData) { - getStringProperty(submissionData, "journal-NLMTA-ID") - .ifPresent(journalId -> metadata.getJournalMetadata().setJournalId(journalId)); - getStringProperty(submissionData, "ISSN") - .ifPresent(issn -> metadata.getJournalMetadata().setIssn(issn)); - } - - private void processJScholarshipMetadata(DepositMetadata metadata, JsonObject submissionData) - throws InvalidModel { - if (! submissionData.has("under-embargo")) { - return; - } - - getStringProperty(submissionData, "Embargo-end-date").ifPresent(endDate -> { + private void processCrossrefMetadata(DepositMetadata metadata, JsonObject submissionData) { + getStringProperty(submissionData, DOI_KEY).ifPresent(doi -> { try { - getBooleanProperty(submissionData, "under-embargo").ifPresent(underEmbargo -> { - if (!underEmbargo) { - return; - } - - metadata.getArticleMetadata().setUnderEmbargo(underEmbargo); - - getStringProperty(submissionData, "embargo").ifPresent(embargoTerms -> metadata - .getArticleMetadata().setEmbargoTerms(embargoTerms)); - - getBooleanProperty(submissionData, "agreement-to-embargo").ifPresent(agreement -> { - if (!agreement) { - return; - } - metadata.getArticleMetadata().setAgreementToEmbargo(agreement); - }); - - // TODO - Resolve inconsistent date/date-time formats in metadata and deposit data model - // TODO - Fix assumption of local timezone - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yy"); - LocalDateTime localEndDate = LocalDate.parse(endDate, formatter).atStartOfDay(); - ZonedDateTime zonedEndDate = localEndDate.atZone(ZoneId.of("America/New_York")); - metadata.getArticleMetadata().setEmbargoLiftDate(zonedEndDate); - }); - + doi = doi.trim(); + metadata.getArticleMetadata().setDoi(URI.create(doi)); } catch (Exception e) { - InvalidModel im = new InvalidModel(String.format("Data file contained an invalid Date: '%s'.", - endDate), e); + InvalidModel im = new InvalidModel(String.format("Data file contained an invalid DOI: '%s'", doi), e); throw new RuntimeException(im.getMessage(), im); - }; + } }); } + private void processPmcMetadata(DepositMetadata metadata, JsonObject submissionData) { + getStringProperty(submissionData, NLMTA_KEY).ifPresent(nlmta -> + metadata.getJournalMetadata().setJournalId(nlmta)); + } + + /** + * Processes the so-called "blob" metadata, reverse engineered from the sample blob here: + * https://github.com/OA-PASS/nihms-submission/issues/122#issuecomment-399314521 + * + * @param depositMetadata + * @param metadataStr + * @throws InvalidModel + */ private void processMetadata(DepositMetadata depositMetadata, String metadataStr) throws InvalidModel { JsonArray metadataJson = new JsonParser().parse(metadataStr).getAsJsonArray(); for (JsonElement element : metadataJson) { JsonObject obj = element.getAsJsonObject(); - String type = obj.get("id").getAsString(); - JsonObject data = obj.get("data").getAsJsonObject(); - if (type.equals("common")) { + String type = obj.get(ID_KEY).getAsString(); + JsonObject data = obj.get(DATA_KEY).getAsJsonObject(); + if (type.equals(COMMON_ID_KEY)) { processCommonMetadata(depositMetadata, data); } - else if (type.equals("nih")) { - processNihMetadata(depositMetadata, data); - } - else if (type.equals("JScholarship")) { - processJScholarshipMetadata(depositMetadata, data); + else if (type.equals(CROSSREF_KEY)) { + processCrossrefMetadata(depositMetadata, data); + } else if (type.equals(PMC_KEY)) { + processPmcMetadata(depositMetadata, data); } } } - // Walk the tree of PassEntity objects, starting with the Submission entity, - // to copy the desired source data into a new DepositSubmission data model. + /** + * Creates a DepositSubmission by walking the tree of PassEntity objects, starting with the Submission entity, + * copying the desired source data into a new DepositSubmission data model. + * + * @param submissionEntity + * @param entities + * @return + * @throws InvalidModel + */ DepositSubmission createDepositSubmission(Submission submissionEntity, HashMap entities) throws InvalidModel { @@ -244,62 +317,11 @@ DepositSubmission createDepositSubmission(Submission submissionEntity, HashMap EXPECTED_ISSN_PUBTYPES = + new HashMap() { + { + put("2042-6496", JournalPublicationType.PPUB); + put("2042-650X", JournalPublicationType.EPUB); + } + }; + + private static final String EXPECTED_DOI = "10.1039/c7fo01251a"; + + private static final int EXPECTED_SUBMITER_COUNT = 1; + + private static final int EXPECTED_PI_COUNT = 1; + + private static final int EXPECTED_CO_PI_COUNT = 1; + + private static final int EXPECTED_AUTHOR_COUNT = 6; + + private static final String EXPECTED_NLMTA = "Food Funct"; + private DepositSubmission submission; + private FilesystemModelBuilder underTest = new FilesystemModelBuilder(); - private String SAMPLE_SUBMISSION_RESOURCE = "SampleSubmissionData.json"; - private String SAMPLE_SUBMISSION_RESOURCE_NULL_FIELDS = "/SampleSubmissionData-with-null-common-md-fields.json"; - private String SAMPLE_SUBMISSION_RESOURCE_NULL_DOI = "/SampleSubmissionData-null-doi.json"; - private String SAMPLE_SUBMISSION_RESOURCE_UNTRIMMED_DOI = "/SampleSubmissionData-untrimmed-doi.json"; - private String SAMPLE_SUBMISSION_RESOURCE_TABLE_AND_FIGURE = "/SampleSubmissionData-with-figure-and-table-files.json"; + + private static final String SAMPLE_SUBMISSION_RESOURCE = "SampleSubmissionData.json"; + + private static final String SAMPLE_SUBMISSION_RESOURCE_NULL_FIELDS = "/SampleSubmissionData-with-null-common-md-fields.json"; + + private static final String SAMPLE_SUBMISSION_RESOURCE_MISSING_FIELDS = "/SampleSubmissionData-with-missing-common-md-fields.json"; + + private static final String SAMPLE_SUBMISSION_RESOURCE_NULL_DOI = "/SampleSubmissionData-null-doi.json"; + + private static final String SAMPLE_SUBMISSION_RESOURCE_MISSING_DOI = "/SampleSubmissionData-missing-doi.json"; + + private static final String SAMPLE_SUBMISSION_RESOURCE_UNTRIMMED_DOI = "/SampleSubmissionData-untrimmed-doi.json"; + + private static final String SAMPLE_SUBMISSION_RESOURCE_TABLE_AND_FIGURE = "/SampleSubmissionData-with-figure-and-table-files.json"; @Before public void setup() throws Exception{ @@ -89,46 +122,33 @@ public void testElementValues() { assertNotNull(submission.getMetadata().getPersons()); assertEquals(submission.getId(), submissionEntity.getId().toString()); - Publication publication = (Publication)entities.get(submissionEntity.getPublication()); - assertEquals(submission.getMetadata().getArticleMetadata().getDoi().toString(), publication.getDoi()); + assertEquals(EXPECTED_DOI, submission.getMetadata().getArticleMetadata().getDoi().toString()); assertNotNull(submission.getFiles()); assertEquals(2, submission.getFiles().size()); // Confirm that some values were set correctly from the Submission metadata DepositMetadata.Journal journalMetadata = submission.getMetadata().getJournalMetadata(); - assertEquals("Food Funct.", journalMetadata.getJournalTitle()); - assertEquals("TD452689", journalMetadata.getJournalId()); - assertEquals("2042-6496,2042-650X", journalMetadata.getIssn()); + assertEquals(EXPECTED_TITLE, journalMetadata.getJournalTitle()); + journalMetadata.getIssnPubTypes().values().forEach(pubType -> { + assertTrue(EXPECTED_ISSN_PUBTYPES.containsKey(pubType.issn)); + assertEquals(EXPECTED_ISSN_PUBTYPES.get(pubType.issn), pubType.pubType); + }); + + assertEquals(EXPECTED_NLMTA, journalMetadata.getJournalId()); DepositMetadata.Manuscript manuscriptMetadata = submission.getMetadata().getManuscriptMetadata(); - assertEquals("http://dx.doi.org/10.1039/c7fo01251a", manuscriptMetadata.getManuscriptUrl().toString()); + assertNull(manuscriptMetadata.getManuscriptUrl()); List persons = submission.getMetadata().getPersons(); - int authors = 0; - int pis = 0; - int copis = 0; - int submitters = 0; - for (DepositMetadata.Person person : persons) { - switch (person.getType()) { - case author: - authors++; - break; - case pi: - pis++; - break; - case copi: - copis++; - break; - case submitter: - submitters++; - break; - } - } - assertEquals(1, submitters); - assertEquals(1, pis); - assertEquals(1, copis); - assertEquals(6, authors); + assertEquals(EXPECTED_SUBMITER_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.submitter).count()); + assertEquals(EXPECTED_PI_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.pi).count()); + assertEquals(EXPECTED_CO_PI_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.copi).count()); + assertEquals(EXPECTED_AUTHOR_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.author).count()); } @Test @@ -139,8 +159,20 @@ public void buildWithNullValues() throws Exception { submission = underTest.build(sampleDataUrl.getPath()); assertNotNull(submission); + assertNull(submission.getMetadata().getManuscriptMetadata().getTitle()); + assertNull(submission.getMetadata().getManuscriptMetadata().getMsAbstract()); + } + + @Test + public void buildWithMissingValues() throws Exception { + // Create submission data from sample data file with null values + URL sampleDataUrl = this.getClass().getResource(SAMPLE_SUBMISSION_RESOURCE_MISSING_FIELDS); + assertNotNull("Could not resolve classpath resource " + SAMPLE_SUBMISSION_RESOURCE_MISSING_FIELDS, sampleDataUrl); + submission = underTest.build(sampleDataUrl.getPath()); + + assertNotNull(submission); + assertNull(submission.getMetadata().getManuscriptMetadata().getTitle()); assertNull(submission.getMetadata().getManuscriptMetadata().getMsAbstract()); - assertNull(submission.getMetadata().getManuscriptMetadata().getManuscriptUrl()); } @Test @@ -154,6 +186,17 @@ public void buildWithNullDoi() throws Exception { assertNull(submission.getMetadata().getArticleMetadata().getDoi()); } + @Test + public void buildWithMissingDoi() throws Exception { + // Create submission data from sample data file with null values + URL sampleDataUrl = this.getClass().getResource(SAMPLE_SUBMISSION_RESOURCE_MISSING_DOI); + assertNotNull("Could not resolve classpath resource " + SAMPLE_SUBMISSION_RESOURCE_MISSING_DOI, sampleDataUrl); + submission = underTest.build(sampleDataUrl.getPath()); + + assertNotNull(submission); + assertNull(submission.getMetadata().getArticleMetadata().getDoi()); + } + @Test public void buildWithUntrimmedDoi() throws Exception { // Create submission data from sample data file with null values diff --git a/fedora-builder/src/test/resources/SampleSubmissionData-missing-doi.json b/fedora-builder/src/test/resources/SampleSubmissionData-missing-doi.json new file mode 100644 index 00000000..8a6040f6 --- /dev/null +++ b/fedora-builder/src/test/resources/SampleSubmissionData-missing-doi.json @@ -0,0 +1,148 @@ +[ + { + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"title\": \"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\", \"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"abstract\": \"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\", \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", + "source" : "pass", + "submitted" : true, + "submittedDate" : "2017-06-02T00:00:00.000Z", + "aggregatedDepositStatus" : "not-started", + "publication" : "fake:publication1", + "repositories" : [ "fake:repository1" ], + "user" : "fake:user1", + "grants" : [ "fake:grant1" ], + "@id" : "fake:submission1", + "@type" : "Submission" + }, + { + "title" : "This is the first submission", + "abstract" : "This is a great paper!", + "pmid" : "fedcba", + "journal" : "fake:journal1", + "volume" : "123", + "issue" : "May 2015", + "@id" : "fake:publication1", + "@type" : "Publication" + }, + { + "name" : "AAPS PharmSci", + "issns" : [ "issn123", "issn456" ], + "nlmta" : "AAPS PharmSci", + "pmcParticipation" : "A", + "publisher" : "", + "@id" : "fake:journal1", + "@type" : "Journal" + }, + { + "name" : "PubMed Central", + "description" : "Contains lots of medical papers", + "url" : "http://example.com", + "formSchema" : "{}", + "@id" : "fake:repository1", + "@type" : "Repository" + }, + { + "awardNumber" : "R01EY026617", + "awardStatus" : "active", + "localKey" : "112233", + "projectName" : "Optimal magnification and oculomotor strategies in low vision patients", + "awardDate" : "2017-06-01T00:00:00.000Z", + "startDate" : "2017-05-01T00:00:00.000Z", + "endDate" : "2018-06-01T00:00:00.000Z", + "primaryFunder" : "fake:funder1", + "directFunder" : "fake:funder2", + "pi" : "fake:user2", + "coPis" : [ "fake:user3" ], + "@id" : "fake:grant1", + "@type" : "Grant" + }, + { + "name" : "National Eye Institute", + "url" : "http://example.com/eyeguys", + "localKey" : "aabbcc", + "policy" : "fake:policy1", + "@id" : "fake:funder1", + "@type" : "Funder" + }, + { + "title" : "Be Nice to People With Eyes", + "description" : "We only have eyes for you.", + "policyUrl" : "http://theeyeshaveit.com/policy", + "repositories" : [ "fake:repository1" ], + "institution" : "fake:institution1", + "funder" : "fake:funder1", + "@id" : "fake:policy1", + "@type" : "Policy" + }, + { + "name" : "International Eye Institute", + "url" : "http://example.com/othereyeguys", + "localKey" : "ddeeff", + "policy" : "fake:policy1", + "@id" : "fake:funder2", + "@type" : "Funder" + }, + { + "username" : "bobsmith", + "firstName" : "Robert", + "middleName" : "Cure", + "lastName" : "Smith", + "displayName" : "Bob Smith", + "email" : "bobsmith@jhu.edu", + "affiliation" : "Johns Hopkins", + "institutionalId" : "bs1", + "localKey" : "key123", + "orcidId" : "orcid123", + "roles" : [ "submitter", "admin" ], + "@id" : "fake:user1", + "@type" : "User" + }, + { + "username" : "suzyv", + "firstName" : "Suzanne", + "middleName" : "X", + "lastName" : "Vega", + "displayName" : "Suzanne Vega", + "email" : "suzannev@jhu.edu", + "affiliation" : "Johns Hopkins", + "institutionalId" : "sxv3", + "localKey" : "keyabc", + "orcidId" : "orc456", + "roles" : [ "submitter" ], + "@id" : "fake:user2", + "@type" : "User" + }, + { + "username" : "johndoe", + "firstName" : "John", + "middleName" : "Nobody", + "lastName" : "Doe", + "displayName" : "John Doe", + "email" : "jd@jhu.edu", + "affiliation" : "Johns Hopkins", + "institutionalId" : "jd123", + "localKey" : "keyabc123", + "orcidId" : "orc789", + "roles" : [ "admin" ], + "@id" : "fake:user3", + "@type" : "User" + }, + { + "name" : "test_image", + "uri" : "classpath:/org/dataconservancy/nihms/builder/fs/dektol.jpg", + "description" : "A logo to test supplemental type", + "fileRole" : "supplemental", + "mimeType" : "image/png", + "submission" : "fake:submission1", + "@id" : "fake:file1", + "@type" : "File" + }, + { + "name" : "test_pdf", + "uri" : "classpath:/org/dataconservancy/nihms/builder/fs/ilford_film_processing_chart.pdf", + "description" : "PDF hype to test manuscript type", + "fileRole" : "manuscript", + "mimeType" : "application/pdf", + "submission" : "fake:submission1", + "@id" : "fake:file2", + "@type" : "File" + } +] diff --git a/fedora-builder/src/test/resources/SampleSubmissionData-null-doi.json b/fedora-builder/src/test/resources/SampleSubmissionData-null-doi.json index a806274b..d164cc7d 100644 --- a/fedora-builder/src/test/resources/SampleSubmissionData-null-doi.json +++ b/fedora-builder/src/test/resources/SampleSubmissionData-null-doi.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"title\": \"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\", \"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"abstract\": \"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\", \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"doi\": null, \"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/fedora-builder/src/test/resources/SampleSubmissionData-untrimmed-doi.json b/fedora-builder/src/test/resources/SampleSubmissionData-untrimmed-doi.json index cacdc254..f0e34651 100644 --- a/fedora-builder/src/test/resources/SampleSubmissionData-untrimmed-doi.json +++ b/fedora-builder/src/test/resources/SampleSubmissionData-untrimmed-doi.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"title\": \"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\", \"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"abstract\": \"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\", \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"doi\": \" 10.1039/c7fo01251a \", \"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/fedora-builder/src/test/resources/SampleSubmissionData-with-figure-and-table-files.json b/fedora-builder/src/test/resources/SampleSubmissionData-with-figure-and-table-files.json index ae5b60b1..a5c771ba 100644 --- a/fedora-builder/src/test/resources/SampleSubmissionData-with-figure-and-table-files.json +++ b/fedora-builder/src/test/resources/SampleSubmissionData-with-figure-and-table-files.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"title\": \"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\", \"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"abstract\": \"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\", \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"doi\": \"10.1039/c7fo01251a\", \"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/fedora-builder/src/test/resources/SampleSubmissionData-with-missing-common-md-fields.json b/fedora-builder/src/test/resources/SampleSubmissionData-with-missing-common-md-fields.json new file mode 100644 index 00000000..5d83f8be --- /dev/null +++ b/fedora-builder/src/test/resources/SampleSubmissionData-with-missing-common-md-fields.json @@ -0,0 +1,149 @@ +[ + { + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"doi\": \"10.1039/c7fo01251a\", \"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", + "source" : "pass", + "submitted" : true, + "submittedDate" : "2017-06-02T00:00:00.000Z", + "aggregatedDepositStatus" : "not-started", + "publication" : "fake:publication1", + "repositories" : [ "fake:repository1" ], + "user" : "fake:user1", + "grants" : [ "fake:grant1" ], + "@id" : "fake:submission1", + "@type" : "Submission" + }, + { + "title" : "This is the first submission", + "abstract" : "This is a great paper!", + "doi" : "abcdef", + "pmid" : "fedcba", + "journal" : "fake:journal1", + "volume" : "123", + "issue" : "May 2015", + "@id" : "fake:publication1", + "@type" : "Publication" + }, + { + "name" : "AAPS PharmSci", + "issns" : [ "issn123", "issn456" ], + "nlmta" : "AAPS PharmSci", + "pmcParticipation" : "A", + "publisher" : "", + "@id" : "fake:journal1", + "@type" : "Journal" + }, + { + "name" : "PubMed Central", + "description" : "Contains lots of medical papers", + "url" : "http://example.com", + "formSchema" : "{}", + "@id" : "fake:repository1", + "@type" : "Repository" + }, + { + "awardNumber" : "R01EY026617", + "awardStatus" : "active", + "localKey" : "112233", + "projectName" : "Optimal magnification and oculomotor strategies in low vision patients", + "awardDate" : "2017-06-01T00:00:00.000Z", + "startDate" : "2017-05-01T00:00:00.000Z", + "endDate" : "2018-06-01T00:00:00.000Z", + "primaryFunder" : "fake:funder1", + "directFunder" : "fake:funder2", + "pi" : "fake:user2", + "coPis" : [ "fake:user3" ], + "@id" : "fake:grant1", + "@type" : "Grant" + }, + { + "name" : "National Eye Institute", + "url" : "http://example.com/eyeguys", + "localKey" : "aabbcc", + "policy" : "fake:policy1", + "@id" : "fake:funder1", + "@type" : "Funder" + }, + { + "title" : "Be Nice to People With Eyes", + "description" : "We only have eyes for you.", + "policyUrl" : "http://theeyeshaveit.com/policy", + "repositories" : [ "fake:repository1" ], + "institution" : "fake:institution1", + "funder" : "fake:funder1", + "@id" : "fake:policy1", + "@type" : "Policy" + }, + { + "name" : "International Eye Institute", + "url" : "http://example.com/othereyeguys", + "localKey" : "ddeeff", + "policy" : "fake:policy1", + "@id" : "fake:funder2", + "@type" : "Funder" + }, + { + "username" : "bobsmith", + "firstName" : "Robert", + "middleName" : "Cure", + "lastName" : "Smith", + "displayName" : "Bob Smith", + "email" : "bobsmith@jhu.edu", + "affiliation" : "Johns Hopkins", + "institutionalId" : "bs1", + "localKey" : "key123", + "orcidId" : "orcid123", + "roles" : [ "submitter", "admin" ], + "@id" : "fake:user1", + "@type" : "User" + }, + { + "username" : "suzyv", + "firstName" : "Suzanne", + "middleName" : "X", + "lastName" : "Vega", + "displayName" : "Suzanne Vega", + "email" : "suzannev@jhu.edu", + "affiliation" : "Johns Hopkins", + "institutionalId" : "sxv3", + "localKey" : "keyabc", + "orcidId" : "orc456", + "roles" : [ "submitter" ], + "@id" : "fake:user2", + "@type" : "User" + }, + { + "username" : "johndoe", + "firstName" : "John", + "middleName" : "Nobody", + "lastName" : "Doe", + "displayName" : "John Doe", + "email" : "jd@jhu.edu", + "affiliation" : "Johns Hopkins", + "institutionalId" : "jd123", + "localKey" : "keyabc123", + "orcidId" : "orc789", + "roles" : [ "admin" ], + "@id" : "fake:user3", + "@type" : "User" + }, + { + "name" : "test_image", + "uri" : "classpath:/org/dataconservancy/nihms/builder/fs/dektol.jpg", + "description" : "A logo to test supplemental type", + "fileRole" : "supplemental", + "mimeType" : "image/png", + "submission" : "fake:submission1", + "@id" : "fake:file1", + "@type" : "File" + }, + { + "name" : "test_pdf", + "uri" : "classpath:/org/dataconservancy/nihms/builder/fs/ilford_film_processing_chart.pdf", + "description" : "PDF hype to test manuscript type", + "fileRole" : "manuscript", + "mimeType" : "application/pdf", + "submission" : "fake:submission1", + "@id" : "fake:file2", + "@type" : "File" + } +] diff --git a/fedora-builder/src/test/resources/SampleSubmissionData-with-null-common-md-fields.json b/fedora-builder/src/test/resources/SampleSubmissionData-with-null-common-md-fields.json index dc8adf33..6be060aa 100644 --- a/fedora-builder/src/test/resources/SampleSubmissionData-with-null-common-md-fields.json +++ b/fedora-builder/src/test/resources/SampleSubmissionData-with-null-common-md-fields.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\": \"JScholarship\", \"data\": { \"under-embargo\": \"true\", \"Embargo-end-date\": \"09/25/19\", \"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-embargo\": \"true\" } }, { \"id\": \"common\", \"data\": { \"title\": \"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\", \"journal-title\": \"Food Funct.\", \"authors\": [ { \"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\" }, { \"author\": \"Nikki Mandir\" }, { \"author\": \"Denis Calnan\" }, { \"author\": \"Robert A. Goodlad\" }, { \"author\": \"Theo Podas\" }, { \"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\" } ] } }, { \"id\": \"nih\", \"data\": { \"journal-NLMTA-ID\": \"TD452689\", \"ISSN\": \"2042-6496,2042-650X\" } } ]", + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"title\": null, \"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"abstract\": null, \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"doi\": \"10.1039/c7fo01251a\", \"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/fedora-builder/src/test/resources/SampleSubmissionData.json b/fedora-builder/src/test/resources/SampleSubmissionData.json index b57c0c37..8761befe 100644 --- a/fedora-builder/src/test/resources/SampleSubmissionData.json +++ b/fedora-builder/src/test/resources/SampleSubmissionData.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"title\": \"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\", \"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"abstract\": \"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\", \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"doi\": \"10.1039/c7fo01251a\", \"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/nihms-integration/src/test/java/org/dataconservancy/pass/deposit/builder/fedora/FcrepoModelBuilderIT.java b/nihms-integration/src/test/java/org/dataconservancy/pass/deposit/builder/fedora/FcrepoModelBuilderIT.java index 5f7709bf..d3b750fc 100644 --- a/nihms-integration/src/test/java/org/dataconservancy/pass/deposit/builder/fedora/FcrepoModelBuilderIT.java +++ b/nihms-integration/src/test/java/org/dataconservancy/pass/deposit/builder/fedora/FcrepoModelBuilderIT.java @@ -22,7 +22,10 @@ import org.dataconservancy.nihms.model.DepositSubmission; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import org.dataconservancy.nihms.model.JournalPublicationType; import org.dataconservancy.pass.model.PassEntity; import org.dataconservancy.pass.model.Publication; import org.dataconservancy.pass.model.Submission; @@ -34,13 +37,40 @@ import java.io.InputStream; import java.net.URI; import java.net.URL; +import java.time.format.DateTimeFormatter; import java.util.HashMap; +import java.util.List; +import java.util.Map; public class FcrepoModelBuilderIT { + private static final String EXPECTED_JOURNAL_TITLE = "Food & Function"; + + private static final Map EXPECTED_ISSNS = + new HashMap() { + { + put("2042-650X", new DepositMetadata.IssnPubType("2042-650X", JournalPublicationType.EPUB)); + put("2042-6496", new DepositMetadata.IssnPubType("2042-6496", JournalPublicationType.PPUB)); + } + }; + + private static final String EXPECTED_DOI = "10.1039/c7fo01251a"; + + private static final String EXPECTED_EMBARGO_END_DATE = "2018-06-30"; + + private static final int EXPECTED_SUBMITER_COUNT = 1; + + private static final int EXPECTED_PI_COUNT = 1; + + private static final int EXPECTED_CO_PI_COUNT = 1; + + private static final int EXPECTED_AUTHOR_COUNT = 6; + + private static final String EXPECTED_NLMTA = "Food Funct"; + private DepositSubmission submission; private FcrepoModelBuilder underTest = new FcrepoModelBuilder(); - private String SAMPLE_SUBMISSION_RESOURCE = "SampleSubmissionData.json"; + private static final String SAMPLE_SUBMISSION_RESOURCE = "SampleSubmissionData.json"; private HashMap entities = new HashMap<>(); private PassJsonFedoraAdapter adapter = new PassJsonFedoraAdapter(); private Submission submissionEntity = null; @@ -79,19 +109,72 @@ public void testElementValues() { // Cannot compare ID strings, as they change when uploading to a Fedora server. Publication publication = (Publication)entities.get(submissionEntity.getPublication()); - assertEquals(submission.getMetadata().getArticleMetadata().getDoi().toString(), publication.getDoi()); + assertEquals(EXPECTED_DOI, submission.getMetadata().getArticleMetadata().getDoi().toString()); assertNotNull(submission.getFiles()); assertEquals(2, submission.getFiles().size()); // Confirm that some values were set correctly from the Submission metadata DepositMetadata.Journal journalMetadata = submission.getMetadata().getJournalMetadata(); - assertEquals("Food Funct.", journalMetadata.getJournalTitle()); - assertEquals("TD452689", journalMetadata.getJournalId()); - assertEquals("2042-6496,2042-650X", journalMetadata.getIssn()); + assertEquals(EXPECTED_JOURNAL_TITLE, journalMetadata.getJournalTitle()); + + EXPECTED_ISSNS.values().forEach(expectedIssnPubType -> { + journalMetadata.getIssnPubTypes().values().stream() + .filter(candidate -> + candidate.equals(expectedIssnPubType)) + .findAny().orElseThrow(() -> + new RuntimeException("Missing expected IssnPubType " + expectedIssnPubType)); + }); + assertEquals(EXPECTED_ISSNS.size(), journalMetadata.getIssnPubTypes().size()); + + assertEquals(EXPECTED_NLMTA, journalMetadata.getJournalId()); DepositMetadata.Manuscript manuscriptMetadata = submission.getMetadata().getManuscriptMetadata(); - assertEquals("http://dx.doi.org/10.1039/c7fo01251a", manuscriptMetadata.getManuscriptUrl().toString()); + assertNull(manuscriptMetadata.getManuscriptUrl()); + +// assertTrue(submission.getMetadata().getArticleMetadata().getUnderEmbargo()); + assertEquals(EXPECTED_EMBARGO_END_DATE, submission.getMetadata().getArticleMetadata().getEmbargoLiftDate() + .format(DateTimeFormatter.ofPattern("uuuu-MM-dd"))); + + List persons = submission.getMetadata().getPersons(); + assertEquals(EXPECTED_SUBMITER_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.submitter).count()); + assertEquals(EXPECTED_PI_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.pi).count()); + assertEquals(EXPECTED_CO_PI_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.copi).count()); + assertEquals(EXPECTED_AUTHOR_COUNT,persons.stream() + .filter(p -> p.getType() == DepositMetadata.PERSON_TYPE.author).count()); + + assertTrue(persons.stream() + .filter(person -> person.getType() == DepositMetadata.PERSON_TYPE.author) + .anyMatch(author -> + author.getName().equals("Tania Marchbank"))); + + assertTrue(persons.stream() + .filter(person -> person.getType() == DepositMetadata.PERSON_TYPE.author) + .anyMatch(author -> + author.getName().equals("Nikki Mandir"))); + + assertTrue(persons.stream() + .filter(person -> person.getType() == DepositMetadata.PERSON_TYPE.author) + .anyMatch(author -> + author.getName().equals("Denis Calnan"))); + + assertTrue(persons.stream() + .filter(person -> person.getType() == DepositMetadata.PERSON_TYPE.author) + .anyMatch(author -> + author.getName().equals("Robert A. Goodlad"))); + + assertTrue(persons.stream() + .filter(person -> person.getType() == DepositMetadata.PERSON_TYPE.author) + .anyMatch(author -> + author.getName().equals("Theo Podas"))); + + assertTrue(persons.stream() + .filter(person -> person.getType() == DepositMetadata.PERSON_TYPE.author) + .anyMatch(author -> + author.getName().equals("Raymond J. Playford"))); } @After diff --git a/nihms-integration/src/test/resources/org/dataconservancy/pass/deposit/builder/fedora/SampleSubmissionData.json b/nihms-integration/src/test/resources/org/dataconservancy/pass/deposit/builder/fedora/SampleSubmissionData.json index ec00732c..c89e11f9 100644 --- a/nihms-integration/src/test/resources/org/dataconservancy/pass/deposit/builder/fedora/SampleSubmissionData.json +++ b/nihms-integration/src/test/resources/org/dataconservancy/pass/deposit/builder/fedora/SampleSubmissionData.json @@ -1,6 +1,6 @@ [ { - "metadata" : "[{\"id\":\"JScholarship\",\"data\":{\"under-embargo\":\"true\",\"Embargo-end-date\":\"09/25/19\",\"embargo\":\"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\",\"agreement-to-embargo\":\"true\"}},{\"id\":\"common\",\"data\":{\"title\":\"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\",\"journal-title\":\"Food Funct.\",\"journal-title-short\":\"Food Funct.\",\"volume\":\"9\",\"issue\":\"1\",\"abstract\":\"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\",\"subjects\":\"Food Science,General Medicine\",\"URL\":\"http://dx.doi.org/10.1039/c7fo01251a\",\"authors\":[{\"author\":\"Tania Marchbank\",\"orcid\":\"http://orcid.org/0000-0003-2076-9098\"},{\"author\":\"Nikki Mandir\"},{\"author\":\"Denis Calnan\"},{\"author\":\"Robert A. Goodlad\"},{\"author\":\"Theo Podas\"},{\"author\":\"Raymond J. Playford\",\"orcid\":\"http://orcid.org/0000-0003-1235-8504\"}]}},{\"id\":\"nih\",\"data\":{\"journal-NLMTA-ID\":\"TD452689\",\"ISSN\":\"2042-6496,2042-650X\"}}]", + "metadata" : "[{\"id\": \"JScholarship\", \"data\": {\"embargo\": \"NON-EXCLUSIVE LICENSE FOR USE OF MATERIALS This non-exclusive license defines the terms for the deposit of Materials in all formats into the digital repository of materials collected, preserved and made available through the Johns Hopkins Digital Repository, JScholarship. The Contributor hereby grants to Johns Hopkins a royalty free, non-exclusive worldwide license to use, re-use, display, distribute, transmit, publish, re-publish or copy the Materials, either digitally or in print, or in any other medium, now or hereafter known, for the purpose of including the Materials hereby licensed in the collection of materials in the Johns Hopkins Digital Repository for educational use worldwide. In some cases, access to content may be restricted according to provisions established in negotiation with the copyright holder. This license shall not authorize the commercial use of the Materials by Johns Hopkins or any other person or organization, but such Materials shall be restricted to non-profit educational use. Persons may apply for commercial use by contacting the copyright holder. Copyright and any other intellectual property right in or to the Materials shall not be transferred by this agreement and shall remain with the Contributor, or the Copyright holder if different from the Contributor. Other than this limited license, the Contributor or Copyright holder retains all rights, title, copyright and other interest in the images licensed. If the submission contains material for which the Contributor does not hold copyright, the Contributor represents that s/he has obtained the permission of the Copyright owner to grant Johns Hopkins the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. If the submission is based upon work that has been sponsored or supported by an agency or organization other than Johns Hopkins, the Contributor represents that s/he has fulfilled any right of review or other obligations required by such contract or agreement. Johns Hopkins will not make any alteration, other than as allowed by this license, to your submission. This agreement embodies the entire agreement of the parties. No modification of this agreement shall be of any effect unless it is made in writing and signed by all of the parties to the agreement.\", \"agreement-to-deposit\": \"true\"}}, {\"id\": \"common\", \"data\": {\"title\": \"Specific protein supplementation using soya, casein or whey differentially affects regional gut growth and luminal growth factor bioactivity in rats; implications for the treatment of gut injury and stimulating repair\", \"journal-title\": \"Food & Function\", \"volume\": \"9\", \"issue\": \"1\", \"ISSN\": \"2042-6496,2042-650X\", \"abstract\": \"Differential enhancement of luminal growth factor bioactivity and targeted regional gut growth occurs dependent on dietary protein supplement.\", \"authors\": [{\"author\": \"Tania Marchbank\", \"orcid\": \"http://orcid.org/0000-0003-2076-9098\"}, {\"author\": \"Nikki Mandir\"}, {\"author\": \"Denis Calnan\"}, {\"author\": \"Robert A. Goodlad\"}, {\"author\": \"Theo Podas\"}, {\"author\": \"Raymond J. Playford\", \"orcid\": \"http://orcid.org/0000-0003-1235-8504\"}], \"Embargo-end-date\": \"2018-06-30\", \"issn-map\": {\"2042-6496\": {\"pub-type\": [\"Print\"]}, \"2042-650X\": {\"pub-type\": [\"Electronic\"]}}}}, {\"id\": \"crossref\", \"data\": {\"doi\": \"10.1039/c7fo01251a\", \"publisher\": \"Royal Society of Chemistry (RSC)\", \"journal-title-short\": \"Food Funct.\"}}, {\"id\": \"pmc\", \"data\": {\"nlmta\": \"Food Funct\"}}]", "source" : "pass", "submitted" : true, "submittedDate" : "2017-06-02T00:00:00.000Z", diff --git a/nihms-native-assembler/src/main/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializer.java b/nihms-native-assembler/src/main/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializer.java index be0c38bc..1510be14 100644 --- a/nihms-native-assembler/src/main/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializer.java +++ b/nihms-native-assembler/src/main/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializer.java @@ -113,14 +113,13 @@ public void marshal(Object value, HierarchicalStreamWriter writer, writer.endNode(); } - if (journal.getIssn() != null) { + journal.getIssnPubTypes().values().forEach(issnPubType -> { writer.startNode("issn"); - if (journal.getPubType() != null) { - writer.addAttribute("pub-type", journal.getPubType().toString()); - } - writer.setValue(journal.getIssn()); + writer.addAttribute("pub-type", issnPubType.pubType.name().toLowerCase()); + writer.setValue(issnPubType.issn); writer.endNode(); - } + }); + if (journal.getJournalTitle() != null) { writer.startNode("journal-title"); writer.setValue(journal.getJournalTitle()); diff --git a/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsAssemblerIT.java b/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsAssemblerIT.java index 95699ba7..0e4c403d 100644 --- a/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsAssemblerIT.java +++ b/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsAssemblerIT.java @@ -21,6 +21,7 @@ import org.dataconservancy.nihms.model.DepositFileType; import org.dataconservancy.nihms.model.DepositMetadata; import org.dataconservancy.nihms.model.DepositMetadata.Person; +import org.dataconservancy.nihms.model.JournalPublicationType; import org.dataconservancy.pass.deposit.assembler.shared.AbstractAssembler; import org.dataconservancy.pass.deposit.assembler.shared.BaseAssemblerIT; import org.junit.Before; @@ -204,8 +205,21 @@ public void testPackageMetadata() throws Exception { }); // Assert that the DOI is present in the metadata - Element ms = (Element) asList(root.getElementsByTagName("manuscript")).get(0); + Element ms = asList(root.getElementsByTagName("manuscript")).get(0); assertEquals(submission.getMetadata().getArticleMetadata().getDoi().toString(), ms.getAttribute("doi")); + + // Assert that the ISSN is present in the metadata as the element + List issns = asList(root.getElementsByTagName("issn")); + Map issnPubTypes = + submission.getMetadata().getJournalMetadata().getIssnPubTypes(); + assertEquals(issnPubTypes.size(), issns.size()); + assertEquals(1, issns.size()); + Element issn = issns.get(0); + DepositMetadata.IssnPubType expectedIssnPubtype = issnPubTypes.get(issn.getTextContent()); + + assertNotNull(expectedIssnPubtype); + assertEquals(expectedIssnPubtype.issn, issn.getTextContent()); + assertEquals(expectedIssnPubtype.pubType, JournalPublicationType.valueOf(issn.getAttribute("pub-type").toUpperCase())); } private static boolean isNullOrEmpty(String s) { diff --git a/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializerTest.java b/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializerTest.java index 9c96e576..9097c0b2 100644 --- a/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializerTest.java +++ b/nihms-native-assembler/src/test/java/org/dataconservancy/nihms/assembler/nihmsnative/NihmsMetadataSerializerTest.java @@ -17,6 +17,7 @@ package org.dataconservancy.nihms.assembler.nihmsnative; import org.dataconservancy.nihms.model.DepositMetadata; +import org.dataconservancy.nihms.model.JournalPublicationType; import org.junit.BeforeClass; import org.junit.Test; import org.w3c.dom.Node; @@ -34,6 +35,7 @@ import java.net.URI; import java.net.URL; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import static org.junit.Assert.assertTrue; @@ -57,10 +59,13 @@ public static void setup() throws Exception { List personList = new ArrayList<>(); //populate journal metadata - journal.setIssn("1234-5678"); journal.setJournalId("FJ001"); journal.setJournalTitle("Dairy Cow Monthly"); - journal.setPubType(DepositMetadata.JOURNAL_PUBLICATION_TYPE.epub); + journal.setIssnPubTypes(new HashMap() { + { + put("1234-5678", new DepositMetadata.IssnPubType("1234-5678", JournalPublicationType.EPUB)); + } + }); //populate manuscript metadata manuscript.setManuscriptUrl(new URL("http://farm.com/Cows")); diff --git a/shared-assembler/src/test/java/org/dataconservancy/pass/deposit/DepositTestUtil.java b/shared-assembler/src/test/java/org/dataconservancy/pass/deposit/DepositTestUtil.java index 44d0b077..707b6c79 100644 --- a/shared-assembler/src/test/java/org/dataconservancy/pass/deposit/DepositTestUtil.java +++ b/shared-assembler/src/test/java/org/dataconservancy/pass/deposit/DepositTestUtil.java @@ -27,6 +27,7 @@ import org.dataconservancy.nihms.model.DepositManifest; import org.dataconservancy.nihms.model.DepositMetadata; import org.dataconservancy.nihms.model.DepositSubmission; +import org.dataconservancy.nihms.model.JournalPublicationType; import org.junit.rules.TestName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,6 +48,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -148,8 +150,14 @@ public static DepositSubmission composeSubmission() { article.setDoi(URI.create("123/456")); article.setEmbargoLiftDate(ZonedDateTime.now().plusDays(10)); - journal.setIssn("1236-5678"); - journal.setPubType(DepositMetadata.JOURNAL_PUBLICATION_TYPE.ppub); + journal.setIssnPubTypes( + new HashMap() { + { + put("1236-5678", + new DepositMetadata.IssnPubType("1236-5678", JournalPublicationType.EPUB)); + } + } + ); journal.setJournalTitle("American Journal of XYZ Research"); journal.setJournalId("Am J of XYZ Res"); return submission;