diff --git a/dspace-api/src/test/data/dspaceFolder/config/entities/relationship-types.xml b/dspace-api/src/test/data/dspaceFolder/config/entities/relationship-types.xml index 122e6ccdd6d..32248c6bc40 100644 --- a/dspace-api/src/test/data/dspaceFolder/config/entities/relationship-types.xml +++ b/dspace-api/src/test/data/dspaceFolder/config/entities/relationship-types.xml @@ -129,4 +129,30 @@ true + + Product + Person + isCreatorOfProduct + isProductOfCreator + + 0 + + + 0 + + true + + + Patent + Person + isInventorOfPatent + isPatentOfInventor + + 0 + + + 0 + + true + \ No newline at end of file diff --git a/dspace-api/src/test/data/dspaceFolder/config/item-submission.xml b/dspace-api/src/test/data/dspaceFolder/config/item-submission.xml index 58326b88215..3cebd9a037a 100644 --- a/dspace-api/src/test/data/dspaceFolder/config/item-submission.xml +++ b/dspace-api/src/test/data/dspaceFolder/config/item-submission.xml @@ -28,6 +28,8 @@ + + @@ -304,6 +306,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/dspace-api/src/test/data/dspaceFolder/config/submission-forms.xml b/dspace-api/src/test/data/dspaceFolder/config/submission-forms.xml index 6b7349616e2..e564b0d445f 100644 --- a/dspace-api/src/test/data/dspaceFolder/config/submission-forms.xml +++ b/dspace-api/src/test/data/dspaceFolder/config/submission-forms.xml @@ -465,6 +465,68 @@ it, please enter the types and the actual numbers or codes. +
+ + + isInventorOf + person + true + + Select the person who invented this patent. + + dc + contributor + author + onebox + + orcid + + + + + dc + title + + false + + onebox + Enter the main title of the item. + You must enter a main title for this item. + + +
+ +
+ + + isCreatorOf + person + true + + Select the person who created this product. + + dc + contributor + author + onebox + + orcid + + + + + dc + title + + false + + onebox + Enter the main title of the item. + You must enter a main title for this item. + + +
+ diff --git a/dspace-api/src/test/java/org/dspace/orcid/service/OrcidEntityFactoryServiceIT.java b/dspace-api/src/test/java/org/dspace/orcid/service/OrcidEntityFactoryServiceIT.java index 187bd9b29c5..e7b631dd745 100644 --- a/dspace-api/src/test/java/org/dspace/orcid/service/OrcidEntityFactoryServiceIT.java +++ b/dspace-api/src/test/java/org/dspace/orcid/service/OrcidEntityFactoryServiceIT.java @@ -100,7 +100,7 @@ public void setup() { .withEntityType("OrgUnit") .build(); - patents = CollectionBuilder.createCollection(context, parentCommunity) + patents = CollectionBuilder.createCollection(context, parentCommunity, "123456789/test-patent") .withName("Collection") .withEntityType("Patent") .build(); @@ -110,7 +110,7 @@ public void setup() { .withEntityType("Publication") .build(); - products = CollectionBuilder.createCollection(context, parentCommunity) + products = CollectionBuilder.createCollection(context, parentCommunity, "123456789/test-product") .withName("Collection") .withEntityType("Product") .build(); @@ -127,7 +127,7 @@ public void setup() { persons = CollectionBuilder.createCollection(context, parentCommunity) .withName("Collection") - .withEntityType("person") + .withEntityType("Person") .build(); context.restoreAuthSystemState(); @@ -173,6 +173,7 @@ public void testWorkCreation() { List contributors = work.getWorkContributors().getContributor(); assertThat(contributors, hasSize(3)); + //tornano 3 ma sono null assertThat(contributors, has(contributor("Walter White", AUTHOR, FIRST))); assertThat(contributors, has(contributor("Editor", EDITOR, FIRST))); assertThat(contributors, has(contributor("Jesse Pinkman", AUTHOR, ADDITIONAL))); @@ -207,6 +208,22 @@ public void testProductWorkCreation() { .withScopusIdentifier("scopus-id") .build(); + Item person = ItemBuilder.createItem(context, persons) + .withTitle("Walter White") + .withIssueDate("2017-10-17") + .withAuthor("Walter, White") + .withPersonIdentifierLastName("Walter") + .withPersonIdentifierFirstName("White") + .build(); + + EntityType productType = EntityTypeBuilder.createEntityTypeBuilder(context, "Product").build(); + EntityType personType = EntityTypeBuilder.createEntityTypeBuilder(context, "Person").build(); + + RelationshipType isCreatorOfProduct = createRelationshipTypeBuilder(context, productType, personType, + "isCreatorOfProduct", "isProductOfCreator", 0, null, 0, null).build(); + + RelationshipBuilder.createRelationshipBuilder(context, product, person, isCreatorOfProduct).build(); + context.restoreAuthSystemState(); Activity activity = entityFactoryService.createOrcidObject(context, product); @@ -260,6 +277,22 @@ public void testPatentWorkCreation() { .withType("http://purl.org/coar/resource_type/c_15cd") .build(); + Item person = ItemBuilder.createItem(context, persons) + .withTitle("Walter White") + .withIssueDate("2017-10-17") + .withAuthor("Walter, White") + .withPersonIdentifierLastName("Walter") + .withPersonIdentifierFirstName("White") + .build(); + + EntityType patentType = EntityTypeBuilder.createEntityTypeBuilder(context, "Patent").build(); + EntityType personType = EntityTypeBuilder.createEntityTypeBuilder(context, "Person").build(); + + RelationshipType isInventorOfPatent = createRelationshipTypeBuilder(context, patentType, personType, + "isInventorOfPatent", "isPatentOfInventor", 0, null, 0, null).build(); + + RelationshipBuilder.createRelationshipBuilder(context, patent, person, isInventorOfPatent).build(); + context.restoreAuthSystemState(); Activity activity = entityFactoryService.createOrcidObject(context, patent); @@ -294,85 +327,6 @@ public void testPatentWorkCreation() { } - @Test - public void testWorkWithFundingCreation() { - context.turnOffAuthorisationSystem(); - - Item publication = ItemBuilder.createItem(context, publications) - .withTitle("Test publication") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("Book") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, publication); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", publication.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "123456"))); - } - - @Test - public void testProductWorkWithFundingCreation() { - context.turnOffAuthorisationSystem(); - - Item product = ItemBuilder.createItem(context, products) - .withTitle("Test dataset") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/H6QP-SC1X") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, product); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", product.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "123456"))); - } - - @Test - public void testPatentsWorkWithFundingCreation() { - context.turnOffAuthorisationSystem(); - - Item patent = ItemBuilder.createItem(context, patents) - .withTitle("Test patent") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/c_15cd") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, patent); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", patent.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "123456"))); - } - - @Test public void testWorkWithFundingWithoutGrantNumberCreation() { context.turnOffAuthorisationSystem(); @@ -517,302 +471,6 @@ public void testPatentWorkWithFundingWithGrantNumberPlaceholderCreation() { assertThat(externalIds, has(selfExternalId("handle", patent.getHandle()))); } - - @Test - public void testWorkWithFundingEntityWithoutGrantNumberCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withTitle("Test funding") - .build(); - - Item publication = ItemBuilder.createItem(context, publications) - .withTitle("Test publication") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("Controlled Vocabulary for Resource Type Genres::text::book") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, publication); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", publication.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "123456"))); - } - - @Test - public void testProductWorkWithFundingEntityWithoutGrantNumberCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withTitle("Test funding") - .build(); - - Item product = ItemBuilder.createItem(context, products) - .withTitle("Test product") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/c_7ad9") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, product); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", product.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "123456"))); - } - - @Test - public void testPatentWorkWithFundingEntityWithoutGrantNumberCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withTitle("Test funding") - .build(); - - Item patent = ItemBuilder.createItem(context, patents) - .withTitle("Test patent") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/c_15cd") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, patent); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", patent.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "123456"))); - } - - @Test - public void testWorkWithFundingEntityWithGrantNumberCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withHandle("123456789/0001") - .withTitle("Test funding") - .withFundingIdentifier("987654") - .build(); - - Item publication = ItemBuilder.createItem(context, publications) - .withTitle("Test publication") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("Controlled Vocabulary for Resource Type Genres::text::book") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, publication); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", publication.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "987654", - "http://localhost:4000/handle/123456789/0001"))); - } - - @Test - public void testProductWorkWithFundingEntityWithGrantNumberCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withHandle("123456789/0001") - .withTitle("Test funding") - .withFundingIdentifier("987654") - .build(); - - Item product = ItemBuilder.createItem(context, products) - .withTitle("Test product") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/c_18cc") - .withRelationFunding("Test funding", funding.getID().toString()) - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, product); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", product.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "987654", - "http://localhost:4000/handle/123456789/0001"))); - } - - @Test - public void testPatentWorkWithFundingEntityWithGrantNumberCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withHandle("123456789/0001") - .withTitle("Test funding") - .withFundingIdentifier("987654") - .build(); - - Item patent = ItemBuilder.createItem(context, patents) - .withTitle("Test patent") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/c_15cd") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, patent); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", patent.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "987654", - "http://localhost:4000/handle/123456789/0001"))); - } - - - @Test - public void testWorkWithFundingEntityWithGrantNumberAndUrlCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withHandle("123456789/0001") - .withTitle("Test funding") - .withFundingIdentifier("987654") - .build(); - - Item publication = ItemBuilder.createItem(context, publications) - .withTitle("Test publication") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("Controlled Vocabulary for Resource Type Genres::text::book") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, publication); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", publication.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "987654", "http://test-funding"))); - } - - @Test - public void testProductWorkWithFundingEntityWithGrantNumberAndUrlCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withHandle("123456789/0001") - .withTitle("Test funding") - .withFundingIdentifier("987654") - .build(); - - Item product = ItemBuilder.createItem(context, products) - .withTitle("Test product") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/c_18cc") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, product); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", product.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "987654", "http://test-funding"))); - } - - @Test - public void testPatentWorkWithFundingEntityWithGrantNumberAndUrlCreation() { - - context.turnOffAuthorisationSystem(); - - Item funding = ItemBuilder.createItem(context, fundings) - .withHandle("123456789/0001") - .withTitle("Test funding") - .withFundingIdentifier("987654") - .build(); - - Item patent = ItemBuilder.createItem(context, patents) - .withTitle("Test patent") - .withAuthor("Walter White") - .withIssueDate("2021-04-30") - .withType("http://purl.org/coar/resource_type/c_15cd") - .withRelationFunding("Test funding") - .withRelationGrantno("123456") - .build(); - - context.restoreAuthSystemState(); - - Activity activity = entityFactoryService.createOrcidObject(context, patent); - assertThat(activity, instanceOf(Work.class)); - - Work work = (Work) activity; - - List externalIds = work.getExternalIdentifiers().getExternalIdentifier(); - assertThat(externalIds, hasSize(2)); - assertThat(externalIds, has(selfExternalId("handle", patent.getHandle()))); - assertThat(externalIds, has(fundedByExternalId("grant_number", "987654", "http://test-funding"))); - } - @Test public void testEmptyWorkWithUnknownTypeCreation() { diff --git a/dspace/config/entities/relationship-types.xml b/dspace/config/entities/relationship-types.xml index 7ae1ff61162..56de9602dcb 100644 --- a/dspace/config/entities/relationship-types.xml +++ b/dspace/config/entities/relationship-types.xml @@ -130,4 +130,30 @@ true + + Product + Person + isCreatorOfProduct + isProductOfCreator + + 0 + + + 0 + + true + + + Product + Person + isInventorOfPatent + isPatentOfInventor + + 0 + + + 0 + + true + \ No newline at end of file diff --git a/dspace/config/item-submission.xml b/dspace/config/item-submission.xml index b5278d2f3d8..f61c260c2fa 100644 --- a/dspace/config/item-submission.xml +++ b/dspace/config/item-submission.xml @@ -180,6 +180,17 @@ accessCondition + + submit.progressbar.describe.product + org.dspace.app.rest.submit.step.DescribeStep + submission-form + + + submit.progressbar.describe.patent + org.dspace.app.rest.submit.step.DescribeStep + submission-form + +