Esempio n. 1
0
  Response update(Request request) {
    long seriesId = Long.parseLong(request.urlParam("id"));
    List<Long> collectionIds =
        request
            .formParams()
            .getOrDefault("collection.id", Collections.emptyList())
            .stream()
            .map(Long::parseLong)
            .collect(Collectors.toList());
    List<String> collectionUrlFilters =
        request.formParams().getOrDefault("collection.urlFilters", Collections.emptyList());

    if (collectionIds.size() != collectionUrlFilters.size()) {
      return response(400, "collection.id and collection.urlFilters mismatch");
    }

    wa.serieses.update(seriesId, parseForm(request), collectionIds, collectionUrlFilters);
    return seeOther(request.contextUri().resolve("series/" + seriesId).toString());
  }
Esempio n. 2
0
 Response createSeries(Request request) {
   long seriesId = wa.serieses.create(parseForm(request));
   return seeOther(request.contextUri().resolve("series/" + seriesId).toString());
 }