mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Subscription service REST API and a glimpse of UI
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28460 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -75,12 +75,14 @@ public class SubscriptionsDAOImpl extends AbstractSubscriptionsDAO
|
|||||||
map.put("userNodeId", userPair.getFirst());
|
map.put("userNodeId", userPair.getFirst());
|
||||||
map.put("false", Boolean.FALSE);
|
map.put("false", Boolean.FALSE);
|
||||||
|
|
||||||
|
int maxItems = (pagingRequest.getMaxItems() < 0 ? Integer.MAX_VALUE - 1 : pagingRequest.getMaxItems());
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<SubscriptionNodeEntity> nodeList = (List<SubscriptionNodeEntity>) template.selectList(
|
List<SubscriptionNodeEntity> nodeList = (List<SubscriptionNodeEntity>) template.selectList(
|
||||||
"alfresco.subscriptions.select_Subscriptions", map, new RowBounds(pagingRequest.getSkipCount(),
|
"alfresco.subscriptions.select_Subscriptions", map, new RowBounds(pagingRequest.getSkipCount(),
|
||||||
pagingRequest.getMaxItems() + 1));
|
maxItems + 1));
|
||||||
|
|
||||||
boolean hasMore = nodeList.size() > pagingRequest.getMaxItems();
|
boolean hasMore = nodeList.size() > maxItems;
|
||||||
|
|
||||||
List<NodeRef> result = new ArrayList<NodeRef>(nodeList.size());
|
List<NodeRef> result = new ArrayList<NodeRef>(nodeList.size());
|
||||||
for (SubscriptionNodeEntity sne : nodeList)
|
for (SubscriptionNodeEntity sne : nodeList)
|
||||||
@@ -217,11 +219,13 @@ public class SubscriptionsDAOImpl extends AbstractSubscriptionsDAO
|
|||||||
map.put("userNodeId", userPair.getFirst());
|
map.put("userNodeId", userPair.getFirst());
|
||||||
map.put("false", Boolean.FALSE);
|
map.put("false", Boolean.FALSE);
|
||||||
|
|
||||||
|
int maxItems = (pagingRequest.getMaxItems() < 0 ? Integer.MAX_VALUE - 1 : pagingRequest.getMaxItems() + 1);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> userList = (List<String>) template.selectList("alfresco.subscriptions.select_Following", map,
|
List<String> userList = (List<String>) template.selectList("alfresco.subscriptions.select_Following", map,
|
||||||
new RowBounds(pagingRequest.getSkipCount(), pagingRequest.getMaxItems() + 1));
|
new RowBounds(pagingRequest.getSkipCount(), maxItems + 1));
|
||||||
|
|
||||||
boolean hasMore = userList.size() > pagingRequest.getMaxItems();
|
boolean hasMore = userList.size() > maxItems;
|
||||||
if (hasMore && userList.size() > 0)
|
if (hasMore && userList.size() > 0)
|
||||||
{
|
{
|
||||||
userList.remove(userList.size() - 1);
|
userList.remove(userList.size() - 1);
|
||||||
@@ -230,7 +234,7 @@ public class SubscriptionsDAOImpl extends AbstractSubscriptionsDAO
|
|||||||
Integer totalCount = null;
|
Integer totalCount = null;
|
||||||
if (pagingRequest.getRequestTotalCountMax() > 0)
|
if (pagingRequest.getRequestTotalCountMax() > 0)
|
||||||
{
|
{
|
||||||
totalCount = countFollowers(userId);
|
totalCount = countSubscriptions(userId, SubscriptionItemTypeEnum.USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PagingFollowingResultsImpl(userList, hasMore, totalCount);
|
return new PagingFollowingResultsImpl(userList, hasMore, totalCount);
|
||||||
@@ -252,11 +256,13 @@ public class SubscriptionsDAOImpl extends AbstractSubscriptionsDAO
|
|||||||
map.put("userNodeId", userPair.getFirst());
|
map.put("userNodeId", userPair.getFirst());
|
||||||
map.put("false", Boolean.FALSE);
|
map.put("false", Boolean.FALSE);
|
||||||
|
|
||||||
|
int maxItems = (pagingRequest.getMaxItems() < 0 ? Integer.MAX_VALUE - 1 : pagingRequest.getMaxItems() + 1);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> userList = (List<String>) template.selectList("alfresco.subscriptions.select_Followers", map,
|
List<String> userList = (List<String>) template.selectList("alfresco.subscriptions.select_Followers", map,
|
||||||
new RowBounds(pagingRequest.getSkipCount(), pagingRequest.getMaxItems() + 1));
|
new RowBounds(pagingRequest.getSkipCount(), maxItems + 1));
|
||||||
|
|
||||||
boolean hasMore = userList.size() > pagingRequest.getMaxItems();
|
boolean hasMore = userList.size() > maxItems;
|
||||||
if (hasMore && userList.size() > 0)
|
if (hasMore && userList.size() > 0)
|
||||||
{
|
{
|
||||||
userList.remove(userList.size() - 1);
|
userList.remove(userList.size() - 1);
|
||||||
|
Reference in New Issue
Block a user