diff --git a/cellbase-server/src/main/java/org/opencb/cellbase/server/rest/GenericRestWSServer.java b/cellbase-server/src/main/java/org/opencb/cellbase/server/rest/GenericRestWSServer.java index 56b76ce7cc..d055ea735e 100755 --- a/cellbase-server/src/main/java/org/opencb/cellbase/server/rest/GenericRestWSServer.java +++ b/cellbase-server/src/main/java/org/opencb/cellbase/server/rest/GenericRestWSServer.java @@ -179,11 +179,31 @@ public Map convertMultiToMap(MultivaluedMap m) { return map; } for (Map.Entry> entry : m.entrySet()) { - map.put(entry.getKey(), String.join(",", entry.getValue())); + String camelCased = convertDotToCamelCase(entry.getKey()); + map.put(camelCased, String.join(",", entry.getValue())); } return map; } + /** + * Converts to canelcase, e.g. transcripts.biotype --> transcriptsBiotype. It's translated back to the full path right before the + * mongo query is run. + * + * @param dotPath e.g. transcripts.biotype + * @return the string camelcased + */ + private String convertDotToCamelCase(String dotPath) { + String[] paths = dotPath.split("\\."); + StringBuilder sb = new StringBuilder(); + for (String path : paths) { + if (sb.length() > 0) { + path = StringUtils.capitalize(path); + } + sb.append(path); + } + return sb.toString(); + } + public void parseQueryParams() { MultivaluedMap multivaluedMap = uriInfo.getQueryParameters();