diff --git a/.classpath b/.classpath index a567bf8..44c5f88 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -20,16 +20,16 @@ - - - - - - + + + + + + diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs index ab4c8c2..100e945 100644 --- a/.settings/com.google.gdt.eclipse.core.prefs +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -1,5 +1,5 @@ eclipse.preferences.version=1 jarsExcludedFromWebInfLib= -lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.4.1-SNAPSHOT +lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.5.0-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index e5019e4..6249222 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,13 +1,12 @@ -#Tue Apr 09 11:48:39 CEST 2013 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index d215cd0..c24712e 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -3,5 +3,5 @@ - + diff --git a/distro/changelog.xml b/distro/changelog.xml index 195b536..aa76a76 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,9 @@ + + Moved to Java7 + Added configuration file for VRE Labels + Moved to GWT 2.5.1 diff --git a/pom.xml b/pom.xml index 020d1ed..2096ee0 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.gcube.portlets.user news-feed war - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT gCube News Feed Portlet @@ -29,8 +29,8 @@ 2.5.1 distro - 1.6 - 1.6 + 1.7 + 1.7 ${project.build.directory}/${project.build.finalName} UTF-8 @@ -209,8 +209,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 + 1.7 + 1.7 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 8b26351..132d2d6 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 @@ -92,6 +92,8 @@ public class NewsFeedPanel extends Composite { public static final String LIKED_LABEL = "Favorited"; public static final String COMMENT_LABEL = "Reply"; public static final String MESSAGE_LABEL = "Message"; + + private String vreLabel; private int delayMillis = 300000; //5 minutes by default (is read from a configuration file in the first async callback) @@ -222,7 +224,8 @@ public class NewsFeedPanel extends Composite { @Override public void onSuccess(UserSettings result) { myUserInfo = result.getUserInfo(); - delayMillis = result.getRefreshingTimeInMillis(); + delayMillis = result.getRefreshingTimeInMillis(); + vreLabel = result.getChannelName(); if (result.getUserInfo().getUsername().equals("test.user")) { Window.alert("Your session has expired, please log out and login again"); } @@ -426,7 +429,7 @@ public class NewsFeedPanel extends Composite { newsPanel.add(new HTML("
" + "Looks like we've got nothing for you at the moment.
" + "You may begin by joining some of the available " + - "
Virtual Research Environments.
")); + "
"+vreLabel+"s.")); isFirstTweet = true; } else { 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 9394192..5b6e77a 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 @@ -129,14 +129,14 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService String accountURL = themeDisplay.getURLMyAccount().toString(); UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, false, null); - UserSettings toReturn = new UserSettings(userInfo, getFeedsRefreshTimeInMillis(), session.getScopeName(), isInfrastructureScope()); + UserSettings toReturn = new UserSettings(userInfo, getFeedsRefreshTimeInMillis(), session.getScopeName(), getVRELabel(), isInfrastructureScope()); setUserSettingsInSession(toReturn); return toReturn; } else { _log.info("Returning test USER"); UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, null); - return new UserSettings(user, getFeedsRefreshTimeInMillis(), session.getScopeName(), isInfrastructureScope()); + return new UserSettings(user, getFeedsRefreshTimeInMillis(), session.getScopeName(), getVRELabel(), isInfrastructureScope()); } } catch (Exception e) { @@ -732,6 +732,36 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService return sb.toString(); } + /** + * read from the property the name of the label to use for VREs/Channels + * @return the refreshingTime in milliseconds + */ + private String getVRELabel() { + String toReturn = "Area"; + if (withinPortal) { + _log.info("Trying to read custom VRE Label"); + Properties props = new Properties(); + String propertyfile = ""; + try { + 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); + + toReturn = (String) props.getProperty("CHANNEL_NAME"); + + } + //catch exception in case properties file does not exist + catch(IOException e) { + toReturn = "Area"; + _log.error("settings.properties file not found under " + propertyfile +", returning Area"); + return toReturn; + } + } + return toReturn; + } /** * read from the property the refreshing time * @return the refreshingTime in milliseconds diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/shared/UserSettings.java b/src/main/java/org/gcube/portlets/user/newsfeed/shared/UserSettings.java index 377de3a..13e80ab 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/shared/UserSettings.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/shared/UserSettings.java @@ -9,18 +9,22 @@ public class UserSettings implements Serializable { private UserInfo userInfo; private int refreshingTimeInMillis; private String currentScope; + private String channelName; boolean isInfrastructure; public UserSettings() { super(); } + public UserSettings(UserInfo userInfo, int refreshingTimeInMillis, - String currentScope, boolean isInfrastructure) { + String currentScope, String channelName, boolean isInfrastructure) { super(); this.userInfo = userInfo; this.refreshingTimeInMillis = refreshingTimeInMillis; this.currentScope = currentScope; + this.channelName = channelName; this.isInfrastructure = isInfrastructure; } + public UserInfo getUserInfo() { return userInfo; } @@ -45,6 +49,15 @@ public class UserSettings implements Serializable { public void setInfrastructure(boolean isInfrastructure) { this.isInfrastructure = isInfrastructure; } + + public String getChannelName() { + return channelName; + } + + public void setChannelName(String channelName) { + this.channelName = channelName; + } + @Override public String toString() { return "UserSettings [userInfo=" + userInfo diff --git a/src/main/webapp/conf/settings.properties b/src/main/webapp/conf/settings.properties index c22719c..d8ee383 100644 --- a/src/main/webapp/conf/settings.properties +++ b/src/main/webapp/conf/settings.properties @@ -1,2 +1,3 @@ # Defines the News Feed refreshing time in minutes -REFRESH_TIME = 3 \ No newline at end of file +REFRESH_TIME = 3 +CHANNEL_NAME = Virtual Research Environment \ No newline at end of file