From d8d339db277b774591e79c431f997315a27397ca Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 8 Apr 2013 17:20:48 +0000 Subject: [PATCH] smart refresh implemented (still buggy if a user posts something just in this user News feed) git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@73023 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/newsfeed/client/panels/NewsFeedPanel.java | 8 +++++++- .../portlets/user/newsfeed/server/NewsServiceImpl.java | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java index 056f5b8..ab98f12 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java @@ -251,7 +251,9 @@ public class NewsFeedPanel extends Composite { break; } } - //TODO: finish this + /** + * check for updates + */ private void checkAllUpdatesFeeds() { newsService.getAllUpdateUserFeeds(new AsyncCallback>() { @Override @@ -509,6 +511,10 @@ public class NewsFeedPanel extends Composite { }; t.schedule(500); + + + //insert it also in the model so that the user who created it do not get notified about this new update + allUpdates.add(0, toAdd); //insert in the model } private void showLoader() { diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java index 8146663..08c0573 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java @@ -11,6 +11,8 @@ import java.util.List; import java.util.Properties; import java.util.UUID; +import javax.servlet.ServletContext; + import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.SessionManager; import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; @@ -427,7 +429,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService } } - _log.trace("****** ENHANCED FEEDS TOTAL= " + toReturn.size()); + _log.trace("ENHANCED FEEDS TOTAL= " + toReturn.size() + " for user: " + username); return toReturn; } @@ -637,13 +639,16 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService */ private int getFeedsRefreshTimeInMillis() { //return 20000; //for testing + _log.info("Trying to read custom REFRESH_TIME"); Properties props = new Properties(); int toReturn = 0; int minutes = 0; String propertyfile = ""; try { - propertyfile = this.getThreadLocalRequest().getContextPath()+"conf/settings.properties"; + ServletContext servletContext = getServletContext(); + String contextPath = servletContext.getRealPath(File.separator); + propertyfile = contextPath + "conf" + File.separator + "settings.properties"; File propsFile = new File(propertyfile); FileInputStream fis = new FileInputStream(propsFile); props.load( fis);