@Test public void testParseSortQueryParameter() { Set<SortCriterionImpl> sortOrders = new HashSet<SortCriterionImpl>(); sortOrders.add(new SortCriterionImpl("name", Order.Descending)); assertTrue(RestUtils.parseSortQueryParameter("name:DESC").equals(sortOrders)); sortOrders.add(new SortCriterionImpl("date", Order.Ascending)); assertTrue(RestUtils.parseSortQueryParameter("name:DESC,date:ASC").equals(sortOrders)); }
public static Set<SortCriterion> parseSortQueryParameter(String sort) throws WebApplicationException { Set<SortCriterion> sortOrders = new HashSet<SortCriterion>(); StringTokenizer tokenizer = new StringTokenizer(sort, ","); while (tokenizer.hasMoreTokens()) { try { sortOrders.add(SortCriterionImpl.parse(tokenizer.nextToken())); } catch (IllegalArgumentException e) { throw new WebApplicationException(Status.BAD_REQUEST); } } return sortOrders; }
RestUtils { public static Set<SortCriterion> parseSortQueryParameter(String sort) throws WebApplicationException { Set<SortCriterion> sortOrders = new HashSet<SortCriterion>(); StringTokenizer tokenizer = new StringTokenizer(sort, ","); while (tokenizer.hasMoreTokens()) { try { sortOrders.add(SortCriterionImpl.parse(tokenizer.nextToken())); } catch (IllegalArgumentException e) { throw new WebApplicationException(Status.BAD_REQUEST); } } return sortOrders; } }
RestUtils { public static Set<SortCriterion> parseSortQueryParameter(String sort) throws WebApplicationException { Set<SortCriterion> sortOrders = new HashSet<SortCriterion>(); StringTokenizer tokenizer = new StringTokenizer(sort, ","); while (tokenizer.hasMoreTokens()) { try { sortOrders.add(SortCriterionImpl.parse(tokenizer.nextToken())); } catch (IllegalArgumentException e) { throw new WebApplicationException(Status.BAD_REQUEST); } } return sortOrders; } private  RestUtils(); }
RestUtils { public static Set<SortCriterion> parseSortQueryParameter(String sort) throws WebApplicationException { Set<SortCriterion> sortOrders = new HashSet<SortCriterion>(); StringTokenizer tokenizer = new StringTokenizer(sort, ","); while (tokenizer.hasMoreTokens()) { try { sortOrders.add(SortCriterionImpl.parse(tokenizer.nextToken())); } catch (IllegalArgumentException e) { throw new WebApplicationException(Status.BAD_REQUEST); } } return sortOrders; } private  RestUtils(); static Response okJson(JValue json); static Response conflictJson(JValue json); static Response notFound(String msg, Object... args); static Response notFoundJson(JValue json); static Response serverErrorJson(JValue json); static Response okJsonList(List<JValue> jsonList, int offset, int limit, long total); static StreamingOutput stream(final Fx<OutputStream> out); static Set<SortCriterion> parseSortQueryParameter(String sort); static Tuple<Date, Date> getFromAndToDateRange(String fromToDateRange); static Map<String, String> parseFilter(String filter); static String getJsonString(JValue json); static String getJsonStringSilent(JValue json); }
RestUtils { public static Set<SortCriterion> parseSortQueryParameter(String sort) throws WebApplicationException { Set<SortCriterion> sortOrders = new HashSet<SortCriterion>(); StringTokenizer tokenizer = new StringTokenizer(sort, ","); while (tokenizer.hasMoreTokens()) { try { sortOrders.add(SortCriterionImpl.parse(tokenizer.nextToken())); } catch (IllegalArgumentException e) { throw new WebApplicationException(Status.BAD_REQUEST); } } return sortOrders; } private  RestUtils(); static Response okJson(JValue json); static Response conflictJson(JValue json); static Response notFound(String msg, Object... args); static Response notFoundJson(JValue json); static Response serverErrorJson(JValue json); static Response okJsonList(List<JValue> jsonList, int offset, int limit, long total); static StreamingOutput stream(final Fx<OutputStream> out); static Set<SortCriterion> parseSortQueryParameter(String sort); static Tuple<Date, Date> getFromAndToDateRange(String fromToDateRange); static Map<String, String> parseFilter(String filter); static String getJsonString(JValue json); static String getJsonStringSilent(JValue json);  }