Skip to content

Commit

Permalink
Added constant for supported formats
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
  • Loading branch information
GumpacG committed Mar 13, 2023
1 parent 5b6f36e commit c4395d6
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
import java.util.Collections;
import java.util.Locale;
import java.util.Map;
Expand All @@ -33,6 +34,7 @@ public class SQLQueryRequest {
"query", "fetch_size", "parameters");
private static final String QUERY_PARAMS_FORMAT = "format";
private static final String QUERY_PARAMS_SANITIZE = "sanitize";
private static final String[] SUPPORTED_FORMATS = {"jdbc", "csv", "raw", "json"};

/**
* JSON payload in REST request.
Expand Down Expand Up @@ -122,10 +124,7 @@ private boolean isFetchSizeZeroIfPresent() {

private boolean isSupportedFormat() {
return Strings.isNullOrEmpty(format)
|| "jdbc".equalsIgnoreCase(format)
|| "csv".equalsIgnoreCase(format)
|| "raw".equalsIgnoreCase(format)
|| "json".equalsIgnoreCase(format);
|| Arrays.stream(SUPPORTED_FORMATS).anyMatch(format::equalsIgnoreCase);
}

private String getFormat(Map<String, String> params) {
Expand Down

0 comments on commit c4395d6

Please sign in to comment.