Skip to content
Open
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
13 changes: 7 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ maven-package-all-apps:
- agents/uploadworkers/target/agents-uploadworkers-*.jar
- pipelines/reindex/target/pipelines-reindex-*.jar
- pipelines/curation/target/pipelines-curation-*.jar
- pipelines/curami/target/pipelines-curami-*.jar
- pipelines/copydown/target/pipelines-copydown-*.jar

build_and_push_docker_images:
stage: package
Expand All @@ -57,10 +55,6 @@ build_and_push_docker_images:
DOCKERFILE_TARGET: "pipelines-reindex"
- APP_NAME: "pipelines-curation"
DOCKERFILE_TARGET: "pipelines-curation"
- APP_NAME: "pipelines-curami"
DOCKERFILE_TARGET: "pipelines-curami"
- APP_NAME: "pipelines-copydown"
DOCKERFILE_TARGET: "pipelines-copydown"
script:
- |
DOCKER_IMAGE_NAME="$CI_REGISTRY_IMAGE/$APP_NAME:$DOCKER_TAG"
Expand All @@ -87,6 +81,7 @@ clone-config:
- config
only:
- chore/working-es-search-k8-deployment-with-cleanup
- chore/BSD-2547-sample-status-management
- dev
- main
- biosamples-search
Expand All @@ -100,6 +95,7 @@ deploy_k8s_primary_dev:
url: https://wwwdev.ebi.ac.uk/biosamples
only:
- chore/working-es-search-k8-deployment-with-cleanup
- chore/BSD-2547-sample-status-management
- dev
- main
- biosamples-search
Expand All @@ -115,6 +111,7 @@ deploy_k8s_primary_prod:
url: https://www.ebi.ac.uk/biosamples
only:
- chore/working-es-search-k8-deployment-with-cleanup
- chore/BSD-2547-sample-status-management
- dev
- main
- biosamples-search
Expand All @@ -130,6 +127,7 @@ deploy_k8s_fallback_prod:
url: https://www.ebi.ac.uk/biosamples
only:
- chore/working-es-search-k8-deployment-with-cleanup
- chore/BSD-2547-sample-status-management
- dev
- main
- biosamples-search
Expand All @@ -145,6 +143,7 @@ deploy_pipeline_k8s_primary_prod:
url: https://www.ebi.ac.uk/biosamples
only:
- chore/working-es-search-k8-deployment-with-cleanup
- chore/BSD-2547-sample-status-management
- dev
- main
- biosamples-search
Expand All @@ -160,6 +159,7 @@ deploy_pipeline_k8s_fallback_prod:
url: https://www.ebi.ac.uk/biosamples
only:
- chore/working-es-search-k8-deployment-with-cleanup
- chore/BSD-2547-sample-status-management
- dev
- main
- biosamples-search
Expand All @@ -175,6 +175,7 @@ deploy_pipeline_k8s_primary_dev:
url: https://wwwdev.ebi.ac.uk/biosamples
only:
- chore/working-es-search-k8-deployment-with-cleanup
- chore/BSD-2547-sample-status-management
- dev
- main
- biosamples-search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.PagedModel;
import org.springframework.hateoas.client.Traverson;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
Expand All @@ -46,7 +45,6 @@ public class BioSamplesClient implements AutoCloseable {
private final Logger log = LoggerFactory.getLogger(getClass());
private final SampleRetrievalService sampleRetrievalService;
private final SampleRetrievalServiceV2 sampleRetrievalServiceV2;
private final SamplePageRetrievalService samplePageRetrievalService;
private final SampleCursorRetrievalService sampleCursorRetrievalService;
private final SampleSubmissionService sampleSubmissionService;
private final SampleSubmissionServiceV2 sampleSubmissionServiceV2;
Expand Down Expand Up @@ -98,7 +96,6 @@ public BioSamplesClient(
traverson.setRestOperations(restOperations);

sampleRetrievalService = new SampleRetrievalService(restOperations, traverson);
samplePageRetrievalService = new SamplePageRetrievalService(restOperations, traverson);
sampleCursorRetrievalService = new SampleCursorRetrievalService(restOperations, traverson);
sampleSubmissionService = new SampleSubmissionService(restOperations, traverson);
sampleSubmissionServiceV2 = new SampleSubmissionServiceV2(restOperations, uriV2);
Expand Down Expand Up @@ -335,36 +332,6 @@ public Iterable<Optional<EntityModel<Sample>>> fetchSampleResourceAll(
return sampleRetrievalService.fetchAll(accessions);
}

/**
* Searches for samples using pagination. This method should be used for specific pagination
* needs. When in need for all results from a search, prefer the iterator implementation.
*
* @param text the text query
* @param page the page number
* @param size the page size
* @return a paged model of sample resources
*/
public PagedModel<EntityModel<Sample>> fetchPagedSampleResource(
final String text, final int page, final int size) {
return samplePageRetrievalService.search(text, Collections.emptyList(), page, size);
}

/**
* Searches for samples using pagination with specified filters. This method should be used for
* specific pagination needs. When in need for all results from a search, prefer the iterator
* implementation.
*
* @param text the text query
* @param filters the collection of filters
* @param page the page number
* @param size the page size
* @return a paged model of sample resources
*/
public PagedModel<EntityModel<Sample>> fetchPagedSampleResource(
final String text, final Collection<Filter> filters, final int page, final int size) {
return samplePageRetrievalService.search(text, filters, page, size);
}

/**
* Deprecated method: Persists a sample using BioSamples.
*
Expand Down Expand Up @@ -510,15 +477,6 @@ public Iterable<EntityModel<Sample>> fetchSampleResourceAll(
return sampleCursorRetrievalService.fetchAll(text, filters, jwt);
}

public PagedModel<EntityModel<Sample>> fetchPagedSampleResource(
final String text,
final Collection<Filter> filters,
final int page,
final int size,
final String jwt) {
return samplePageRetrievalService.search(text, filters, page, size, jwt);
}

public EntityModel<Sample> persistSampleResource(final Sample sample, final String jwt) {
final Collection<String> errors = sampleValidator.validate(sample);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public Iterable<EntityModel<Sample>> fetchAll(
}

params.add("applyCurations", String.valueOf(addCurations));

params = encodePlusInQueryParameters(params);

return new IterableResourceFetchAll<>(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.web.util.UriTemplate;

/**
* Provides an {@link Iterable} view over a paginated HAL resource and transparently fetches
* additional pages as iteration progresses.
*
* <p>This utility is intended for clients that need to consume a collection of {@link EntityModel}
* instances without manually handling pagination. It starts from the initial page discovered
* through {@link Traverson}, then iterates through all available pages by requesting later page
* links on demand. The implementation is designed to hide the paging mechanics from callers so that
* the result can be processed with a standard Java-enhanced for-loop or any other {@link
* Iterable}-based API.
*
* <p>When iterating, the current page is consumed first. If another page is available, the next
* page request is prepared and executed asynchronously using the supplied {@link ExecutorService}.
* This allows the next page to be fetched while the current page is still being processed, which
* can reduce waiting time for large result sets. Authentication information may be propagated via
* the optional JWT value when performing page requests.
*
* <p>The class also supports applying query parameters to the initial traversal, making it useful
* for fetching filtered result sets from REST endpoints that expose paginated representations.
*
* @param <T> the resource type contained in each {@link EntityModel}
*/
@Slf4j
public class IterableResourceFetchAll<T> implements Iterable<EntityModel<T>> {
private final Traverson traverson;
Expand Down Expand Up @@ -117,6 +139,9 @@ public Iterator<EntityModel<T>> iterator() {

// Build the URI with encoding disabled to preserve existing encoding
final URI finalUri = uriBuilder.build(false).toUri();

log.info("First Uri {}", finalUri);

final RequestEntity<Void> requestEntity =
IteratorResourceFetchAll.NextPageCallable.buildRequestEntity(jwt, finalUri);
final ResponseEntity<PagedModel<EntityModel<T>>> responseEntity =
Expand Down Expand Up @@ -187,7 +212,7 @@ public synchronized boolean hasNext() {
.build(true)
.toUri();

log.trace("Getting next page uri " + uri);
log.info("Next page uri " + uri);

nextPageFuture =
executor.submit(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public static Sample build(

sample.reviewed = reviewed;

// Validation moved to a later stage, to capture the error (SampleService.store())
// Validation moved to a later stage to capture the error (SampleService.store())
sample.release = release;

if (status != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public enum SampleStatus {
PUBLIC,
CANCELLED,
SUPPRESSED,
KILLED;
KILLED,
TEMPORARY_SUPPRESSED,
TEMPORARY_KILLED;

public static List<String> getSearchHiddenStatuses() {
return Arrays.asList(SUPPRESSED.name(), KILLED.name());
Expand Down
Loading