ported to liferay 6.2
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/notifications@126592 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ee675b8311
commit
9e75dca295
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/notifications-1.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/notifications-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
@ -30,5 +30,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/notifications-1.4.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/notifications-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<fixed facet="wst.jsdt.web"/>
|
<fixed facet="wst.jsdt.web"/>
|
||||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
<installed facet="jst.web" version="2.5"/>
|
|
||||||
<installed facet="java" version="1.7"/>
|
<installed facet="java" version="1.7"/>
|
||||||
<installed facet="liferay.portlet" version="6.0"/>
|
<installed facet="liferay.portlet" version="6.0"/>
|
||||||
|
<installed facet="jst.web" version="3.0"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
12
pom.xml
12
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>notifications</artifactId>
|
<artifactId>notifications</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>1.4.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<name>gCube Notifications Portlet</name>
|
<name>gCube Notifications Portlet</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
<liferay.version>6.2.5</liferay.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -64,6 +64,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>gcube-widgets</artifactId>
|
<artifactId>gcube-widgets</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
@ -78,6 +79,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>custom-portal-handler</artifactId>
|
<artifactId>custom-portal-handler</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -98,9 +100,15 @@
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
<artifactId>accesslogger</artifactId>
|
<artifactId>accesslogger</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.dvos</groupId>
|
||||||
|
<artifactId>usermanagement-core</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.liferay.portal</groupId>
|
<groupId>com.liferay.portal</groupId>
|
||||||
<artifactId>portal-service</artifactId>
|
<artifactId>portal-service</artifactId>
|
||||||
|
<version>${liferay.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -17,7 +17,6 @@ import javax.servlet.ServletContext;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
||||||
import org.gcube.portal.databook.server.DatabookStore;
|
import org.gcube.portal.databook.server.DatabookStore;
|
||||||
|
@ -28,14 +27,13 @@ import org.gcube.portal.databook.shared.UserInfo;
|
||||||
import org.gcube.portlets.user.notifications.client.NotificationsService;
|
import org.gcube.portlets.user.notifications.client.NotificationsService;
|
||||||
import org.gcube.portlets.user.notifications.shared.NotificationConstants;
|
import org.gcube.portlets.user.notifications.shared.NotificationConstants;
|
||||||
import org.gcube.portlets.user.notifications.shared.NotificationPreference;
|
import org.gcube.portlets.user.notifications.shared.NotificationPreference;
|
||||||
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
import com.liferay.portal.kernel.util.WebKeys;
|
|
||||||
import com.liferay.portal.model.UserModel;
|
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
import com.liferay.portal.theme.ThemeDisplay;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
@ -51,10 +49,6 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
|
||||||
* The store interface
|
* The store interface
|
||||||
*/
|
*/
|
||||||
private DatabookStore store;
|
private DatabookStore store;
|
||||||
/**
|
|
||||||
* used for debugging in eclipse
|
|
||||||
*/
|
|
||||||
private boolean withinPortal = false;
|
|
||||||
/**
|
/**
|
||||||
* connect to cassandra at startup
|
* connect to cassandra at startup
|
||||||
*/
|
*/
|
||||||
|
@ -76,14 +70,23 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
user = getDevelopmentUser();
|
user = getDevelopmentUser();
|
||||||
_log.warn("USER IS NULL setting "+user+" and Running OUTSIDE PORTAL");
|
_log.warn("USER IS NULL setting "+user+" and Running OUTSIDE PORTAL");
|
||||||
withinPortal = false;
|
|
||||||
}
|
}
|
||||||
else {
|
_log.debug("SessionID = " + sessionID);
|
||||||
withinPortal = true;
|
|
||||||
}
|
|
||||||
System.out.println("SessionID = " + sessionID);
|
|
||||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return true if you're running into the portal, false if in development
|
||||||
|
*/
|
||||||
|
private boolean isWithinPortal() {
|
||||||
|
try {
|
||||||
|
UserLocalServiceUtil.getService();
|
||||||
|
return true;
|
||||||
|
} catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
|
||||||
|
_log.trace("Development Mode ON");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* set the user in development mode
|
* set the user in development mode
|
||||||
* @return
|
* @return
|
||||||
|
@ -100,14 +103,14 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
|
||||||
String fullName = username+" FULL";
|
String fullName = username+" FULL";
|
||||||
String thumbnailURL = "images/Avatar_default.png";
|
String thumbnailURL = "images/Avatar_default.png";
|
||||||
|
|
||||||
if (withinPortal) {
|
if (isWithinPortal()) {
|
||||||
UserModel user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
|
GCubeUser user = new LiferayUserManager().getUserByUsername(username);
|
||||||
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
|
|
||||||
fullName = user.getFirstName() + " " + user.getLastName();
|
thumbnailURL = user.getUserAvatarURL();
|
||||||
email = user.getEmailAddress();
|
fullName = user.getFullname();
|
||||||
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
email = user.getEmail();
|
||||||
String accountURL = themeDisplay.getURLMyAccount().toString();
|
String accountURL = "TODO";//TODO:
|
||||||
UserInfo toReturn = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, false, null);
|
UserInfo toReturn = new UserInfo(username, fullName, thumbnailURL, email, accountURL, true, false, null);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN" "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd">
|
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
|
||||||
|
|
||||||
<display>
|
<display>
|
||||||
<category name="gCube Social Apps">
|
<category name="gCube Social Apps">
|
||||||
|
|
|
@ -4,6 +4,6 @@ module-incremental-version=1
|
||||||
tags=
|
tags=
|
||||||
short-description=
|
short-description=
|
||||||
change-log=
|
change-log=
|
||||||
page-url=http://www.d4science.org
|
page-url=http://www.gcube.system.org
|
||||||
author=D4Science Org.
|
author=Massimiliano Assante
|
||||||
licenses=EUPL
|
licenses=EUPL
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">
|
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
|
||||||
|
|
||||||
<liferay-portlet-app>
|
<liferay-portlet-app>
|
||||||
<portlet>
|
<portlet>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||||
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
|
version="3.0">
|
||||||
|
|
||||||
|
|
||||||
<!-- Servlets -->
|
<!-- Servlets -->
|
||||||
<servlet>
|
<servlet>
|
||||||
|
|
Loading…
Reference in New Issue