Skip to content

Commit

Permalink
Fix local compilation errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
at88mph committed Feb 20, 2024
1 parent 258a431 commit fab300f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* Validator for Cone Search parameters.
Expand All @@ -85,6 +86,9 @@ public class ConeParameterValidator extends CommonParamValidator {
public static final String RA_PARAM = "RA";
public static final String DEC_PARAM = "DEC";
public static final String SR_PARAM = "SR";

public static final String MAXREC = "MAXREC";

static final int MIN_VERB_VALUE = 1;
static final int MID_VERB_VALUE = 2;
static final int MAX_VERB_VALUE = 3;
Expand Down Expand Up @@ -126,6 +130,17 @@ public int validateVERB(final Map<String, List<String>> parameters) {
}
}

int getMaxRec(final Map<String, List<String>> parameters, final int defaultValue, final int maxValue) {
return validateInteger(ConeParameterValidator.MAXREC, parameters).stream().filter(i -> i > maxValue)
.findFirst().orElse(defaultValue);
}

private List<Integer> validateInteger(final String verbParam, final Map<String, List<String>> parameters,
final List<Integer> validValues) {
return super.validateInteger(verbParam, parameters).stream().filter(validValues::contains)
.collect(Collectors.toList());
}

private String getFirstParameter(final String key, final Map<String, List<String>> requestParameters) {
final List<String> values = requestParameters.get(key);
return (values == null || values.isEmpty()) ? null : values.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
package org.opencadc.conesearch;

import ca.nrc.cadc.dali.Circle;
import ca.nrc.cadc.dali.tables.votable.VOTableWriter;
import ca.nrc.cadc.util.StringUtil;

import java.util.HashMap;
Expand Down Expand Up @@ -139,7 +138,7 @@ public Map<String, Object> getParameterMap() {

// Obtain and, if necessary, provide a default RESPONSEFORMAT.
queryParameterMap.put(ConeParameterValidator.RESPONSEFORMAT,
coneParameterValidator.getResponseFormat(parameters, VOTableWriter.CONTENT_TYPE));
coneParameterValidator.getResponseFormat(parameters));

// Obtain and validate the VERB (verbosity) output.
final int outputVerbosity = coneParameterValidator.validateVERB(parameters);
Expand Down

0 comments on commit fab300f

Please sign in to comment.