Example #1
0
  @PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')")
  @RequestMapping(value = "/{filterId}", method = RequestMethod.PUT)
  public @ResponseBody Filter updateFilter(
      @PathVariable String boardId, @PathVariable String filterId, @RequestBody Filter filter)
      throws Exception {

    if (filter.getPath() == null) {
      filter.setPath(String.format(URI.FILTER_URI, boardId, filterId));
    }

    ObjectContentManager ocm = ocmFactory.getOcm();
    try {
      ocm.update(filter);
      ocm.save();
      this.cacheInvalidationManager.invalidate(BoardController.BOARD, boardId);
    } finally {
      ocm.logout();
    }

    return filter;
  }