@Path("/cleanup/findDuplicateFeeds") @GET @ApiOperation(value = "Find duplicate feeds") public Response findDuplicateFeeds( @QueryParam("mode") DuplicateMode mode, @QueryParam("page") int page, @QueryParam("limit") int limit, @QueryParam("minCount") long minCount) { List<FeedCount> list = feedDAO.findDuplicates(mode, limit * page, limit, minCount); return Response.ok(list).build(); }
@Path("/cleanup/merge") @POST @ApiOperation(value = "Merge feeds", notes = "Merge feeds together") public Response mergeFeeds(@ApiParam(required = true) FeedMergeRequest request) { Feed into = feedDAO.findById(request.getIntoFeedId()); if (into == null) { return Response.status(Status.BAD_REQUEST).entity("'into feed' not found").build(); } List<Feed> feeds = Lists.newArrayList(); for (Long feedId : request.getFeedIds()) { Feed feed = feedDAO.findById(feedId); feeds.add(feed); } if (feeds.isEmpty()) { return Response.status(Status.BAD_REQUEST).entity("'from feeds' empty").build(); } cleaner.mergeFeeds(into, feeds); return Response.ok().build(); }