ported to liferay 6.2

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/social-profile@129565 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-06-28 15:36:13 +00:00
parent b8d8bffea1
commit a3f07223b4
6 changed files with 66 additions and 36 deletions

View File

@ -4,6 +4,12 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="session-checker-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="wsmail-widget-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/wsmail-widget/wsmail-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="social-profile"/>
</wb-module>

19
pom.xml
View File

@ -72,10 +72,13 @@
<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>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>session-checker</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
@ -114,12 +117,12 @@
<artifactId>gwt-jsonmaker</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.portlets.widgets</groupId> -->
<!-- <artifactId>wsmail-widget</artifactId> -->
<!-- <version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<!-- <scope>compile</scope> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>wsmail-widget</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.socialprofile.client.SocialProfile;
import org.gcube.portlets.user.socialprofile.client.SocialService;
import org.gcube.portlets.user.socialprofile.client.SocialServiceAsync;
import org.gcube.portlets.user.socialprofile.shared.UserContext;
import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
@ -287,8 +288,7 @@ public class DisplayProfile extends Composite {
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onSuccess() {
//TODO:
// new MailForm(listToLogin);
new MailForm(listToLogin);
}
public void onFailure(Throwable reason) {
Window.alert("Could not load this component: " + reason.getMessage());

View File

@ -43,6 +43,7 @@ import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
import org.gcube.vomanagement.usermanagement.model.CustomAttributeKeys;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.json.simple.parser.ContainerFactory;
import org.json.simple.parser.JSONParser;
@ -234,10 +235,9 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
@Override
public Boolean saveHeadline(String newHeadline) {
com.liferay.portal.model.User user;
try {
//TODO:
return false;
UserManager um = new LiferayUserManager();
return um.updateJobTitle(um.getUserId(getASLSession().getUsername()), newHeadline);
} catch (Exception e) {
e.printStackTrace();
return false;
@ -246,10 +246,11 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
}
@Override
public Boolean saveIsti(String institution) {
com.liferay.portal.model.User user;
//try save the location/industry
try {
//TODO:
return false;
UserManager um = new LiferayUserManager();
um.saveCustomAttr(um.getUserId(getASLSession().getUsername()), CustomAttributeKeys.USER_LOCATION_INDUSTRY.getKeyName(), institution);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
@ -444,10 +445,12 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
user.setJobTitle(escapeHtml(checkedHeadline));
}
//location and industry
if (location.compareTo("") != 0 && industry.compareTo("") != 0)
user.setOpenId(escapeHtml(location + " | " + industry));
String locationOrIndustry = "";
if (location.compareTo("") != 0 && industry.compareTo("") != 0) {
locationOrIndustry = escapeHtml(location + " | " + industry);
}
else if (location.compareTo("") != 0 || industry.compareTo("") != 0)
user.setOpenId(escapeHtml(location + industry));
locationOrIndustry = escapeHtml(location + industry);
//summary
if (summary.compareTo("") != 0)
user.setComments(escapeHtml(summary));
@ -468,6 +471,9 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
UserLocalServiceUtil.updatePortrait(user.getUserId(), pictureData);
}
}
//update the location/industry
new LiferayUserManager().saveCustomAttr(user.getUserId(), CustomAttributeKeys.USER_LOCATION_INDUSTRY.getKeyName(), locationOrIndustry);
if (toReturn)
return publicProfileURL;
else return null;

View File

@ -7,7 +7,8 @@
<!-- Other module inherits -->
<!-- inherits GCUBE Widgets -->
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<!-- <inherits name='org.gcube.portlets.widgets.wsmail.WsMail_Widget' /> -->
<inherits name='org.gcube.portlets.widgets.wsmail.WsMail_Widget' />
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />

View File

@ -15,23 +15,37 @@
<url-pattern>/socialprofile/socialService</url-pattern>
</servlet-mapping>
<!-- <servlet> -->
<!-- <servlet-name>mailWisdgetServlet</servlet-name> -->
<!-- <servlet-class>org.gcube.portlets.widgets.wsmail.server.WsMailServiceImpl</servlet-class> -->
<!-- </servlet> -->
<servlet>
<servlet-name>mailWisdgetServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.wsmail.server.WsMailServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mailWisdgetServlet</servlet-name>
<url-pattern>/socialprofile/mailWisdgetServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>workspaceExplorer</servlet-name>
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>workspaceExplorer</servlet-name>
<url-pattern>/socialprofile/WorkspaceExplorerService</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>checkServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.sessionchecker.server.SessionCheckerServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>checkServlet</servlet-name>
<url-pattern>/socialprofile/checksession</url-pattern>
</servlet-mapping>
<!-- <servlet-mapping> -->
<!-- <servlet-name>mailWisdgetServlet</servlet-name> -->
<!-- <url-pattern>/socialprofile/mailWisdgetServlet</url-pattern> -->
<!-- </servlet-mapping> -->
<!-- <servlet> -->
<!-- <servlet-name>workspaceServiceImpl</servlet-name> -->
<!-- <servlet-class>org.gcube.portlets.widgets.lighttree.server.WorkspaceServiceImpl</servlet-class> -->
<!-- </servlet> -->
<!-- <servlet-mapping> -->
<!-- <servlet-name>workspaceServiceImpl</servlet-name> -->
<!-- <url-pattern>/socialprofile/WorkspaceLightService</url-pattern> -->
<!-- </servlet-mapping> -->
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>SocialProfile.html</welcome-file>