Skip to content

Commit

Permalink
Merge branch 'master' into MODINV-1072
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrokrutii authored Oct 14, 2024
2 parents d01d16a + 1c55d7b commit 8234f34
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 171 deletions.
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)
* Fix inconsistencies in permission namings [MODINV-1072](https://folio-org.atlassian.net/browse/MODINV-1072)

## 20.2.0 2023-03-20
Expand Down
2 changes: 2 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ After setup, it is good to check logs in all related modules for errors.
* DI_INVENTORY_AUTHORITY_CREATED_READY_FOR_POST_PROCESSING_PARTITIONS
* DI_INVENTORY_AUTHORITY_UPDATED_READY_FOR_POST_PROCESSING_PARTITIONS
* DI_SRS_MARC_BIB_RECORD_MODIFIED_PARTITIONS
* INVENTORY_INSTANCE_INGRESS_PARTITIONS

Default value for all partitions is 1

## Properties
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",
"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": {
"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
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

public class InstanceIngressConsumerVerticle extends KafkaConsumerVerticle {

public static final String INSTANCE_INGRESS_TOPIC = "inventory.instance_ingress";

private static final Logger LOGGER = LogManager.getLogger(InstanceIngressConsumerVerticle.class);
private static final String INSTANCE_INGRESS_TOPIC = "linked-data.instance-ingress";
private static final String BASE_PROPERTY = "InstanceIngressConsumerVerticle";

@Override
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.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_MATCHED;
import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_MODIFIED;
import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_NOT_MATCHED;
import static org.folio.inventory.InstanceIngressConsumerVerticle.INSTANCE_INGRESS_TOPIC;

import org.folio.kafka.services.KafkaTopic;

Expand All @@ -45,7 +46,8 @@ public KafkaTopic[] createTopicObjects() {
new InventoryKafkaTopic(DI_INVENTORY_HOLDINGS_CREATED_READY_FOR_POST_PROCESSING.value(), holdingCreatedReadyForPostProcessingPartitions()),
new InventoryKafkaTopic(DI_INVENTORY_AUTHORITY_CREATED_READY_FOR_POST_PROCESSING.value(), authorityCreatedReadyForPostProcessingPartitions()),
new InventoryKafkaTopic(DI_INVENTORY_AUTHORITY_UPDATED_READY_FOR_POST_PROCESSING.value(), authorityUpdatedReadyForPostProcessingPartitions()),
new InventoryKafkaTopic(DI_SRS_MARC_BIB_RECORD_MODIFIED.value(), marcBibRecordModifiedPartitions())
new InventoryKafkaTopic(DI_SRS_MARC_BIB_RECORD_MODIFIED.value(), marcBibRecordModifiedPartitions()),
new InventoryKafkaTopic(INSTANCE_INGRESS_TOPIC, instanceIngressPartitions())
};
}

Expand Down Expand Up @@ -128,4 +130,8 @@ private Integer marcBibRecordModifiedPartitions() {
return Integer.valueOf(firstNonBlank(System.getenv(
"DI_SRS_MARC_BIB_RECORD_MODIFIED_PARTITIONS"), "1"));
}

private Integer instanceIngressPartitions() {
return Integer.valueOf(firstNonBlank(System.getenv("INVENTORY_INSTANCE_INGRESS_PARTITIONS"), "1"));
}
}
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
Loading

0 comments on commit 8234f34

Please sign in to comment.