Skip to content

Commit

Permalink
fix count. #522
Browse files Browse the repository at this point in the history
  • Loading branch information
julie-sullivan committed Feb 5, 2020
1 parent d3f26d2 commit e7a3e37
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,16 @@ public void parseQueryParams() throws CellbaseException {

// Add all the others QueryParams from the URL
for (Map.Entry<String, List<String>> entry : multivaluedMap.entrySet()) {
if (!queryOptions.containsKey(entry.getKey())) {
query.put(entry.getKey(), entry.getValue().get(0));

String key = entry.getKey();
String value = entry.getValue().get(0);

if (!queryOptions.containsKey(key)) {
if ("count".equalsIgnoreCase(key)) {
queryOptions.put("count", Boolean.parseBoolean(value));
} else {
query.put(key, value);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ public SpeciesWSServer(@PathParam("version")
@ApiOperation(httpMethod = "GET",
value = "Retrieves info about current species chromosomes.", response = Chromosome.class,
responseContainer = "QueryResponse")
public Response getSpeciesInfo(@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include")
@ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort")
@ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort) {
public Response getSpeciesInfo(@QueryParam("exclude") @ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include") @ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort") @ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort) {
try {
parseIncludesAndExcludes(exclude, include, sort);
parseQueryParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ClinicalWSServer(@PathParam("version")
value = "Retrieves all clinical variants", response = Variant.class, responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "source", value = ParamConstants.SOURCE,
required = false, dataType = "java.util.List", paramType = "query"),
Expand All @@ -84,16 +84,11 @@ public ClinicalWSServer(@PathParam("version")
@ApiImplicitParam(name = "alleleOrigin", value = ParamConstants.ALLELE_ORIGIN,
required = false, dataType = "java.util.List", paramType = "query")
})
public Response getAll(@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include")
@ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort")
@ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort,
@QueryParam("limit") @DefaultValue("10")
@ApiParam(value = ParamConstants.LIMIT_DESCRIPTION) Integer limit,
@QueryParam("skip") @DefaultValue("0")
@ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
public Response getAll(@QueryParam("exclude") @ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include") @ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort") @ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort,
@QueryParam("limit") @DefaultValue("10") @ApiParam(value = ParamConstants.LIMIT_DESCRIPTION) Integer limit,
@QueryParam("skip") @DefaultValue("0") @ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
try {
parseIncludesAndExcludes(exclude, include, sort);
parseLimitAndSkip(limit, skip);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public Response getAggregationStats(@DefaultValue("") @QueryParam("fields")
responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "region", value = ParamConstants.REGION_DESCRIPTION,
required = false, dataType = "java.util.List", paramType = "query"),
Expand Down Expand Up @@ -286,6 +286,7 @@ public Response getAll(@QueryParam("exclude") @ApiParam(value = ParamConstants.E
@QueryParam("skip") @DefaultValue("0")
@ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
try {

parseIncludesAndExcludes(exclude, include, sort);
parseLimitAndSkip(limit, skip);
parseQueryParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public Response getInfoByEnsemblId(@PathParam("proteins")
value = "Get all proteins", response = Entry.class, responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "accession", value = ParamConstants.PROTEIN_ACCESSIONS,
required = false, dataType = "java.util.List", paramType = "query"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public Response getByEnsemblId(@PathParam("transcriptId") String id) {
response = Gene.class, responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "biotype", value = ParamConstants.GENE_BIOTYPES,
required = false, dataType = "java.util.List", paramType = "query"),
Expand Down Expand Up @@ -187,7 +187,7 @@ public Response getGeneById(@PathParam("transcripts") @ApiParam(name = "transcri
responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "region", value = ParamConstants.REGION_DESCRIPTION,
required = false, dataType = "java.util.List", paramType = "query"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Response getModel() {
responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true")
})
public Response getAll(@QueryParam("exclude")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public Response getByEnsemblId(@PathParam("variants")
value = "Retrieves all variation objects", response = Variant.class, responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "region", value = ParamConstants.REGION_DESCRIPTION,
required = false, dataType = "java.util.List", paramType = "query"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Response getFeatureClasses() {
responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "region", value = ParamConstants.REGION_DESCRIPTION,
required = false, dataType = "java.util.List", paramType = "query"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public TfWSServer(@PathParam("version")
response = RegulatoryFeature.class, responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "count", value = ParamConstants.COUNT_DESCRIPTION,
required = false, dataType = "java.lang.Boolean", paramType = "query", defaultValue = "false",
required = false, dataType = "boolean", paramType = "query", defaultValue = "false",
allowableValues = "false,true"),
@ApiImplicitParam(name = "region", value = ParamConstants.REGION_DESCRIPTION,
required = false, dataType = "java.util.List", paramType = "query")
Expand Down

0 comments on commit e7a3e37

Please sign in to comment.