Skip to content
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
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@

### New APIs versions
* Provides `item-storage 10.2`
* Provides `instance-storage 11.2`

### Features
* Make max.request.size configurable for reindex holdings/items producers ([MODINVSTOR-1372](https://folio-org.atlassian.net/browse/MODINVSTOR-1372))
* Create index for discoverySuppress and source fields to improve performance of queries which include mentioned fields ([MODINVSTOR-1377](https://folio-org.atlassian.net/browse/MODINVSTOR-1377))
* Introduce new post retrieve api to fetch inventory item ([MODINVSTOR-1381](https://folio-org.atlassian.net/browse/MODINVSTOR-1381))
* Optimize reindex instances database fetch query ([MODINVSTOR-1395](https://folio-org.atlassian.net/browse/MODINVSTOR-1395))
* Add instance property `sourceUri` ([MODINVNSTOR-1390](https://folio-org.atlassian.net/browse/MODINVSTOR-1390))
* Create index for "deleted" field to improve performance of mod-oai-pmh views ([MODOAIPMH-614](https://folio-org.atlassian.net/browse/MODOAIPMH-614))
* Execute migration script to add "deleted" field to instance.jsonb if it's missing ([MODINVSTOR-1425](https://folio-org.atlassian.net/browse/MODINVSTOR-1425))


### Bug fixes
* Fix ordering of electronic access items for inventory-hierarchy, oai-pmh-view ([MODINVSTOR-1224](https://folio-org.atlassian.net/browse/MODINVSTOR-1224))
* Fix error serialization when writing to files uploaded to S3 ([MODINVSTOR-1389](https://folio-org.atlassian.net/browse/MODINVSTOR-1389))
* Fix changes propagation to shadow instances after shared instance update ([MODINVSTOR-1393](https://folio-org.atlassian.net/browse/MODINVSTOR-1393))
* Fix metadata not filled for records created via `POST /instance-storage/batch/synchronous`([MODINVSTOR-1382](https://folio-org.atlassian.net/browse/MODINVSTOR-1382))
* Fixed random "`Cannot set holdings_record.instanceid = [...] because it does not exist in instance.id.`" errors when opening orders ([MODINVSTOR-1427](https://folio-org.atlassian.net/browse/MODINVSTOR-1427))

### Tech Dept
* Description ([ISSUE](https://folio-org.atlassian.net/browse/ISSUE))
Expand Down
371 changes: 0 additions & 371 deletions checkstyle/checkstyle.xml

This file was deleted.

2 changes: 1 addition & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
},
{
"id": "instance-storage",
"version": "11.1",
"version": "11.2",
"handlers": [
{
"methods": ["GET"],
Expand Down
17 changes: 13 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<log4j.version>2.24.3</log4j.version>
<folio-s3-client.version>2.4.0-SNAPSHOT</folio-s3-client.version>

<okapi-testing.version>6.2.2</okapi-testing.version>
<okapi-testing.version>6.2.3</okapi-testing.version>
<junit.version>5.12.2</junit.version>
<testcontainers.version>1.20.6</testcontainers.version>
<joda-time.version>2.14.0</joda-time.version>
Expand All @@ -33,7 +33,7 @@
<mockito.version>5.2.0</mockito.version>
<JUnitParams.version>1.1.1</JUnitParams.version>
<wiremock.version>3.13.0</wiremock.version>
<rest-assured.version>5.5.1</rest-assured.version>
<rest-assured.version>5.5.5</rest-assured.version>
<awaitility.version>4.3.0</awaitility.version>
<assertj.version>3.27.3</assertj.version>
<system-stubs-junit4.version>2.1.8</system-stubs-junit4.version>
Expand All @@ -48,7 +48,8 @@
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
<checkstyle.version>10.23.0</checkstyle.version>
<folio-java-checkstyle.version>1.1.0</folio-java-checkstyle.version>
<checkstyle.version>10.25.0</checkstyle.version>
<maven-failsafe-plugin.version>3.5.3</maven-failsafe-plugin.version>
<versions-maven-plugin.version>2.18.0</versions-maven-plugin.version>
<folio-module-descriptor-validator.version>1.0.1</folio-module-descriptor-validator.version>
Expand Down Expand Up @@ -597,6 +598,12 @@
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>folio-java-checkstyle</artifactId>
<version>${folio-java-checkstyle.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
Expand All @@ -613,10 +620,12 @@
<sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
</sourceDirectories>
<failsOnError>true</failsOnError>
<outputEncoding>UTF-8</outputEncoding>
<inputEncoding>UTF-8</inputEncoding>
<violationSeverity>warning</violationSeverity>
<failOnViolation>true</failOnViolation>
<logViolationsToConsole>true</logViolationsToConsole>
<configLocation>checkstyle/checkstyle.xml</configLocation>
<configLocation>folio-checkstyle/checkstyle.xml</configLocation>
<cacheFile>${basedir}/target/cachefile</cacheFile>
</configuration>
</plugin>
Expand Down
4 changes: 4 additions & 0 deletions ramls/instance.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"type": "string",
"description" : "A unique instance identifier matching a client-side bibliographic record identification scheme, in particular for a scenario where multiple separate catalogs with no shared record identifiers contribute to the same Instance in Inventory. A match key is typically generated from select, normalized pieces of metadata in bibliographic records"
},
"sourceUri": {
"type": "string",
"description": "A remote URI uniquely identifying the source of the instance"
},
"source": {
"type": "string",
"description": "The metadata source and its format of the underlying record to the instance record. (e.g. FOLIO if it's a record created in Inventory; MARC if it's a MARC record created in MARCcat or EPKB if it's a record coming from eHoldings; CONSORTIUM-MARC or CONSORTIUM-FOLIO for sharing Instances)."
Expand Down
9 changes: 9 additions & 0 deletions ramls/servicepoint.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
],
"default" : "Keep_the_current_due_date"
},
"defaultCheckInActionForUseAtLocation": {
"type": "string",
"description": "enum for defining the default action when checking in an item that is for use in the library (i.e. in reading room)",
"enum" : [
"Keep_on_hold_shelf",
"Close_loan_and_return_item",
"Ask_for_action"
]
},
"staffSlips": {
"type": "array",
"description": "List of staff slips for this service point",
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/folio/InventoryKafkaTopic.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,4 @@ private int getPropertyValue(String propertyName, String defaultNumPartitions) {
System.getProperty(propertyName),
System.getProperty(propertyName.toLowerCase().replace('_', '-')), defaultNumPartitions));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ public class CallNumberTypeRepository extends AbstractRepository<CallNumberType>
public CallNumberTypeRepository(Context context, Map<String, String> okapiHeaders) {
super(postgresClient(context, okapiHeaders), CALL_NUMBER_TYPE_TABLE, CallNumberType.class);
}

}
1 change: 0 additions & 1 deletion src/main/java/org/folio/persist/CampusRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ public class CampusRepository extends AbstractRepository<Loccamp> {
public CampusRepository(Context context, Map<String, String> okapiHeaders) {
super(postgresClient(context, okapiHeaders), CAMPUS_TABLE, Loccamp.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ public class ClassificationTypeRepository extends AbstractRepository<Classificat
public ClassificationTypeRepository(Context context, Map<String, String> okapiHeaders) {
super(postgresClient(context, okapiHeaders), CLASSIFICATION_TYPE_TABLE, ClassificationType.class);
}

}
30 changes: 13 additions & 17 deletions src/main/java/org/folio/persist/InstanceRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class InstanceRepository extends AbstractRepository<Instance> {
private static final String INSTANCE_SUBJECT_SOURCE_TABLE = "instance_subject_source";
private static final String INSTANCE_SUBJECT_TYPE_TABLE = "instance_subject_type";


public InstanceRepository(Context context, Map<String, String> okapiHeaders) {
super(postgresClient(context, okapiHeaders), INSTANCE_TABLE, Instance.class);
}
Expand All @@ -66,11 +65,6 @@ public Future<RowSet<Row>> unlinkInstanceFromSubjectType(Conn conn, String insta
}
}

private String unlinkInstanceFromSubjectSql(String table, String id) {
return String.format("DELETE FROM %s WHERE instance_id = '%s'; ",
postgresClientFuturized.getFullTableName(table), id);
}

public Future<RowSet<Row>> batchLinkSubjectSource(Conn conn, List<Pair<String, String>> sourcePairs) {
try {
String sql = """
Expand Down Expand Up @@ -112,19 +106,17 @@ public Future<RowSet<Row>> batchLinkSubjectType(Conn conn, List<Pair<String, Str
} catch (PgException e) {
return Future.failedFuture(new BadRequestException(e.getMessage()));
}

}

public Future<RowSet<Row>> batchUnlinkSubjectSource(Conn conn, String instanceId, List<String> sourceIds) {
try {
String sql = """
DELETE FROM %s WHERE instance_id = '%s' AND source_id IN ( %s );
"""
.formatted(
postgresClientFuturized.getFullTableName(INSTANCE_SUBJECT_SOURCE_TABLE),
instanceId,
sourceIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(", "))
);
DELETE FROM %s WHERE instance_id = '%s' AND source_id IN ( %s );
""".formatted(
postgresClientFuturized.getFullTableName(INSTANCE_SUBJECT_SOURCE_TABLE),
instanceId,
sourceIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(", "))
);
return conn.execute(sql);
} catch (PgException e) {
return Future.failedFuture(new BadRequestException(e.getMessage()));
Expand Down Expand Up @@ -164,8 +156,8 @@ public Future<RowSet<Row>> delete(String cql) {
try {
CQLWrapper cqlWrapper = new CQLWrapper(new CQL2PgJSON(tableName + ".jsonb"), cql, -1, -1);
String sql = "DELETE FROM " + postgresClientFuturized.getFullTableName(tableName)
+ " " + cqlWrapper.getWhereClause()
+ " RETURNING id::text, jsonb::text";
+ " " + cqlWrapper.getWhereClause()
+ " RETURNING id::text, jsonb::text";
return postgresClient.execute(sql);
} catch (Exception e) {
return Future.failedFuture(e);
Expand Down Expand Up @@ -275,6 +267,11 @@ public Future<Response> getInventoryViewInstancesWithBoundedItems(int offset, in
}
}

private String unlinkInstanceFromSubjectSql(String table, String id) {
return String.format("DELETE FROM %s WHERE instance_id = '%s'; ",
postgresClientFuturized.getFullTableName(table), id);
}

private StringBuilder buildInventoryViewQueryWithBoundedItems(String query, int limit, int offset) {
var sql = new StringBuilder("SELECT JSONB_BUILD_OBJECT(");
sql.append("'instanceId', inventory_view.jsonb->>'instanceId', ");
Expand Down Expand Up @@ -364,5 +361,4 @@ private JsonObject filterNullFields(JsonObject rowJsonValue) {
)
);
}

}
1 change: 0 additions & 1 deletion src/main/java/org/folio/persist/ItemRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,4 @@ public Future<List<Map<String, Object>>> getReindexItemRecords(String fromId, St
return resultList;
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ public Future<IterationJob> fetchAndUpdate(String id, UnaryOperator<IterationJob
.compose(response -> update(id, response)
.map(response));
}

}
2 changes: 0 additions & 2 deletions src/main/java/org/folio/persist/LibraryRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
import java.util.Map;
import org.folio.rest.jaxrs.model.Loclib;


public class LibraryRepository extends AbstractRepository<Loclib> {

public LibraryRepository(Context context, Map<String, String> okapiHeaders) {
super(postgresClient(context, okapiHeaders), LIBRARY_TABLE, Loclib.class);
}

}
1 change: 0 additions & 1 deletion src/main/java/org/folio/persist/LocationRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ public class LocationRepository extends AbstractRepository<Location> {
public LocationRepository(Context context, Map<String, String> okapiHeaders) {
super(postgresClient(context, okapiHeaders), LOCATION_TABLE, Location.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ protected Tuple createPostgresParams(String startDate, String endDate, boolean d
tuple.addBoolean(skipSuppressedFromDiscoveryRecords);
// Apply extra parameters
applyExtraParams.accept(tuple);

} catch (Exception e) {
throw new IllegalArgumentException(e);
}
Expand All @@ -117,7 +116,6 @@ protected Tuple createPostgresParams(UUID[] instancesIds, boolean skipSuppressed
try {
tuple.addArrayOfUUID(Optional.ofNullable(instancesIds).orElse(new UUID[0]));
tuple.addBoolean(skipSuppressedFromDiscoveryRecords);

} catch (Exception e) {
throw new IllegalArgumentException(e);
}
Expand Down Expand Up @@ -167,5 +165,4 @@ private HttpServerResponse getResponse(RoutingContext routingContext) {
response.putHeader("Content-Type", "application/json");
return response;
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package org.folio.rest.impl;

import static org.folio.rest.tools.messages.Messages.DEFAULT_LANGUAGE;
Expand Down Expand Up @@ -194,5 +188,4 @@ private void internalServerErrorDuringPut(Throwable e, Handler<AsyncResult<Resp
handler.handle(Future.succeededFuture(PutAlternativeTitleTypesByIdResponse
.respond500WithTextPlain(messages.getMessage(DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}

}
6 changes: 0 additions & 6 deletions src/main/java/org/folio/rest/impl/CallNumberTypeApi.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package org.folio.rest.impl;

import static io.vertx.core.Future.succeededFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,4 @@ public void putClassificationTypesByClassificationTypeId(String recordId, Classi
.onSuccess(response -> asyncResultHandler.handle(succeededFuture(response)))
.onFailure(handleFailure(asyncResultHandler));
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package org.folio.rest.impl;

import static org.folio.rest.tools.messages.Messages.DEFAULT_LANGUAGE;
Expand Down Expand Up @@ -263,5 +257,4 @@ public void putElectronicAccessRelationshipsByElectronicAccessRelationshipId(
private CQLWrapper getCql(String query, int limit, int offset) throws FieldException {
return StorageHelper.getCql(query, limit, offset, RESOURCE_TABLE);
}

}
7 changes: 0 additions & 7 deletions src/main/java/org/folio/rest/impl/HoldingsNoteTypeApi.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package org.folio.rest.impl;

import static org.folio.rest.tools.messages.Messages.DEFAULT_LANGUAGE;
Expand Down Expand Up @@ -238,5 +232,4 @@ private void internalServerErrorDuringPut(Throwable e, Handler<AsyncResult<Respo
handler.handle(Future.succeededFuture(PutHoldingsNoteTypesByIdResponse
.respond500WithTextPlain(messages.getMessage(Messages.DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}

}
7 changes: 0 additions & 7 deletions src/main/java/org/folio/rest/impl/IllPolicyApi.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package org.folio.rest.impl;

import static org.folio.okapi.common.Messages.DEFAULT_LANGUAGE;
Expand Down Expand Up @@ -237,5 +231,4 @@ private void internalServerErrorDuringPut(Throwable e, Handler<AsyncResult<Respo
handler.handle(Future.succeededFuture(PutIllPoliciesByIdResponse
.respond500WithTextPlain(messages.getMessage(DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}

}
1 change: 0 additions & 1 deletion src/main/java/org/folio/rest/impl/InitApiImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,4 @@ private void initConsortiumDataCache(Vertx vertx, Context context) {
private ConsortiumDataCache getConsortiumDataCache(Context context) {
return context.get(ConsortiumDataCache.class.getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,4 @@ public void deleteInstanceStorageInstancesIterationById(String id, Map<String, S
private IterationService getService(Map<String, String> okapiHeaders, Context vertxContext) {
return new IterationService(vertxContext, okapiHeaders);
}

}
1 change: 0 additions & 1 deletion src/main/java/org/folio/rest/impl/InstanceNoteTypeApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public void putInstanceNoteTypesById(String id, InstanceNoteType entity,
asyncResultHandler.handle(Future.succeededFuture(PutInstanceNoteTypesByIdResponse.respond500WithTextPlain(
messages.getMessage(DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}

});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,4 @@ private void internalServerErrorDuringPut(Throwable e, Handler<AsyncResult<Respo
handler.handle(Future.succeededFuture(PutInstanceRelationshipTypesByRelationshipTypeIdResponse
.respond500WithTextPlain(messages.getMessage(DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}

}
1 change: 0 additions & 1 deletion src/main/java/org/folio/rest/impl/InstanceStatusApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,4 @@ public void putInstanceStatusesByInstanceStatusId(String instanceStatusId, Insta
private CQLWrapper getCql(String query, int limit, int offset) throws FieldException {
return StorageHelper.getCql(query, limit, offset, RESOURCE_TABLE);
}

}
2 changes: 0 additions & 2 deletions src/main/java/org/folio/rest/impl/InstanceStorageApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public void putInstanceStorageInstanceRelationshipsByRelationshipId(String relat
Future.succeededFuture(PutInstanceStorageInstanceRelationshipsByRelationshipIdResponse
.respond500WithTextPlain(messages.getMessage(DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}

});
} catch (Exception e) {
asyncResultHandler.handle(Future.succeededFuture(PutInstanceStorageInstanceRelationshipsByRelationshipIdResponse
Expand Down Expand Up @@ -390,5 +389,4 @@ private static CQLWrapper createCqlWrapper(String query, int limit, int offset,
throws FieldException {
return StorageHelper.getCql(query, limit, offset, tableName);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ public void postInstanceStorageInstancesBulk(BulkUpsertRequest bulkRequest, Map<
.otherwise(EndpointFailureHandler::failureResponse)
.onComplete(asyncResultHandler);
}

}
Loading