Search in sources :

Example 1 with ACCEPT

use of javax.ws.rs.core.HttpHeaders.ACCEPT in project mod-oai-pmh by folio-org.

the class MarcWithHoldingsRequestHelper method enrichInstances.

private Future<List<JsonObject>> enrichInstances(List<JsonObject> result, Request request) {
    Map<String, JsonObject> instances = result.stream().collect(LinkedHashMap::new, (map, instance) -> map.put(instance.getString(INSTANCE_ID_FIELD_NAME), instance), Map::putAll);
    Promise<List<JsonObject>> promise = Promise.promise();
    var webClient = WebClientProvider.getWebClient();
    var httpRequest = webClient.postAbs(request.getOkapiUrl() + INVENTORY_ITEMS_AND_HOLDINGS_ENDPOINT);
    if (request.getOkapiUrl().contains("https:")) {
        httpRequest.ssl(true);
    }
    httpRequest.putHeader(OKAPI_TOKEN, request.getOkapiToken());
    httpRequest.putHeader(OKAPI_TENANT, TenantTool.tenantId(request.getOkapiHeaders()));
    httpRequest.putHeader(ACCEPT, APPLICATION_JSON);
    httpRequest.putHeader(CONTENT_TYPE, APPLICATION_JSON);
    JsonObject entries = new JsonObject();
    entries.put(INSTANCE_IDS_ENRICH_PARAM_NAME, new JsonArray(new ArrayList<>(instances.keySet())));
    entries.put(SKIP_SUPPRESSED_FROM_DISCOVERY_RECORDS, isSkipSuppressed(request));
    Promise<Boolean> responseChecked = Promise.promise();
    var jsonParser = new OaiPmhJsonParser().objectValueMode();
    jsonParser.handler(event -> {
        JsonObject itemsAndHoldingsFields = event.objectValue();
        String instanceId = itemsAndHoldingsFields.getString(INSTANCE_ID_FIELD_NAME);
        JsonObject instance = instances.get(instanceId);
        if (instance != null) {
            enrichDiscoverySuppressed(itemsAndHoldingsFields, instance);
            instance.put(RecordMetadataManager.ITEMS_AND_HOLDINGS_FIELDS, itemsAndHoldingsFields);
            // case when no items
            if (itemsAndHoldingsFields.getJsonArray(ITEMS).isEmpty()) {
                enrichOnlyEffectiveLocationEffectiveCallNumberFromHoldings(instance);
            } else {
                adjustItems(instance);
            }
        } else {
            logger.info("Instance with instanceId {} wasn't in the request.", instanceId);
        }
    });
    jsonParser.exceptionHandler(throwable -> responseChecked.future().onSuccess(invalidResponseReceivedAndProcessed -> {
        if (invalidResponseReceivedAndProcessed) {
            return;
        }
        logger.error("Error has been occurred at JsonParser while reading data from items-and-holdings response. Message:{}", throwable.getMessage(), throwable);
        promise.fail(throwable);
    }));
    httpRequest.as(BodyCodec.jsonStream(jsonParser)).sendBuffer(entries.toBuffer()).onSuccess(response -> {
        switch(response.statusCode()) {
            case 200:
                responseChecked.complete(false);
                break;
            case 403:
                {
                    String errorMsg = getErrorFromStorageMessage(INVENTORY_STORAGE, request.getOkapiUrl() + INVENTORY_ITEMS_AND_HOLDINGS_ENDPOINT, ENRICH_INSTANCES_MISSED_PERMISSION);
                    logger.error(errorMsg);
                    promise.fail(new IllegalStateException(errorMsg));
                    responseChecked.complete(true);
                    break;
                }
            default:
                {
                    String errorFromStorageMessage = getErrorFromStorageMessage(INVENTORY_STORAGE, request.getOkapiUrl() + INVENTORY_ITEMS_AND_HOLDINGS_ENDPOINT, response.statusMessage());
                    String errorMessage = errorFromStorageMessage + response.statusCode();
                    logger.error(errorMessage);
                    promise.fail(new IllegalStateException(errorFromStorageMessage));
                    responseChecked.complete(true);
                }
        }
        promise.complete(new ArrayList<>(instances.values()));
    }).onFailure(e -> {
        logger.error(e.getMessage());
        promise.fail(e);
    });
    return promise.future();
}
Also used : CONTENT_TYPE(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE) OFFSET_PARAM(org.folio.oaipmh.Constants.OFFSET_PARAM) DecodeException(io.vertx.core.json.DecodeException) Date(java.util.Date) NEXT_INSTANCE_PK_VALUE(org.folio.oaipmh.Constants.NEXT_INSTANCE_PK_VALUE) StatusType(org.openarchives.oai._2.StatusType) Autowired(org.springframework.beans.factory.annotation.Autowired) NEXT_RECORD_ID_PARAM(org.folio.oaipmh.Constants.NEXT_RECORD_ID_PARAM) SEND_REQUEST(org.folio.oaipmh.service.MetricsCollectingService.MetricOperation.SEND_REQUEST) RESUMPTION_TOKEN_TIMEOUT(org.folio.oaipmh.Constants.RESUMPTION_TOKEN_TIMEOUT) Context(io.vertx.core.Context) WorkerExecutor(io.vertx.core.WorkerExecutor) Tuple(io.vertx.sqlclient.Tuple) OAIPMHerrorType(org.openarchives.oai._2.OAIPMHerrorType) ResumptionTokenType(org.openarchives.oai._2.ResumptionTokenType) Request(org.folio.oaipmh.Request) NAME(org.folio.oaipmh.helpers.records.RecordMetadataManager.NAME) OAIPMH(org.openarchives.oai._2.OAIPMH) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) JsonObject(io.vertx.core.json.JsonObject) BigInteger(java.math.BigInteger) APPLICATION_JSON(javax.ws.rs.core.MediaType.APPLICATION_JSON) AbstractHelper(org.folio.oaipmh.helpers.AbstractHelper) UNTIL_PARAM(org.folio.oaipmh.Constants.UNTIL_PARAM) EXPIRATION_DATE_RESUMPTION_TOKEN_PARAM(org.folio.oaipmh.Constants.EXPIRATION_DATE_RESUMPTION_TOKEN_PARAM) OKAPI_TENANT(org.folio.oaipmh.Constants.OKAPI_TENANT) InstancesService(org.folio.oaipmh.service.InstancesService) ITEMS(org.folio.oaipmh.helpers.records.RecordMetadataManager.ITEMS) MetricsCollectingService(org.folio.oaipmh.service.MetricsCollectingService) UUID(java.util.UUID) ITEMS_AND_HOLDINGS_FIELDS(org.folio.oaipmh.helpers.records.RecordMetadataManager.ITEMS_AND_HOLDINGS_FIELDS) Instant(java.time.Instant) Future(io.vertx.core.Future) TenantTool(org.folio.rest.tools.utils.TenantTool) Collectors(java.util.stream.Collectors) PostgresClient(org.folio.rest.persist.PostgresClient) ZoneId(java.time.ZoneId) String.format(java.lang.String.format) RepositoryConfigurationUtil(org.folio.oaipmh.helpers.RepositoryConfigurationUtil) REQUEST_ID_PARAM(org.folio.oaipmh.Constants.REQUEST_ID_PARAM) CALL_NUMBER(org.folio.oaipmh.helpers.records.RecordMetadataManager.CALL_NUMBER) Objects(java.util.Objects) List(java.util.List) Logger(org.apache.logging.log4j.Logger) OffsetDateTime(java.time.OffsetDateTime) Buffer(io.vertx.core.buffer.Buffer) Response(javax.ws.rs.core.Response) WebClientProvider(org.folio.oaipmh.WebClientProvider) RETRY_ATTEMPTS(org.folio.oaipmh.Constants.RETRY_ATTEMPTS) STATUS_MESSAGE(org.folio.oaipmh.Constants.STATUS_MESSAGE) ChronoField(java.time.temporal.ChronoField) HttpResponse(io.vertx.ext.web.client.HttpResponse) SourceStorageSourceRecordsClientWrapper(org.folio.oaipmh.service.SourceStorageSourceRecordsClientWrapper) RequestMetadataLb(org.folio.rest.jooq.tables.pojos.RequestMetadataLb) BodyCodec(io.vertx.ext.web.codec.BodyCodec) INSTANCES_PROCESSING(org.folio.oaipmh.service.MetricsCollectingService.MetricOperation.INSTANCES_PROCESSING) HashMap(java.util.HashMap) OKAPI_TOKEN(org.folio.oaipmh.Constants.OKAPI_TOKEN) REPOSITORY_MAX_RECORDS_PER_RESPONSE(org.folio.oaipmh.Constants.REPOSITORY_MAX_RECORDS_PER_RESPONSE) JsonEvent(io.vertx.core.parsetools.JsonEvent) CollectionUtils(org.apache.commons.collections4.CollectionUtils) SpringContextUtil(org.folio.spring.SpringContextUtil) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) RepositoryConfigurationUtil.getBooleanProperty(org.folio.oaipmh.helpers.RepositoryConfigurationUtil.getBooleanProperty) HttpRequestImpl(io.vertx.ext.web.client.impl.HttpRequestImpl) AsyncResult(io.vertx.core.AsyncResult) STATUS_CODE(org.folio.oaipmh.Constants.STATUS_CODE) Promise(io.vertx.core.Promise) Vertx(io.vertx.core.Vertx) Instances(org.folio.rest.jooq.tables.pojos.Instances) RecordMetadataManager(org.folio.oaipmh.helpers.records.RecordMetadataManager) Maps(com.google.common.collect.Maps) HttpRequest(io.vertx.ext.web.client.HttpRequest) JsonArray(io.vertx.core.json.JsonArray) ResponseHelper(org.folio.oaipmh.helpers.response.ResponseHelper) PgConnection(io.vertx.pgclient.PgConnection) Collectors.toList(java.util.stream.Collectors.toList) RecordType(org.openarchives.oai._2.RecordType) REPOSITORY_SRS_HTTP_REQUEST_RETRY_ATTEMPTS(org.folio.oaipmh.Constants.REPOSITORY_SRS_HTTP_REQUEST_RETRY_ATTEMPTS) ACCEPT(javax.ws.rs.core.HttpHeaders.ACCEPT) LOCATION(org.folio.oaipmh.Constants.LOCATION) REPOSITORY_SUPPRESSED_RECORDS_PROCESSING(org.folio.oaipmh.Constants.REPOSITORY_SUPPRESSED_RECORDS_PROCESSING) ListRecordsType(org.openarchives.oai._2.ListRecordsType) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) Collections(java.util.Collections) ArrayList(java.util.ArrayList) JsonObject(io.vertx.core.json.JsonObject) LinkedHashMap(java.util.LinkedHashMap) JsonArray(io.vertx.core.json.JsonArray) List(java.util.List) ArrayList(java.util.ArrayList) Collectors.toList(java.util.stream.Collectors.toList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with ACCEPT

use of javax.ws.rs.core.HttpHeaders.ACCEPT in project fcrepo by fcrepo.

the class FedoraVersioningIT method verifyTimemapResponse.

/**
 * Verify an application/link-format TimeMap response.
 *
 * @param uri The full URI of the Original Resource.
 * @param id The path of the Original Resource.
 * @param mementoDateTime Array of all the RFC-1123 datetimes for all the mementos.
 * @param rangeStart RFC-1123 datetime of the first memento.
 * @param rangeEnd RFC-1123 datetime of the last memento.
 * @throws Exception on HTTP request error
 */
private void verifyTimemapResponse(final String uri, final String id, final String[] mementoDateTime, final String rangeStart, final String rangeEnd) throws Exception {
    final String ldpcvUri = uri + "/" + FCR_VERSIONS;
    final var expectedLinksOther = new ArrayList<Link>();
    final var expectedLinksMemento = new ArrayList<Link>();
    expectedLinksOther.add(Link.fromUri(uri).rel("original").build());
    expectedLinksOther.add(Link.fromUri(uri).rel("timegate").build());
    expectedLinksOther.sort(Comparator.comparing(Link::toString));
    final var expectedSelfLinkBuilder = Link.fromUri(ldpcvUri).rel("self").type(APPLICATION_LINK_FORMAT);
    if (rangeStart != null && rangeEnd != null) {
        expectedSelfLinkBuilder.param("from", rangeStart).param("until", rangeEnd);
    }
    final var expectedSelfLink = expectedSelfLinkBuilder.build();
    if (mementoDateTime != null) {
        for (final String memento : mementoDateTime) {
            final TemporalAccessor instant = MEMENTO_RFC_1123_FORMATTER.parse(memento);
            expectedLinksMemento.add(Link.fromUri(ldpcvUri + "/" + MEMENTO_LABEL_FORMATTER.format(instant)).rel("memento").param("datetime", memento).build());
        }
    }
    expectedLinksMemento.sort(Comparator.comparing(Link::toString));
    final HttpGet httpGet = getObjMethod(id + "/" + FCR_VERSIONS);
    httpGet.setHeader("Accept", APPLICATION_LINK_FORMAT);
    try (final CloseableHttpResponse response = execute(httpGet)) {
        assertEquals("Didn't get a OK response!", OK.getStatusCode(), getStatus(response));
        // verify headers in link format.
        verifyTimeMapHeaders(response, uri);
        final var responseBody = EntityUtils.toString(response.getEntity());
        final List<String> bodyList = asList(responseBody.split("," + System.lineSeparator()));
        // the links from the body are not
        Link selfLink = null;
        final var mementoLinks = new ArrayList<Link>();
        final var otherLinks = new ArrayList<Link>();
        final var allLinks = bodyList.stream().map(String::trim).filter(t -> !t.isEmpty()).sorted(Comparator.naturalOrder()).map(Link::valueOf).collect(Collectors.toList());
        for (final var link : allLinks) {
            if ("memento".equals(link.getRel())) {
                mementoLinks.add(link);
            } else if ("self".equals(link.getRel())) {
                selfLink = link;
            } else {
                otherLinks.add(link);
            }
        }
        assertSelfLink(expectedSelfLink, selfLink);
        assertEquals(expectedLinksOther, otherLinks);
        assertEquals(expectedLinksMemento.size(), mementoLinks.size());
        for (var i = 0; i < expectedLinksMemento.size(); i++) {
            assertMementoLink(expectedLinksMemento.get(i), mementoLinks.get(i));
        }
    }
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) HttpPatch(org.apache.http.client.methods.HttpPatch) VERSIONING_TIMEMAP_TYPE(org.fcrepo.kernel.api.RdfLexicon.VERSIONING_TIMEMAP_TYPE) Model(org.apache.jena.rdf.model.Model) CommitType(org.fcrepo.storage.ocfl.CommitType) NodeFactory.createLiteral(org.apache.jena.graph.NodeFactory.createLiteral) Arrays.asList(java.util.Arrays.asList) RDF_SOURCE(org.fcrepo.kernel.api.RdfLexicon.RDF_SOURCE) Duration(java.time.Duration) ZoneOffset(java.time.ZoneOffset) Dataset(org.apache.jena.query.Dataset) BAD_REQUEST(javax.ws.rs.core.Response.Status.BAD_REQUEST) POSSIBLE_RDF_RESPONSE_VARIANTS_STRING(org.fcrepo.http.commons.domain.RDFMediaType.POSSIBLE_RDF_RESPONSE_VARIANTS_STRING) OK(javax.ws.rs.core.Response.Status.OK) HttpOptions(org.apache.http.client.methods.HttpOptions) IOUtils(org.apache.commons.io.IOUtils) Assert.assertFalse(org.junit.Assert.assertFalse) Link(javax.ws.rs.core.Link) SC_BAD_REQUEST(org.apache.http.HttpStatus.SC_BAD_REQUEST) NodeFactory.createURI(org.apache.jena.graph.NodeFactory.createURI) HttpHead(org.apache.http.client.methods.HttpHead) CONTAINS(org.fcrepo.kernel.api.RdfLexicon.CONTAINS) MEMENTO_RFC_1123_FORMATTER(org.fcrepo.kernel.api.services.VersionService.MEMENTO_RFC_1123_FORMATTER) METHOD_NOT_ALLOWED(javax.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED) HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) LOCATION(javax.ws.rs.core.HttpHeaders.LOCATION) TemporalAccessor(java.time.temporal.TemporalAccessor) ArrayList(java.util.ArrayList) GONE(javax.ws.rs.core.Response.Status.GONE) Quad(org.apache.jena.sparql.core.Quad) Resource(org.apache.jena.rdf.model.Resource) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) DC(org.apache.jena.vocabulary.DC) ACCEPT_DATETIME(org.fcrepo.http.api.FedoraLdp.ACCEPT_DATETIME) ResourceFactory.createResource(org.apache.jena.rdf.model.ResourceFactory.createResource) Before(org.junit.Before) StringWriter(java.io.StringWriter) FCR_ACL(org.fcrepo.kernel.api.FedoraTypes.FCR_ACL) NO_CONTENT(javax.ws.rs.core.Response.Status.NO_CONTENT) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) FOUND(javax.ws.rs.core.Response.Status.FOUND) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) ResourceFactory.createProperty(org.apache.jena.rdf.model.ResourceFactory.createProperty) Assert.assertNull(org.junit.Assert.assertNull) ChronoUnit(java.time.temporal.ChronoUnit) RDFDataMgr(org.apache.jena.riot.RDFDataMgr) ACCEPT(javax.ws.rs.core.HttpHeaders.ACCEPT) FCR_VERSIONS(org.fcrepo.kernel.api.FedoraTypes.FCR_VERSIONS) HttpResponse(org.apache.http.HttpResponse) RDFFormat(org.apache.jena.riot.RDFFormat) RDFLanguages(org.apache.jena.riot.RDFLanguages) Property(org.apache.jena.rdf.model.Property) Assert.assertEquals(org.junit.Assert.assertEquals) N3(org.fcrepo.http.commons.domain.RDFMediaType.N3) CONTENT_TYPE(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE) RDF(org.apache.jena.vocabulary.RDF) NON_RDF_SOURCE(org.fcrepo.kernel.api.RdfLexicon.NON_RDF_SOURCE) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) APPLICATION_LINK_FORMAT(org.fcrepo.http.commons.domain.RDFMediaType.APPLICATION_LINK_FORMAT) Arrays.sort(java.util.Arrays.sort) MEMENTO_DATETIME_HEADER(org.fcrepo.http.api.FedoraVersioning.MEMENTO_DATETIME_HEADER) EntityUtils(org.apache.http.util.EntityUtils) TestExecutionListeners(org.springframework.test.context.TestExecutionListeners) After(org.junit.After) CONTENT_LENGTH(javax.ws.rs.core.HttpHeaders.CONTENT_LENGTH) CloseableDataset(org.fcrepo.http.commons.test.util.CloseableDataset) MEMENTO_TYPE(org.fcrepo.kernel.api.RdfLexicon.MEMENTO_TYPE) NOT_FOUND(javax.ws.rs.core.Response.Status.NOT_FOUND) StringEntity(org.apache.http.entity.StringEntity) ISO_INSTANT(java.time.format.DateTimeFormatter.ISO_INSTANT) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) List(java.util.List) VERSIONED_RESOURCE(org.fcrepo.kernel.api.RdfLexicon.VERSIONED_RESOURCE) OffsetDateTime(java.time.OffsetDateTime) HttpGet(org.apache.http.client.methods.HttpGet) ANY(org.apache.jena.graph.Node.ANY) CREATED(javax.ws.rs.core.Response.Status.CREATED) LINK(javax.ws.rs.core.HttpHeaders.LINK) BASIC_CONTAINER(org.fcrepo.kernel.api.RdfLexicon.BASIC_CONTAINER) EMBED_CONTAINED(org.fcrepo.kernel.api.RdfLexicon.EMBED_CONTAINED) MEMENTO_LABEL_FORMATTER(org.fcrepo.kernel.api.services.VersionService.MEMENTO_LABEL_FORMATTER) FEDORA_BINARY(org.fcrepo.kernel.api.RdfLexicon.FEDORA_BINARY) HttpDelete(org.apache.http.client.methods.HttpDelete) NOT_ACCEPTABLE(javax.ws.rs.core.Response.Status.NOT_ACCEPTABLE) ImmutableList(com.google.common.collect.ImmutableList) RESOURCE(org.fcrepo.kernel.api.RdfLexicon.RESOURCE) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) DC_11.title(org.apache.jena.vocabulary.DC_11.title) ARCHIVAL_GROUP(org.fcrepo.kernel.api.RdfLexicon.ARCHIVAL_GROUP) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) Lang(org.apache.jena.riot.Lang) Iterator(java.util.Iterator) UTF_8(java.nio.charset.StandardCharsets.UTF_8) CONTAINER(org.fcrepo.kernel.api.RdfLexicon.CONTAINER) Assert.assertNotNull(org.junit.Assert.assertNotNull) TimeUnit(java.util.concurrent.TimeUnit) ModelFactory.createDefaultModel(org.apache.jena.rdf.model.ModelFactory.createDefaultModel) HttpPut(org.apache.http.client.methods.HttpPut) Rule(org.junit.Rule) DefaultOcflObjectSessionFactory(org.fcrepo.storage.ocfl.DefaultOcflObjectSessionFactory) Node(org.apache.jena.graph.Node) TURTLE(org.fcrepo.http.commons.domain.RDFMediaType.TURTLE) RDF.type(org.apache.jena.vocabulary.RDF.type) Comparator(java.util.Comparator) TemporaryFolder(org.junit.rules.TemporaryFolder) TemporalAccessor(java.time.temporal.TemporalAccessor) HttpGet(org.apache.http.client.methods.HttpGet) ArrayList(java.util.ArrayList) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) Link(javax.ws.rs.core.Link)

Example 3 with ACCEPT

use of javax.ws.rs.core.HttpHeaders.ACCEPT in project mod-oai-pmh by folio-org.

the class MarcWithHoldingsRequestHelper method buildInventoryQuery.

private HttpRequest<Buffer> buildInventoryQuery(Request request) {
    Map<String, String> paramMap = new HashMap<>();
    Date date = convertStringToDate(request.getFrom(), false, false);
    if (date != null) {
        paramMap.put(START_DATE_PARAM_NAME, dateFormat.format(date));
    }
    date = convertStringToDate(request.getUntil(), true, false);
    if (date != null) {
        paramMap.put(END_DATE_PARAM_NAME, dateFormat.format(date));
    }
    paramMap.put(DELETED_RECORD_SUPPORT_PARAM_NAME, String.valueOf(RepositoryConfigurationUtil.isDeletedRecordsEnabled(request.getRequestId())));
    paramMap.put(SKIP_SUPPRESSED_FROM_DISCOVERY_RECORDS, String.valueOf(isSkipSuppressed(request)));
    final String params = paramMap.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining("&"));
    String inventoryQuery = format("%s%s?%s", request.getOkapiUrl(), INVENTORY_UPDATED_INSTANCES_ENDPOINT, params);
    logger.debug("Sending request to {}", inventoryQuery);
    final HttpRequest<Buffer> httpRequest = WebClientProvider.getWebClientToDownloadInstances().getAbs(inventoryQuery);
    httpRequest.putHeader(OKAPI_TOKEN, request.getOkapiToken());
    httpRequest.putHeader(OKAPI_TENANT, TenantTool.tenantId(request.getOkapiHeaders()));
    httpRequest.putHeader(ACCEPT, APPLICATION_JSON);
    if (request.getOkapiUrl().contains("https")) {
        httpRequest.ssl(true);
    }
    return httpRequest;
}
Also used : CONTENT_TYPE(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE) OFFSET_PARAM(org.folio.oaipmh.Constants.OFFSET_PARAM) DecodeException(io.vertx.core.json.DecodeException) Date(java.util.Date) NEXT_INSTANCE_PK_VALUE(org.folio.oaipmh.Constants.NEXT_INSTANCE_PK_VALUE) StatusType(org.openarchives.oai._2.StatusType) Autowired(org.springframework.beans.factory.annotation.Autowired) NEXT_RECORD_ID_PARAM(org.folio.oaipmh.Constants.NEXT_RECORD_ID_PARAM) SEND_REQUEST(org.folio.oaipmh.service.MetricsCollectingService.MetricOperation.SEND_REQUEST) RESUMPTION_TOKEN_TIMEOUT(org.folio.oaipmh.Constants.RESUMPTION_TOKEN_TIMEOUT) Context(io.vertx.core.Context) WorkerExecutor(io.vertx.core.WorkerExecutor) Tuple(io.vertx.sqlclient.Tuple) OAIPMHerrorType(org.openarchives.oai._2.OAIPMHerrorType) ResumptionTokenType(org.openarchives.oai._2.ResumptionTokenType) Request(org.folio.oaipmh.Request) NAME(org.folio.oaipmh.helpers.records.RecordMetadataManager.NAME) OAIPMH(org.openarchives.oai._2.OAIPMH) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) JsonObject(io.vertx.core.json.JsonObject) BigInteger(java.math.BigInteger) APPLICATION_JSON(javax.ws.rs.core.MediaType.APPLICATION_JSON) AbstractHelper(org.folio.oaipmh.helpers.AbstractHelper) UNTIL_PARAM(org.folio.oaipmh.Constants.UNTIL_PARAM) EXPIRATION_DATE_RESUMPTION_TOKEN_PARAM(org.folio.oaipmh.Constants.EXPIRATION_DATE_RESUMPTION_TOKEN_PARAM) OKAPI_TENANT(org.folio.oaipmh.Constants.OKAPI_TENANT) InstancesService(org.folio.oaipmh.service.InstancesService) ITEMS(org.folio.oaipmh.helpers.records.RecordMetadataManager.ITEMS) MetricsCollectingService(org.folio.oaipmh.service.MetricsCollectingService) UUID(java.util.UUID) ITEMS_AND_HOLDINGS_FIELDS(org.folio.oaipmh.helpers.records.RecordMetadataManager.ITEMS_AND_HOLDINGS_FIELDS) Instant(java.time.Instant) Future(io.vertx.core.Future) TenantTool(org.folio.rest.tools.utils.TenantTool) Collectors(java.util.stream.Collectors) PostgresClient(org.folio.rest.persist.PostgresClient) ZoneId(java.time.ZoneId) String.format(java.lang.String.format) RepositoryConfigurationUtil(org.folio.oaipmh.helpers.RepositoryConfigurationUtil) REQUEST_ID_PARAM(org.folio.oaipmh.Constants.REQUEST_ID_PARAM) CALL_NUMBER(org.folio.oaipmh.helpers.records.RecordMetadataManager.CALL_NUMBER) Objects(java.util.Objects) List(java.util.List) Logger(org.apache.logging.log4j.Logger) OffsetDateTime(java.time.OffsetDateTime) Buffer(io.vertx.core.buffer.Buffer) Response(javax.ws.rs.core.Response) WebClientProvider(org.folio.oaipmh.WebClientProvider) RETRY_ATTEMPTS(org.folio.oaipmh.Constants.RETRY_ATTEMPTS) STATUS_MESSAGE(org.folio.oaipmh.Constants.STATUS_MESSAGE) ChronoField(java.time.temporal.ChronoField) HttpResponse(io.vertx.ext.web.client.HttpResponse) SourceStorageSourceRecordsClientWrapper(org.folio.oaipmh.service.SourceStorageSourceRecordsClientWrapper) RequestMetadataLb(org.folio.rest.jooq.tables.pojos.RequestMetadataLb) BodyCodec(io.vertx.ext.web.codec.BodyCodec) INSTANCES_PROCESSING(org.folio.oaipmh.service.MetricsCollectingService.MetricOperation.INSTANCES_PROCESSING) HashMap(java.util.HashMap) OKAPI_TOKEN(org.folio.oaipmh.Constants.OKAPI_TOKEN) REPOSITORY_MAX_RECORDS_PER_RESPONSE(org.folio.oaipmh.Constants.REPOSITORY_MAX_RECORDS_PER_RESPONSE) JsonEvent(io.vertx.core.parsetools.JsonEvent) CollectionUtils(org.apache.commons.collections4.CollectionUtils) SpringContextUtil(org.folio.spring.SpringContextUtil) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) RepositoryConfigurationUtil.getBooleanProperty(org.folio.oaipmh.helpers.RepositoryConfigurationUtil.getBooleanProperty) HttpRequestImpl(io.vertx.ext.web.client.impl.HttpRequestImpl) AsyncResult(io.vertx.core.AsyncResult) STATUS_CODE(org.folio.oaipmh.Constants.STATUS_CODE) Promise(io.vertx.core.Promise) Vertx(io.vertx.core.Vertx) Instances(org.folio.rest.jooq.tables.pojos.Instances) RecordMetadataManager(org.folio.oaipmh.helpers.records.RecordMetadataManager) Maps(com.google.common.collect.Maps) HttpRequest(io.vertx.ext.web.client.HttpRequest) JsonArray(io.vertx.core.json.JsonArray) ResponseHelper(org.folio.oaipmh.helpers.response.ResponseHelper) PgConnection(io.vertx.pgclient.PgConnection) Collectors.toList(java.util.stream.Collectors.toList) RecordType(org.openarchives.oai._2.RecordType) REPOSITORY_SRS_HTTP_REQUEST_RETRY_ATTEMPTS(org.folio.oaipmh.Constants.REPOSITORY_SRS_HTTP_REQUEST_RETRY_ATTEMPTS) ACCEPT(javax.ws.rs.core.HttpHeaders.ACCEPT) LOCATION(org.folio.oaipmh.Constants.LOCATION) REPOSITORY_SUPPRESSED_RECORDS_PROCESSING(org.folio.oaipmh.Constants.REPOSITORY_SUPPRESSED_RECORDS_PROCESSING) ListRecordsType(org.openarchives.oai._2.ListRecordsType) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) Collections(java.util.Collections) Buffer(io.vertx.core.buffer.Buffer) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Date(java.util.Date)

Aggregations

Instant (java.time.Instant)3 OffsetDateTime (java.time.OffsetDateTime)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 ACCEPT (javax.ws.rs.core.HttpHeaders.ACCEPT)3 CONTENT_TYPE (javax.ws.rs.core.HttpHeaders.CONTENT_TYPE)3 Maps (com.google.common.collect.Maps)2 AsyncResult (io.vertx.core.AsyncResult)2 Context (io.vertx.core.Context)2 Future (io.vertx.core.Future)2 Handler (io.vertx.core.Handler)2 Promise (io.vertx.core.Promise)2 Vertx (io.vertx.core.Vertx)2 WorkerExecutor (io.vertx.core.WorkerExecutor)2 Buffer (io.vertx.core.buffer.Buffer)2 DecodeException (io.vertx.core.json.DecodeException)2 JsonArray (io.vertx.core.json.JsonArray)2 JsonObject (io.vertx.core.json.JsonObject)2 JsonEvent (io.vertx.core.parsetools.JsonEvent)2