Skip to content

Commit

Permalink
[messy interim] freeze state prior to membership overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdunnjpl committed Nov 21, 2023
1 parent d3bcfd5 commit 60e801a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ public interface LidvidsContext {

public Integer getLimit();

public List<String> getSearchAfter();
public List<String> getSortFields();

public List<String> getSearchAfterValues();

public boolean getSingletonResultExpected();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public interface UserContext extends LidvidsContext {

public ProductVersionSelector getSelector();

public List<String> getSort();
public List<String> getSortFields();

public List<String> getSearchAfterValues();

public String getVersion();
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class URIParameters implements UserContext {
private final String group;
private final String identifier;
private final List<String> keywords;
private final List<String> searchAfter;
private final List<String> searchAfterValues;
private final Integer limit;
private final Boolean singletonResultExpected;
private final String query;
private final ProductVersionSelector selector;
private final List<String> sort;
private final List<String> sortFields;
private final String version;

private PdsProductIdentifier productIdentifier;
Expand All @@ -56,12 +56,12 @@ public URIParameters(URIParametersBuilder builder) {
this.group = builder.group;
this.identifier = builder.identifier;
this.keywords = builder.keywords;
this.searchAfter = builder.searchAfter;
this.searchAfterValues = builder.searchAfter;
this.limit = builder.limit;
this.singletonResultExpected = builder.singletonResultExpected;
this.query = builder.query;
this.selector = builder.selector;
this.sort = builder.sort;
this.sortFields = builder.sort;
this.version = builder.version;

}
Expand Down Expand Up @@ -124,13 +124,13 @@ public ProductVersionSelector getSelector() {
}

@Override
public List<String> getSort() {
return sort;
public List<String> getSortFields() {
return sortFields;
}

@Override
public List<String> getSearchAfter() {
return searchAfter;
public List<String> getSearchAfterValues() {
return searchAfterValues;
}

public boolean getVerifyClassAndId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

class PaginationLidvidBuilder implements Pagination<String> {
final private int limit;
final private List<String> searchAfter;
private List<String> sortFields;
private List<String> searchAfterValues;
final private List<String> page = new ArrayList<String>();

private int total = 0;

PaginationLidvidBuilder(LidvidsContext bounds) {
this.limit = bounds.getLimit();
this.searchAfter = bounds.getSearchAfter();
this.sortFields = bounds.getSortFields();
this.searchAfterValues = bounds.getSearchAfterValues();
}

void addAll(List<String> data) {
Expand Down Expand Up @@ -64,8 +66,11 @@ public int size() {
}

@Override
public List<String> searchAfter() {
return this.searchAfter;
public List<String> getSortFields() {
return this.sortFields;
}
public List<String> getSearchAfterValues() {
return this.searchAfterValues;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ private RequestAndResponseContext(ControlContext controlContext, // webby criter
this.productIdentifier = LidVidUtils.resolve(parameters.getIdentifier(), versionSelectionScope,
controlContext, RequestBuildContextFactory
.given(parameters.getSelector() == ProductVersionSelector.LATEST, fields, resPreset));
this.searchAfter = parameters.getSearchAfter();
this.searchAfter = parameters.getSearchAfterValues();
this.limit = parameters.getLimit();
this.singletonResultExpected = parameters.getSingletonResultExpected();
this.sort = parameters.getSort();
this.sort = parameters.getSortFields();
this.presetCriteria = outPreset;
this.selector = parameters.getSelector();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ public Integer getLimit() {
}

@Override
public List<String> getSearchAfter() {
return null;
public List<String> getSortFields() {
return List.of("ops:Harvest_Info/ops:harvest_date_time");
}

@Override
public List<String> getSearchAfterValues() {
return List.of(""); // TODO: Check whether this actually works or if it needs to be set per-page in the contexts in which Unlimited is used
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,12 @@ public void testComplexAddTrimHeadAndTailSpanning() {


class LidvidsContextStub implements LidvidsContext {
private final List<String> sortFields;
private final List<String> searchAfter;
private final int limit;

public LidvidsContextStub(int start, int limit) {
this.sortFields = null;
this.searchAfter = null;
this.limit = limit;
}
Expand All @@ -267,7 +269,12 @@ public Integer getLimit() {
}

@Override
public List<String> getSearchAfter() {
public List<String> getSortFields() {
return sortFields;
}

@Override
public List<String> getSearchAfterValues() {
return searchAfter;
}

Expand Down

0 comments on commit 60e801a

Please sign in to comment.