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"?>
|
||||
<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>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -30,5 +30,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</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>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="jst.web" version="2.5"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
<installed facet="liferay.portlet" version="6.0"/>
|
||||
<installed facet="jst.web" version="3.0"/>
|
||||
</faceted-project>
|
||||
|
|
12
pom.xml
12
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>notifications</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.4.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>gCube Notifications Portlet</name>
|
||||
|
||||
<properties>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
|
||||
<liferay.version>6.2.5</liferay.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
@ -64,6 +64,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
|
@ -78,6 +79,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -98,9 +100,15 @@
|
|||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>accesslogger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<version>${liferay.version}</version>
|
||||
<scope>provided</scope>
|
||||
</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.SessionManager;
|
||||
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
||||
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.shared.NotificationConstants;
|
||||
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.LoggerFactory;
|
||||
|
||||
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.theme.ThemeDisplay;
|
||||
|
||||
/**
|
||||
* The server side implementation of the RPC service.
|
||||
|
@ -51,10 +49,6 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
|
|||
* The store interface
|
||||
*/
|
||||
private DatabookStore store;
|
||||
/**
|
||||
* used for debugging in eclipse
|
||||
*/
|
||||
private boolean withinPortal = false;
|
||||
/**
|
||||
* connect to cassandra at startup
|
||||
*/
|
||||
|
@ -76,14 +70,23 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
|
|||
if (user == null) {
|
||||
user = getDevelopmentUser();
|
||||
_log.warn("USER IS NULL setting "+user+" and Running OUTSIDE PORTAL");
|
||||
withinPortal = false;
|
||||
}
|
||||
else {
|
||||
withinPortal = true;
|
||||
}
|
||||
System.out.println("SessionID = " + sessionID);
|
||||
_log.debug("SessionID = " + sessionID);
|
||||
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
|
||||
* @return
|
||||
|
@ -100,14 +103,14 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
|
|||
String fullName = username+" FULL";
|
||||
String thumbnailURL = "images/Avatar_default.png";
|
||||
|
||||
if (withinPortal) {
|
||||
UserModel user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
|
||||
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
|
||||
fullName = user.getFirstName() + " " + user.getLastName();
|
||||
email = user.getEmailAddress();
|
||||
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
||||
String accountURL = themeDisplay.getURLMyAccount().toString();
|
||||
UserInfo toReturn = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, false, null);
|
||||
if (isWithinPortal()) {
|
||||
GCubeUser user = new LiferayUserManager().getUserByUsername(username);
|
||||
|
||||
thumbnailURL = user.getUserAvatarURL();
|
||||
fullName = user.getFullname();
|
||||
email = user.getEmail();
|
||||
String accountURL = "TODO";//TODO:
|
||||
UserInfo toReturn = new UserInfo(username, fullName, thumbnailURL, email, accountURL, true, false, null);
|
||||
return toReturn;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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>
|
||||
<category name="gCube Social Apps">
|
||||
|
|
|
@ -4,6 +4,6 @@ module-incremental-version=1
|
|||
tags=
|
||||
short-description=
|
||||
change-log=
|
||||
page-url=http://www.d4science.org
|
||||
author=D4Science Org.
|
||||
page-url=http://www.gcube.system.org
|
||||
author=Massimiliano Assante
|
||||
licenses=EUPL
|
|
@ -1,5 +1,5 @@
|
|||
<?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>
|
||||
<portlet>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?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
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
|
|
Loading…
Reference in New Issue