minimum count as parameter

This commit is contained in:
Athou
2013-07-08 20:38:06 +02:00
parent bd047efcd2
commit 132c1b0aaf
4 changed files with 9 additions and 6 deletions

View File

@@ -136,7 +136,7 @@ public class FeedDAO extends GenericDAO<Feed> {
}
public List<FeedCount> findDuplicates(int offset, int limit) {
public List<FeedCount> findDuplicates(int offset, int limit, long minCount) {
CriteriaQuery<String> query = builder.createQuery(String.class);
Root<Feed> root = query.from(getType());
@@ -146,7 +146,7 @@ public class FeedDAO extends GenericDAO<Feed> {
query.select(hashPath);
query.groupBy(hashPath);
query.having(builder.greaterThan(count, 1l));
query.having(builder.greaterThan(count, minCount));
TypedQuery<String> q = em.createQuery(query);
limit(q, offset, limit);

View File

@@ -273,8 +273,8 @@ public class AdminREST extends AbstractResourceREST {
@GET
@ApiOperation(value = "Find duplicate feeds")
public Response findDuplicateFeeds(@QueryParam("page") int page,
@QueryParam("limit") int limit) {
List<FeedCount> list = feedDAO.findDuplicates(limit * page, limit);
@QueryParam("limit") int limit, @QueryParam("minCount") long minCount) {
List<FeedCount> list = feedDAO.findDuplicates(limit * page, limit, minCount);
return Response.ok(list).build();
}
@@ -294,7 +294,7 @@ public class AdminREST extends AbstractResourceREST {
Feed feed = feedDAO.findById(feedId);
feeds.add(feed);
}
if (feeds.isEmpty()) {
return Response.status(Status.BAD_REQUEST)
.entity("'from feeds' empty").build();

View File

@@ -1210,11 +1210,13 @@ module.controller('ManageDuplicateFeedsCtrl', [
$scope.limit = 10;
$scope.page = 0;
$scope.minCount = 1;
$scope.mergeData = {};
$scope.refreshData = function() {
AdminCleanupService.findDuplicateFeeds({
limit : $scope.limit,
page : $scope.page
page : $scope.page,
minCount: $scope.minCount
}, function(data) {
$scope.counts = data;
});

View File

@@ -2,6 +2,7 @@
Limit <input type="number" ng-model="limit" />
Page <input type="number" ng-model="page" />
Min. count <input type="number" ng-model="minCount" />
<input type="button" class="btn" ng-click="refreshData()" value="Refresh" />
<table class="table table-condensed table-hover" ui-if="counts">
<thead>