Merge branch 'master' of github.com:DSpace/DSpace into rcaap-openaire4-submissionform

This commit is contained in:
Paulo Graça
2019-12-04 09:53:38 +00:00
8 changed files with 328 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ package org.dspace.app.rest.model;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.dspace.app.rest.RestResourceController;
/**
@@ -33,6 +34,8 @@ public class RelationshipRest extends BaseObjectRest<Integer> {
private String leftwardValue;
private String rightwardValue;
@Override
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
public String getType() {
return NAME;
}

View File

@@ -249,7 +249,7 @@ public class RelationshipRestRepository extends DSpaceRestRepository<Relationshi
}
if (jsonNode.hasNonNull("leftPlace")) {
relationship.setRightPlace(relationshipRest.getLeftPlace());
relationship.setLeftPlace(relationshipRest.getLeftPlace());
}
relationshipService.update(context, relationship);

View File

@@ -38,6 +38,7 @@ import org.dspace.app.rest.builder.ItemBuilder;
import org.dspace.app.rest.builder.RelationshipBuilder;
import org.dspace.app.rest.matcher.PageMatcher;
import org.dspace.app.rest.matcher.RelationshipMatcher;
import org.dspace.app.rest.model.RelationshipRest;
import org.dspace.app.rest.test.AbstractEntityIntegrationTest;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Collection;
@@ -2435,5 +2436,52 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
matchMetadata("dc.title", "Publication1"))));
}
@Test
public void putRelationshipWithJson() throws Exception {
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(post("/api/core/relationships")
.param("relationshipType",
isAuthorOfPublicationRelationshipType.getID()
.toString())
.contentType(MediaType.parseMediaType
(org.springframework.data.rest.webmvc.RestMediaTypes
.TEXT_URI_LIST_VALUE))
.content(
"https://localhost:8080/server/api/core/items/" + publication1
.getID() + "\n" +
"https://localhost:8080/server/api/core/items/" + author1
.getID()))
.andExpect(status().isCreated())
.andReturn();
ObjectMapper mapper = new ObjectMapper();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
String id = String.valueOf(map.get("id"));
RelationshipRest relationshipRest = new RelationshipRest();
relationshipRest.setLeftPlace(0);
relationshipRest.setRightPlace(1);
relationshipRest.setLeftwardValue(null);
relationshipRest.setRightwardValue(null);
//Modify the left item in the relationship publication > publication 2
MvcResult mvcResult2 = getClient(token).perform(put("/api/core/relationships/" + id)
.contentType(contentType)
.content(mapper.writeValueAsBytes(relationshipRest)))
.andExpect(status().isOk())
.andReturn();
//verify left item change and other not changed
getClient(token).perform(get("/api/core/relationships/" + id))
.andExpect(status().isOk())
.andExpect(jsonPath("$.leftPlace", is(0)))
.andExpect(jsonPath("$.rightPlace", is(1)));
}
}

View File

@@ -0,0 +1,26 @@
<!-- DSpace Schema Fields definition language -->
<!-- -->
<!-- This DTD defines the format for the DSpace -->
<!-- 'config/registries/*-types.xml' configuration files -->
<!-- Root element is 'dspace-dc-types' -->
<!ELEMENT dspace-dc-types (dspace-header|dc-schema|dc-type)* >
<!ELEMENT dspace-header (title|contributor.author|contributor.editor|date.created|description|description.version)* >
<!ELEMENT dc-schema (name|namespace)* >
<!ELEMENT dc-type (schema|element|qualifier|scope_note)* >
<!ELEMENT title (#PCDATA) >
<!ELEMENT contributor.author (#PCDATA)>
<!ELEMENT contributor.editor (#PCDATA)>
<!ELEMENT date.created (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT description.version (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT namespace (#PCDATA)>
<!ELEMENT schema (#PCDATA)>
<!ELEMENT element (#PCDATA)>
<!ELEMENT qualifier (#PCDATA)>
<!ELEMENT scope_note (#PCDATA)>

View File

@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dspace-dc-types SYSTEM "dspace-dc-types.dtd">
<!--
This document was based on the OpenAIRE4 Guidelines for Literature Repositories
https://openaire-guidelines-for-literature-repository-managers.readthedocs.io/en/v4.0.0/index.html
-->
<dspace-dc-types>
<dspace-header>
<title>OpenAIRE4 fields definition</title>
</dspace-header>
<dc-schema>
<name>oaire</name>
<namespace>http://namespace.openaire.eu/schema/oaire/</namespace>
</dc-schema>
<dc-schema>
<name>datacite</name>
<namespace>http://datacite.org/schema/kernel-4</namespace>
</dc-schema>
<dc-type>
<schema>oaire</schema>
<element>fundingStream</element>
<scope_note>Name of the funding stream</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>awardNumber</element>
<scope_note>Project grantId or awardNumber</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>awardURI</element>
<scope_note>URI of the project landing page provided by the funder for more information about the award (grant).</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>awardTitle</element>
<scope_note>Title of the project, award or grant.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>version</element>
<scope_note>Use either a version number or the label of the vocabulary term as value.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>title</qualifier>
<scope_note>The title name of the container (e.g. journal, book, conference) this work is published in. This property is considered to be part of the bibliographic citation.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>volume</qualifier>
<scope_note>The volume, typically a number, of the container (e.g. journal). This property is considered to be part of the bibliographic citation.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>issue</qualifier>
<scope_note>The issue of the container (e.g. journal). This property is considered to be part of the bibliographic citation.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>startPage</qualifier>
<scope_note>The start page is part of the pagination information of the work published in a container (e.g. journal issue). This property is considered to be part of the bibliographic citation.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>endPage</qualifier>
<scope_note>The end page is part of the pagination information of the work published in a container (e.g. journal issue). This property is considered to be part of the bibliographic citation.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>edition</qualifier>
<scope_note>The edition the work was published in (e.g. book edition). This property is considered to be part of the bibliographic citation.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>conferencePlace</qualifier>
<scope_note>The place where the conference took place. This property is considered to be part of the bibliographic citation.</scope_note>
</dc-type>
<dc-type>
<schema>oaire</schema>
<element>citation</element>
<qualifier>conferenceDate</qualifier>
<scope_note>The date when the conference took place. This property is considered to be part of the bibliographic citation. Recommended best practice for encoding the date value is defined in a profile of ISO 8601 [W3CDTF] and follows the YYYY-MM-DD format.</scope_note>
</dc-type>
<!--
OpenAIRE4 Guidelines
21 - Geolocation -->
<dc-type>
<schema>datacite</schema>
<element>geoLocation</element>
<scope_note>Spatial region or named place where the data was gathered or about which the data is focused.</scope_note>
</dc-type>
<!-- specific type required by OpenAIRE4 Guidelines -->
<dc-type>
<schema>datacite</schema>
<element>subject</element>
<qualifier>fos</qualifier>
<scope_note>Fields of Science and Technology - OECD</scope_note>
</dc-type>
</dspace-dc-types>

View File

@@ -41,5 +41,37 @@
3166-1 alpha-2 country code.
</scope_note>
</dc-type>
<!-- OpenAIRE4 Guidelines -->
<!-- 2.2.2.1. Attribute nameType (R) -->
<!-- and 3.2.6. Subproperty nameIdentifier (R) -->
<!-- specific type required by OpenAIRE4 Guidelines -->
<dc-type>
<schema>organization</schema>
<element>identifier</element>
<scope_note>Generic Identifier</scope_note>
</dc-type>
<dc-type>
<schema>organization</schema>
<element>identifier</element>
<qualifier>isni</qualifier>
<scope_note>International Standard Name Identifier</scope_note>
</dc-type>
<dc-type>
<schema>organization</schema>
<element>identifier</element>
<qualifier>rin</qualifier>
<scope_note>Ringgold identifier</scope_note>
</dc-type>
<dc-type>
<schema>organization</schema>
<element>identifier</element>
<qualifier>ror</qualifier>
<scope_note>Research Organization Registry</scope_note>
</dc-type>
</dspace-dc-types>

View File

@@ -16,6 +16,10 @@
- person.contributor.other > NOT FOUND
-->
<!--
OpenAIRE4 Guidelines
2.2.3. Subproperty givenName (R)
The personal or first name of the author. -->
<dc-type>
<schema>person</schema>
<element>givenName</element>
@@ -23,7 +27,11 @@
of the name property.
</scope_note>
</dc-type>
<!--
OpenAIRE4 Guidelines
2.2.4. Subproperty familyName (R)
The surname or last name of the author. -->
<dc-type>
<schema>person</schema>
<element>familyName</element>
@@ -64,5 +72,63 @@
<element>jobTitle</element>
<scope_note>The job title of the person (for example, Financial Manager).</scope_note>
</dc-type>
<!--
OpenAIRE4 Guidelines
2.2.6. Subproperty affiliation (R)
The organizational or institutional affiliation of the creator (occurrence: 0-n). -->
<dc-type>
<schema>person</schema>
<element>affiliation</element>
<qualifier>name</qualifier>
<scope_note>The organizational or institutional affiliation of the creator</scope_note>
</dc-type>
<!-- OpenAIRE4 Guidelines -->
<!-- 2.2.2.1. Attribute nameType (R) -->
<!-- and 3.2.6. Subproperty nameIdentifier (R) -->
<!-- specific type required by OpenAIRE4 Guidelines -->
<dc-type>
<schema>person</schema>
<element>identifier</element>
<qualifier>scopus-author-id</qualifier>
<scope_note>Scopus Author ID</scope_note>
</dc-type>
<dc-type>
<schema>person</schema>
<element>identifier</element>
<qualifier>ciencia-id</qualifier>
<scope_note>Permanent individual means of identification and authentication for citizens carrying out scientific activity. - https://www.ciencia-id.pt/</scope_note>
</dc-type>
<dc-type>
<schema>person</schema>
<element>identifier</element>
<qualifier>gsid</qualifier>
<scope_note>Google Scholar ID</scope_note>
</dc-type>
<dc-type>
<schema>person</schema>
<element>identifier</element>
<qualifier>orcid</qualifier>
<scope_note>Open Researcher and Contributor ID</scope_note>
</dc-type>
<dc-type>
<schema>person</schema>
<element>identifier</element>
<qualifier>rid</qualifier>
<scope_note>Web of Science ResearcherID</scope_note>
</dc-type>
<dc-type>
<schema>person</schema>
<element>identifier</element>
<qualifier>isni</qualifier>
<scope_note>International Standard Name Identifier</scope_note>
</dc-type>
</dspace-dc-types>

View File

@@ -16,5 +16,28 @@
- project.identifier.startdate > NOT FOUND
- project.identifier.expectedcompletion > NOT FOUND
-->
<!--
OpenAIRE4 Guidelines
4.2.2. Subproperty funderName (M)
Name of the funding provider (occurrence: 1). Mandatory if FundingReference is used. -->
<dc-type>
<schema>project</schema>
<element>funder</element>
<qualifier>name</qualifier>
<scope_note>Name of the funding provider.</scope_note>
</dc-type>
<!--
OpenAIRE4 Guidelines
4.2.3. Subproperty funderIdentifier (R)
Unique identifier of the funding entity (occurrence: 0-1).
-->
<dc-type>
<schema>project</schema>
<element>funder</element>
<qualifier>identifier</qualifier>
<scope_note>Unique identifier of the funding entity.</scope_note>
</dc-type>
</dspace-dc-types>
</dspace-dc-types>