|
|
|
@ -146,7 +146,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
|
|
|
|
*/
|
|
|
|
|
public String getDevelopmentUser() {
|
|
|
|
|
String user = NewsConstants.TEST_USER;
|
|
|
|
|
// user = "costantino.perciante";
|
|
|
|
|
// user = "costantino.perciante";
|
|
|
|
|
return user;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
@ -1135,7 +1135,9 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
|
|
|
|
public ArrayList<EnhancedFeed> getFeedsRelatedToUserStatistics(
|
|
|
|
|
ShowUserStatisticAction action, int from, int quantity) {
|
|
|
|
|
|
|
|
|
|
String userid = getASLSession().getUsername();
|
|
|
|
|
ASLSession session = getASLSession();
|
|
|
|
|
String userid = session.getUsername();
|
|
|
|
|
String scope = session.getScope();
|
|
|
|
|
|
|
|
|
|
if(userid == NewsConstants.TEST_USER)
|
|
|
|
|
return null;
|
|
|
|
@ -1179,19 +1181,35 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
|
|
|
|
default : return new ArrayList<EnhancedFeed>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// filter the feeds according the current context
|
|
|
|
|
Iterator<Feed> iteratorScope = feeds.iterator();
|
|
|
|
|
|
|
|
|
|
List<String> contexts = new ArrayList<String>();
|
|
|
|
|
if(isInfrastructureScope()){
|
|
|
|
|
|
|
|
|
|
if(!isInfrastructureScope()){
|
|
|
|
|
LiferayGroupManager groupManager = new LiferayGroupManager();
|
|
|
|
|
long userIdLong = new LiferayUserManager().getUserId(userid);
|
|
|
|
|
|
|
|
|
|
String currentScope = getASLSession().getScope();
|
|
|
|
|
// filter for site
|
|
|
|
|
Set<GCubeGroup> vresInPortal = groupManager.listGroupsByUserAndSite(userIdLong, getThreadLocalRequest().getServerName());
|
|
|
|
|
_log.debug("Contexts in this site are " + vresInPortal);
|
|
|
|
|
|
|
|
|
|
while (iteratorScope.hasNext()) {
|
|
|
|
|
Feed feed = (Feed) iteratorScope.next();
|
|
|
|
|
if(!feed.getVreid().equals(currentScope))
|
|
|
|
|
iteratorScope.remove();
|
|
|
|
|
// get the scopes associated with such groups
|
|
|
|
|
for (GCubeGroup gCubeGroup : vresInPortal) {
|
|
|
|
|
contexts.add(groupManager.getInfrastructureScope(gCubeGroup.getGroupId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
// just the current scope
|
|
|
|
|
contexts.add(scope);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// filter
|
|
|
|
|
Iterator<Feed> iteratorScope = feeds.iterator();
|
|
|
|
|
while (iteratorScope.hasNext()) {
|
|
|
|
|
Feed feed = (Feed) iteratorScope.next();
|
|
|
|
|
if(!contexts.contains(feed.getVreid()))
|
|
|
|
|
iteratorScope.remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// sort the list, retrieve elements in the range and enhance the feeds
|
|
|
|
|