Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MODINV-1080] API version update #771

Merged
merged 8 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 20.3.0-SNAPSHOT 2024-xx-xx
## 21.0.0-SNAPSHOT 2024-xx-xx
* Existing "035" field is not retained the original position in imported record [MODINV-1049](https://folio-org.atlassian.net/browse/MODINV-1049)
* Update Data Import logic to normalize OCLC 035 values [MODINV-949](https://folio-org.atlassian.net/browse/MODINV-949)
* The sorting for Items on Instance details page is not worked [MODINV-1001](https://folio-org.atlassian.net/browse/MODINV-1001)
Expand All @@ -23,6 +23,7 @@
* Apply new date type fields to instance schema [MODINV-1067](https://folio-org.atlassian.net/browse/MODINV-1067)
* Extend Authority with Additional fields [MODINV-1071](https://folio-org.atlassian.net/browse/MODINV-1071)
* Keep original UUIDs when updating ownership of Holdings/Items [MODINV-1074](https://folio-org.atlassian.net/browse/MODINV-1074)
* API version update [MODINV-1080](https://folio-org.atlassian.net/browse/MODINV-1080)

## 20.2.0 2023-03-20
* Inventory cannot process Holdings with virtual fields ([MODINV-941](https://issues.folio.org/browse/MODINV-941))
Expand Down
8 changes: 4 additions & 4 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"provides": [
{
"id": "inventory",
"version": "13.3",
"version": "14.0",
RuslanLavrov marked this conversation as resolved.
Show resolved Hide resolved
"handlers": [
{
"methods": ["GET"],
Expand Down Expand Up @@ -451,7 +451,7 @@
},
{
"id": "inventory-batch",
"version": "2.0",
"version": "3.0",
"handlers": [
{
"methods": ["POST"],
Expand Down Expand Up @@ -604,11 +604,11 @@
},
{
"id": "instance-storage",
"version": "10.3"
"version": "11.0"
},
{
"id": "instance-storage-batch",
"version": "2.0"
"version": "3.0"
},
{
"id": "holdings-storage",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>mod-inventory</artifactId>
<groupId>org.folio</groupId>
<version>20.3.0-SNAPSHOT</version>
<version>21.0.0-SNAPSHOT</version>
<licenses>
<license>
<name>Apache License 2.0</name>
Expand Down
15 changes: 0 additions & 15 deletions ramls/instance.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,6 @@
},
"uniqueItems": true
},
"publicationPeriod": {
RuslanLavrov marked this conversation as resolved.
Show resolved Hide resolved
"type": "object",
"description": "Publication period",
"properties": {
"start": {
"type": "integer",
"description": "Publication start year"
},
"end": {
"type": "integer",
"description": "Publication end year"
}
},
"additionalProperties": false
},
"electronicAccess": {
"type": "array",
"description": "List of electronic access items",
Expand Down
2 changes: 1 addition & 1 deletion ramls/inventory.raml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#%RAML 1.0
title: Inventory API
version: v13.0
version: v14.0
protocols: [ HTTP, HTTPS ]
baseUri: http://localhost

Expand Down
14 changes: 0 additions & 14 deletions src/main/java/org/folio/inventory/domain/instances/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import static org.folio.inventory.domain.instances.Dates.datesFromJson;
import static org.folio.inventory.domain.instances.Dates.datesToJson;
import static org.folio.inventory.domain.instances.PublicationPeriod.publicationPeriodFromJson;
import static org.folio.inventory.domain.instances.PublicationPeriod.publicationPeriodToJson;
import static org.folio.inventory.support.JsonArrayHelper.toListOfStrings;

import java.lang.invoke.MethodHandles;
Expand Down Expand Up @@ -74,7 +72,6 @@ public class Instance {
public static final String TAGS_KEY = "tags";
public static final String TAG_LIST_KEY = "tagList";
public static final String NATURE_OF_CONTENT_TERM_IDS_KEY = "natureOfContentTermIds";
public static final String PUBLICATION_PERIOD_KEY = "publicationPeriod";
public static final String DATES_KEY = "dates";

private final String id;
Expand Down Expand Up @@ -119,7 +116,6 @@ public class Instance {
private Metadata metadata = null;
private List<String> tags;
private List<String> natureOfContentTermIds = new ArrayList<>();
private PublicationPeriod publicationPeriod;
private Dates dates;

protected static final String INVENTORY_PATH = "/inventory";
Expand Down Expand Up @@ -192,7 +188,6 @@ public static Instance fromJson(JsonObject instanceJson) {
.setStatusUpdatedDate(instanceJson.getString(STATUS_UPDATED_DATE_KEY))
.setTags(getTags(instanceJson))
.setNatureOfContentTermIds(toListOfStrings(instanceJson.getJsonArray(NATURE_OF_CONTENT_TERM_IDS_KEY)))
.setPublicationPeriod(publicationPeriodFromJson(instanceJson.getJsonObject(PUBLICATION_PERIOD_KEY)))
.setDates(datesFromJson(instanceJson.getJsonObject(DATES_KEY)));
}

Expand Down Expand Up @@ -241,7 +236,6 @@ public JsonObject getJsonForStorage() {
json.put(STATUS_UPDATED_DATE_KEY, statusUpdatedDate);
json.put(TAGS_KEY, new JsonObject().put(TAG_LIST_KEY, new JsonArray(getTags() == null ? Collections.emptyList() : getTags())));
json.put(NATURE_OF_CONTENT_TERM_IDS_KEY, natureOfContentTermIds);
putIfNotNull(json, PUBLICATION_PERIOD_KEY, publicationPeriodToJson(publicationPeriod));
putIfNotNull(json, DATES_KEY, datesToJson(dates));

return json;
Expand Down Expand Up @@ -295,7 +289,6 @@ public JsonObject getJsonForResponse(WebContext context) {
putIfNotNull(json, METADATA_KEY, getMetadata());
putIfNotNull(json, TAGS_KEY, new JsonObject().put(TAG_LIST_KEY, new JsonArray(getTags())));
putIfNotNull(json, NATURE_OF_CONTENT_TERM_IDS_KEY, getNatureOfContentTermIds());
putIfNotNull(json, PUBLICATION_PERIOD_KEY, publicationPeriodToJson(publicationPeriod));
putIfNotNull(json, DATES_KEY, datesToJson(dates));

if (precedingTitles != null) {
Expand Down Expand Up @@ -759,7 +752,6 @@ public Instance copyWithNewId(String newId) {
.setMetadata(metadata)
.setTags(tags)
.setNatureOfContentTermIds(natureOfContentTermIds)
.setPublicationPeriod(publicationPeriod)
.setDates(dates);
}

Expand Down Expand Up @@ -794,7 +786,6 @@ public Instance copyInstance() {
.setMetadata(metadata)
.setTags(tags)
.setNatureOfContentTermIds(natureOfContentTermIds)
.setPublicationPeriod(publicationPeriod)
.setDates(dates);
}

Expand Down Expand Up @@ -831,11 +822,6 @@ public Instance removeIdentifier(final String identifierTypeId, final String val
return copyInstance().setIdentifiers(newIdentifiers);
}

public Instance setPublicationPeriod(PublicationPeriod period) {
this.publicationPeriod = period;
return this;
}

@Override
public String toString() {
return String.format("Instance ID: %s, HRID: %s, Title: %s", id, hrid, title);
Expand Down

This file was deleted.

17 changes: 1 addition & 16 deletions src/test/java/api/InstancesApiExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
import static org.folio.inventory.domain.instances.Dates.datesToJson;
import static org.folio.inventory.domain.instances.Instance.DATES_KEY;
import static org.folio.inventory.domain.instances.Instance.PRECEDING_TITLES_KEY;
import static org.folio.inventory.domain.instances.Instance.PUBLICATION_PERIOD_KEY;
import static org.folio.inventory.domain.instances.Instance.TAGS_KEY;
import static org.folio.inventory.domain.instances.Instance.TAG_LIST_KEY;
import static org.folio.inventory.domain.instances.PublicationPeriod.publicationPeriodToJson;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
Expand All @@ -46,7 +44,6 @@
import org.folio.inventory.config.InventoryConfiguration;
import org.folio.inventory.config.InventoryConfigurationImpl;
import org.folio.inventory.domain.instances.Dates;
import org.folio.inventory.domain.instances.PublicationPeriod;
import org.folio.inventory.domain.instances.Subject;
import org.folio.inventory.domain.instances.titles.PrecedingSucceedingTitle;
import org.folio.inventory.support.JsonArrayHelper;
Expand Down Expand Up @@ -102,7 +99,6 @@ public void canCreateInstanceWithoutAnIDAndHRID()
.put("administrativeNotes", adminNote)
.put("instanceTypeId", ApiTestSuite.getTextInstanceType())
.put(TAGS_KEY, new JsonObject().put(TAG_LIST_KEY, new JsonArray().add(tagNameOne)))
.put(PUBLICATION_PERIOD_KEY, publicationPeriodToJson(new PublicationPeriod(1000, 2000)))
.put(DATES_KEY, datesToJson(new Dates(dateTypeId, date1, date2)))
.put("natureOfContentTermIds",
new JsonArray(asList(
Expand Down Expand Up @@ -169,10 +165,6 @@ public void canCreateInstanceWithoutAnIDAndHRID()

assertThat(createdInstance.getString("hrid"), notNullValue());

var publicationPeriod = createdInstance.getJsonObject(PUBLICATION_PERIOD_KEY);
assertThat(publicationPeriod.getInteger("start"), is(1000));
assertThat(publicationPeriod.getInteger("end"), is(2000));

var dates = createdInstance.getJsonObject(DATES_KEY);
assertThat(dates.getString(DATE_TYPE_ID_KEY), is(dateTypeId));
assertThat(dates.getString(DATE1_KEY), is(date1));
Expand Down Expand Up @@ -409,15 +401,14 @@ public void canUpdateAnExistingInstance()
JsonObject smallAngryPlanet = smallAngryPlanet(id);
smallAngryPlanet.put("natureOfContentTermIds",
new JsonArray().add(ApiTestSuite.getBibliographyNatureOfContentTermId()));
smallAngryPlanet.put(PUBLICATION_PERIOD_KEY, publicationPeriodToJson(new PublicationPeriod(1000, 2000)));

smallAngryPlanet.put(DATES_KEY, datesToJson(new Dates(null, date1, date2)));

JsonObject newInstance = createInstance(smallAngryPlanet);

JsonObject updateInstanceRequest = newInstance.copy()
.put("title", "The Long Way to a Small, Angry Planet")
.put(TAGS_KEY, new JsonObject().put(TAG_LIST_KEY, new JsonArray().add(tagNameTwo)))
.put(PUBLICATION_PERIOD_KEY, publicationPeriodToJson(new PublicationPeriod(2000, 2012)))
.put(DATES_KEY, datesToJson(new Dates(dateTypeId, date1, date2)))
.put("natureOfContentTermIds",
new JsonArray().add(ApiTestSuite.getAudiobookNatureOfContentTermId()))
Expand Down Expand Up @@ -454,10 +445,6 @@ public void canUpdateAnExistingInstance()
assertThat(natureOfContentTermIds.size(), is(1));
assertThat(natureOfContentTermIds.getString(0), is(ApiTestSuite.getAudiobookNatureOfContentTermId()));

var publicationPeriod = updatedInstance.getJsonObject(PUBLICATION_PERIOD_KEY);
assertThat(publicationPeriod.getInteger("start"), is(2000));
assertThat(publicationPeriod.getInteger("end"), is(2012));

var dates = updatedInstance.getJsonObject(DATES_KEY);
assertThat(dates.getString(DATE_TYPE_ID_KEY), is(dateTypeId));
assertThat(dates.getString(DATE1_KEY), is(date1));
Expand All @@ -477,7 +464,6 @@ public void canUpdateAnExistingInstanceWithPrecedingSucceedingTitlesMarcSource()
JsonObject smallAngryPlanet = smallAngryPlanet(id);
smallAngryPlanet.put("natureOfContentTermIds",
new JsonArray().add(ApiTestSuite.getBibliographyNatureOfContentTermId()));
smallAngryPlanet.put(PUBLICATION_PERIOD_KEY, publicationPeriodToJson(new PublicationPeriod(1000, 2000)));

JsonArray precedingTitles = new JsonArray();
precedingTitles.add(
Expand Down Expand Up @@ -506,7 +492,6 @@ public void canUpdateAnExistingInstanceWithPrecedingSucceedingTitlesMarcSource()

JsonObject updateInstanceRequest = newInstance.copy()
.put(TAGS_KEY, new JsonObject().put(TAG_LIST_KEY, new JsonArray().add(tagNameTwo)))
.put(PUBLICATION_PERIOD_KEY, publicationPeriodToJson(new PublicationPeriod(2000, 2012)))
.put(PRECEDING_TITLES_KEY, precedingTitles)
.put("natureOfContentTermIds",
new JsonArray().add(ApiTestSuite.getAudiobookNatureOfContentTermId()));
Expand Down

This file was deleted.

Loading