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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
- Create `GET /vocabularies/{name}` API to return a vocabulary used by UI. [MODLD-982](https://folio-org.atlassian.net/browse/MODLD-982)
- Include subTitle (OtherTitleInformation) in work profile [MODLD-1009](https://folio-org.atlassian.net/browse/MODLD-1009)
- Improve export resource query performance [MODLD-1010](https://folio-org.atlassian.net/browse/MODLD-1010)
- Retrieve FOLIO base-url from `GET /base-url` API [MODLD-804](https://folio-org.atlassian.net/browse/MODLD-804)

## 1.0.4 (04-24-2025)
- Work Edit form - Instance read-only section: "Notes about the instance" data is not shown [MODLD-716](https://folio-org.atlassian.net/browse/MODLD-716)
Expand Down
10 changes: 8 additions & 2 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"methods": [ "GET" ],
"pathPattern": "/linked-data/resource/{id}/rdf",
"permissionsRequired": [ "linked-data.resources.rdf.get" ],
"modulePermissions": []
"modulePermissions": [
"base-url.item.get"
]
},
{
"methods": [ "PUT" ],
Expand Down Expand Up @@ -242,11 +244,15 @@
},
{
"id": "settings",
"version": "1.1"
"version": "1.2"
},
{
"id": "authority-source-files",
"version": "2.2"
},
{
"id": "base-url",
"version": "1.0"
}
],
"permissionSets": [
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
<generateModelDocumentation>false</generateModelDocumentation>
<templateDirectory>${project.basedir}/src/main/resources/swagger.api/templates</templateDirectory>
<configOptions>
<java8>true</java8>
<dateLibrary>java8</dateLibrary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.folio.linked.data.configuration;

import org.folio.linked.data.integration.rest.authoritysource.AuthoritySourceFilesClient;
import org.folio.linked.data.integration.rest.configuration.ConfigurationClient;
import org.folio.linked.data.integration.rest.search.SearchClient;
import org.folio.linked.data.integration.rest.settings.SettingsClient;
import org.folio.linked.data.integration.rest.specification.SpecClient;
Expand All @@ -18,11 +17,6 @@ public AuthoritySourceFilesClient authoritySourceFilesClient(HttpServiceProxyFac
return factory.createClient(AuthoritySourceFilesClient.class);
}

@Bean
public ConfigurationClient configurationClient(HttpServiceProxyFactory factory) {
return factory.createClient(ConfigurationClient.class);
}

@Bean
public SearchClient searchClient(HttpServiceProxyFactory factory) {
return factory.createClient(SearchClient.class);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.folio.linked.data.util.Constants.Cache.SETTINGS_ENTRIES;
import static org.folio.linked.data.util.Constants.STANDALONE_PROFILE;

import org.folio.linked.data.domain.dto.BaseUrlDto;
import org.folio.linked.data.domain.dto.SettingsSearchResponse;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Profile;
Expand All @@ -11,12 +12,17 @@
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;

@HttpExchange("settings")
@HttpExchange
@Profile("!" + STANDALONE_PROFILE)
public interface SettingsClient {

@SuppressWarnings("java:S7180")
@Cacheable(cacheNames = SETTINGS_ENTRIES, key = "@folioExecutionContext.tenantId + '_' + #query")
@GetExchange("/entries")
@GetExchange("settings/entries")
ResponseEntity<SettingsSearchResponse> getEntries(@RequestParam("query") String query);

@SuppressWarnings("java:S7180")
@Cacheable(cacheNames = SETTINGS_ENTRIES, key = "@folioExecutionContext.tenantId + '_base-url'")
@GetExchange("base-url")
BaseUrlDto getBaseUrl();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
@SuppressWarnings("java:S6813")
public abstract class InstanceIngressMessageMapper {

private static final String LINKED_DATA_ID = "linkedDataId";
private static final String INSTANCE_ID = "instanceId";
@Autowired
protected Ld2MarcMapper ld2MarcMapper;
@Autowired
Expand All @@ -45,9 +43,9 @@ protected String toMarcJson(Resource resource) {

@AfterMapping
protected void afterMappingPayload(@MappingTarget InstanceIngressPayload payload, Resource resource) {
payload.putAdditionalProperty(LINKED_DATA_ID, resource.getId());
payload.setLinkedDataId(resource.getId());
ofNullable(resource.getFolioMetadata())
.map(FolioMetadata::getInventoryId)
.ifPresent(invId -> payload.putAdditionalProperty(INSTANCE_ID, invId));
.ifPresent(payload::setInstanceId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.util.function.LongFunction;
import lombok.RequiredArgsConstructor;
import org.folio.linked.data.integration.rest.configuration.ConfigurationService;
import org.folio.linked.data.integration.rest.settings.SettingsClient;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

Expand All @@ -14,12 +14,20 @@
public class ResourceUrlProvider implements LongFunction<String> {

private static final String URL_PATTERN = "%s/linked-data-editor/resources/%s";
private final ConfigurationService configurationService;

private final SettingsClient settingsClient;

@Override
public String apply(long id) {
var folioHost = configurationService.getFolioHost();
return String.format(URL_PATTERN, folioHost, id);
var baseUrlResponse = settingsClient.getBaseUrl();
var baseUrl = normalizeBaseUrl(baseUrlResponse.getValue());
return String.format(URL_PATTERN, baseUrl, id);
}

private String normalizeBaseUrl(String baseUrl) {
var normalized = baseUrl;
while (normalized.endsWith("/")) {
normalized = normalized.substring(0, normalized.length() - 1);
}
return normalized;
}
}
4 changes: 2 additions & 2 deletions src/main/resources/swagger.api/folio-modules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ components:
$ref: folio-modules/srs/sourceRecordDomainEvent.json
inventoryInstanceEvent:
$ref: folio-modules/inventory/inventoryInstanceEvent.json
configurationsDto:
$ref: folio-modules/configuration/configurations.json
baseUrlDto:
$ref: folio-modules/settings/baseUrl.json
importOutputEvent:
$ref: folio-modules/ld-import/importOutputEvent.json
importResultEvent:
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@
"type": "string",
"enum": ["FOLIO", "LINKED_DATA", "MARC"],
"description": "Source type"
},
"linkedDataId": {
"type": "integer",
"format": "int64",
"description": "Linked data resource identifier"
},
"instanceId": {
"type": "string",
"description": "Inventory instance identifier"
}
},
"additionalProperties": true,
"required": [
"sourceRecordObject",
"sourceType"
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/swagger.api/folio-modules/settings/baseUrl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Base URL response",
"properties": {
"value": {
"type": "string",
"description": "FOLIO front-end URL",
"x-json-property": "baseUrl"
}
},
"required": [
"value"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Parsed Record Schema",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"description": "UUID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Record DTO Schema",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"description": "UUID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"type": "string"
}
},
"additionalProperties": false,
"required": [
"createdDate"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Record Type Enum",
"type": "string",
"additionalProperties": false,
"enum": [
"MARC_BIB",
"MARC_AUTHORITY",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "Source record domain event data model",
"javaType": "org.folio.rest.jaxrs.model.SourceRecordDomainEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"description": "UUID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private boolean isExpectedEvent(String eventStr, long linkedDataId) {
var eventPayload = event.getEventPayload();
var marc = eventPayload.getSourceRecordObject();
return event.getEventType() == InstanceIngressEvent.EventTypeEnum.UPDATE_INSTANCE
&& eventPayload.getAdditionalProperties().get("linkedDataId").equals(linkedDataId)
&& eventPayload.getLinkedDataId().equals(linkedDataId)
&& isExpectedMarc(marc);
}

Expand Down
Loading
Loading