removed ASL Session, ported to gCube Client Context

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@134138 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-11-14 17:03:55 +00:00
parent 2d84816a04
commit d0222dc355
7 changed files with 78 additions and 176 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/share-updates-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/share-updates-2.2.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"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/share-updates-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/share-updates-2.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -39,5 +39,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/share-updates-2.1.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/share-updates-2.2.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -5,7 +5,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <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"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="gcube-widgets-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets"> <dependent-module archiveName="gcube-widgets-2.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/> <property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>

19
pom.xml
View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>share-updates</artifactId> <artifactId>share-updates</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>2.1.0-SNAPSHOT</version> <version>2.2.0-SNAPSHOT</version>
<name>gCube Share Updates Portlet</name> <name>gCube Share Updates Portlet</name>
<description> <description>
gCube Share Updates for exchanging updates with other users of VREs. gCube Share Updates for exchanging updates with other users of VREs.
@ -72,6 +72,7 @@
<dependency> <dependency>
<groupId>org.gcube.common.portal</groupId> <groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId> <artifactId>portal-manager</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.portal</groupId> <groupId>org.gcube.portal</groupId>
@ -83,11 +84,6 @@
<artifactId>notifications-common-library</artifactId> <artifactId>notifications-common-library</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.applicationsupportlayer</groupId> <groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId> <artifactId>aslsocial</artifactId>
@ -130,10 +126,6 @@
<artifactId>storage-manager-wrapper</artifactId> <artifactId>storage-manager-wrapper</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>accesslogger</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.swinglabs</groupId> <groupId>org.swinglabs</groupId>
<artifactId>pdf-renderer</artifactId> <artifactId>pdf-renderer</artifactId>
@ -173,16 +165,9 @@
<artifactId>home-library-jcr</artifactId> <artifactId>home-library-jcr</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<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> <dependency>
<groupId>org.gcube.dvos</groupId> <groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId> <artifactId>usermanagement-core</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,11 +1,8 @@
package org.gcube.portlets.user.shareupdates.client; package org.gcube.portlets.user.shareupdates.client;
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
import org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm; import org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
/** /**
@ -16,15 +13,6 @@ import com.google.gwt.user.client.ui.RootPanel;
public class ShareUpdates implements EntryPoint { public class ShareUpdates implements EntryPoint {
public void onModuleLoad() { public void onModuleLoad() {
// start UI and related stuff
ClientScopeHelper.getService().setScope(Location.getHref(), new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
RootPanel.get("shareUpdateDiv").add(new ShareUpdateForm()); RootPanel.get("shareUpdateDiv").add(new ShareUpdateForm());
} }
@Override
public void onFailure(Throwable caught) {
}
});
}
} }

View File

@ -19,8 +19,6 @@ import java.util.UUID;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import org.apache.commons.validator.routines.UrlValidator; import org.apache.commons.validator.routines.UrlValidator;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager; import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite; import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
@ -34,7 +32,6 @@ import org.gcube.contentmanagement.blobstorage.service.IClient;
import org.gcube.contentmanager.storageclient.wrapper.AccessType; import org.gcube.contentmanager.storageclient.wrapper.AccessType;
import org.gcube.contentmanager.storageclient.wrapper.MemoryType; import org.gcube.contentmanager.storageclient.wrapper.MemoryType;
import org.gcube.contentmanager.storageclient.wrapper.StorageClient; import org.gcube.contentmanager.storageclient.wrapper.StorageClient;
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;
import org.gcube.portal.databook.shared.Attachment; import org.gcube.portal.databook.shared.Attachment;
@ -105,26 +102,6 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
store.closeConnection(); store.closeConnection();
} }
/**
* the current ASsLSession
* @return the session
*/
private ASLSession getASLSession() {
String sessionID = this.getThreadLocalRequest().getSession().getId();
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
if (user == null) {
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
user = getDevelopmentUser();
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
}
return SessionManager.getInstance().getASLSession(sessionID, user);
}
public String getDevelopmentUser() {
String user = TEST_USER;
// user = "costantino.perciante";
return user;
}
/** /**
* *
* @return true if you're running into the portal, false if in development * @return true if you're running into the portal, false if in development
@ -134,12 +111,11 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
UserLocalServiceUtil.getService(); UserLocalServiceUtil.getService();
return true; return true;
} }
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) { catch (Exception ex) {
_log.trace("Development Mode ON"); _log.trace("Development Mode ON");
return false; return false;
} }
} }
/** /**
* Share post that could contain a link preview. * Share post that could contain a link preview.
*/ */
@ -162,25 +138,13 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest()); escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest());
} }
// get session PortalContext context = PortalContext.getConfiguration();
ASLSession session = getASLSession(); GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest());
String username = session.getUsername();
String email = username+"@isti.cnr.it";
String fullName = username+" FULL";
String thumbnailAvatarURL = "images/Avatar_default.png";
boolean withinPortal = isWithinPortal(); String username = currUser.getUsername();
String email = currUser.getEmail();
if (withinPortal && username.compareTo(TEST_USER) != 0) { String fullName = currUser.getFullname();
try { String thumbnailAvatarURL = currUser.getUserAvatarId();
UserInfo user = getUserSettings().getUserInfo();
email = user.getEmailaddress();
fullName = user.getFullName();
thumbnailAvatarURL = user.getAvatarId();
} catch (Exception e) {
e.printStackTrace();
}
}
// get data from the preview of the link // get data from the preview of the link
String linkTitle = preview.getTitle(); String linkTitle = preview.getTitle();
@ -195,7 +159,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//get the VRE scope if single channel post //get the VRE scope if single channel post
String vreScope2Set = ""; String vreScope2Set = "";
if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null) { if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null) {
vreScope2Set = (withinPortal) ? getScopeByGroupId(vreOrgId) : session.getScope(); vreScope2Set = context.getCurrentScope(getThreadLocalRequest());
} }
// build the feed to share (and save on cassandra) // build the feed to share (and save on cassandra)
@ -283,24 +247,13 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest()); escapedFeedText = Utils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers, getThreadLocalRequest());
} }
ASLSession session = getASLSession(); PortalContext context = PortalContext.getConfiguration();
String username = session.getUsername(); GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest());
String email = username+"@isti.cnr.it";
String fullName = username+" FULL";
String thumbnailAvatarURL = "images/Avatar_default.png";
boolean withinPortal = isWithinPortal(); String username = currUser.getUsername();
String email = currUser.getEmail();
if (withinPortal && username.compareTo(TEST_USER) != 0) { String fullName = currUser.getFullname();
try { String thumbnailAvatarURL = currUser.getUserAvatarId();
UserInfo user = getUserSettings().getUserInfo();
email = user.getEmailaddress();
fullName = user.getFullName();
thumbnailAvatarURL = user.getAvatarId();
} catch (Exception e) {
e.printStackTrace();
}
}
// Managing attachments: the first one will use the same fields of a link preview. // Managing attachments: the first one will use the same fields of a link preview.
// If more than one attachments are present, they will be saved as Attachment objects. // If more than one attachments are present, they will be saved as Attachment objects.
@ -366,7 +319,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//get the VRE scope if single channel post //get the VRE scope if single channel post
String vreScope2Set = ""; String vreScope2Set = "";
if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null ) { if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null ) {
vreScope2Set = (withinPortal) ? getScopeByGroupId(vreOrgId) : session.getScope(); vreScope2Set = context.getCurrentScope(getThreadLocalRequest());
} }
Feed toShare = null; Feed toShare = null;
@ -568,21 +521,14 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
@Override @Override
public UserSettings getUserSettings() { public UserSettings getUserSettings() {
try { try {
ASLSession session = getASLSession(); PortalContext context = PortalContext.getConfiguration();
String username = session.getUsername(); GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest());
String username = currUser.getUsername();
_log.debug("getUserSettings() for " + username); _log.debug("getUserSettings() for " + username);
String email = username+"@isti.cnr.it"; String thumbnailURL = currUser.getUserAvatarURL();
String fullName = username+" FULL"; String fullName = currUser.getFullname();
String thumbnailURL = "images/Avatar_default.png"; String email = currUser.getEmail();
if (isWithinPortal() && username.compareTo(TEST_USER) != 0) {
UserManager um = new LiferayUserManager();
GCubeUser user = um.getUserByUsername(username);
thumbnailURL = user.getUserAvatarURL();
fullName = user.getFullname();
email = user.getEmail();
final String profilePageURL = final String profilePageURL =
GCubePortalConstants.PREFIX_GROUP_URL + GCubePortalConstants.PREFIX_GROUP_URL +
PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest())+ PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest())+
@ -594,20 +540,12 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
e.printStackTrace(); e.printStackTrace();
} }
HashMap<String, String> vreNames = getUserVreNames(username); HashMap<String, String> vreNames = getUserVreNames(username);
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmail(), accountURL, true, isAdmin(), vreNames); UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, email, accountURL, true, isAdmin(), vreNames);
UserSettings toReturn = new UserSettings(userInfo, 0, session.getScopeName(), isInfrastructureScope(), isNotificationViaEmailEnabled(session)); UserSettings toReturn = new UserSettings(userInfo, 0, context.getCurrentScope(getThreadLocalRequest()), isInfrastructureScope(), isNotificationViaEmailEnabled());
_log.debug("getUserSettings() return " + toReturn); _log.debug("getUserSettings() return " + toReturn);
return toReturn; return toReturn;
}
else {
_log.info("Returning test USER = " + session.getUsername());
HashMap<String, String> fakeVreNames = new HashMap<String, String>();
fakeVreNames.put("/gcube/devsec/devVRE","devVRE");
//fakeVreNames.put("/gcube/devNext/NexNext","NexNext");
UserInfo user = new UserInfo(session.getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
return new UserSettings(user, 0, session.getScopeName(), false, true);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -615,10 +553,12 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
return new UserSettings(); return new UserSettings();
} }
private boolean isNotificationViaEmailEnabled(ASLSession session) throws UserManagementSystemException, GroupRetrievalFault { private boolean isNotificationViaEmailEnabled() throws UserManagementSystemException, GroupRetrievalFault {
if (! isWithinPortal())
return false;
PortalContext context = PortalContext.getConfiguration();
GroupManager gm = new LiferayGroupManager(); GroupManager gm = new LiferayGroupManager();
GCubeGroup group = gm.getGroup(session.getGroupId()); return (Boolean) gm.readCustomAttr(context.getCurrentGroupId(getThreadLocalRequest()), CustomAttributeKeys.POST_NOTIFICATION.getKeyName());
return (Boolean) gm.readCustomAttr(group.getGroupId(), CustomAttributeKeys.POST_NOTIFICATION.getKeyName());
} }
/** /**
* tell if the user is a portal administrator or not * tell if the user is a portal administrator or not
@ -631,8 +571,9 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
if (! isWithinPortal()) if (! isWithinPortal())
return false; return false;
try { try {
GCubeUser curUser = new LiferayUserManager().getUserByUsername(getASLSession().getUsername()); PortalContext context = PortalContext.getConfiguration();
return new LiferayRoleManager().isAdmin(curUser.getUserId()); GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest());
return new LiferayRoleManager().isAdmin(currUser.getUserId());
} }
catch (Exception e) { catch (Exception e) {
_log.error("Could not check if the user is an Administrator, returning false"); _log.error("Could not check if the user is an Administrator, returning false");
@ -644,13 +585,16 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
*/ */
@Override @Override
public LinkPreview checkUploadedFile(String fileName, String fileabsolutePathOnServer) { public LinkPreview checkUploadedFile(String fileName, String fileabsolutePathOnServer) {
PortalContext context = PortalContext.getConfiguration();
LinkPreview toReturn = null; LinkPreview toReturn = null;
String randomUploadFolderName = UUID.randomUUID().toString(); String randomUploadFolderName = UUID.randomUUID().toString();
String remoteFilePath = UPLOAD_DIR + "/" + randomUploadFolderName + "/" + fileName; String remoteFilePath = UPLOAD_DIR + "/" + randomUploadFolderName + "/" + fileName;
//get the Storage Client //get the Storage Client
String currScope = ScopeProvider.instance.get(); String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(getASLSession().getScope()); ScopeProvider.instance.set(context.getCurrentScope(getThreadLocalRequest()));
IClient storageClient = new StorageClient(STORAGE_OWNER, AccessType.SHARED, MemoryType.PERSISTENT).getClient(); IClient storageClient = new StorageClient(STORAGE_OWNER, AccessType.SHARED, MemoryType.PERSISTENT).getClient();
ScopeProvider.instance.set(currScope); ScopeProvider.instance.set(currScope);
@ -814,9 +758,11 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
* @return the id as key and the names as value of the vre a user is subscribed to * @return the id as key and the names as value of the vre a user is subscribed to
*/ */
private HashMap<String, String> getUserVreNames(String username) { private HashMap<String, String> getUserVreNames(String username) {
PortalContext context = PortalContext.getConfiguration();
String groupName = context.getCurrentGroupName(getThreadLocalRequest());
HashMap<String, String> toReturn = new HashMap<String, String>(); HashMap<String, String> toReturn = new HashMap<String, String>();
for (GCubeGroup vre : getUserVREs(username)) { for (GCubeGroup vre : getUserVREs(username)) {
if (vre.getGroupName().compareTo(getASLSession().getGroupName())==0) if (vre.getGroupName().compareTo(groupName)==0)
toReturn.put(vre.getGroupId()+"", vre.getGroupName()); toReturn.put(vre.getGroupId()+"", vre.getGroupName());
} }
return toReturn; return toReturn;
@ -859,7 +805,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
* @return <code>true</code> if it is, <code>false</code> otherwise. * @return <code>true</code> if it is, <code>false</code> otherwise.
*/ */
private boolean isInfrastructureScope() { private boolean isInfrastructureScope() {
ScopeBean scope = new ScopeBean(getASLSession().getScope()); PortalContext context = PortalContext.getConfiguration();
ScopeBean scope = new ScopeBean(context.getCurrentScope(getThreadLocalRequest()));
return scope.is(Type.INFRASTRUCTURE); return scope.is(Type.INFRASTRUCTURE);
} }
@ -886,19 +833,24 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
@Override @Override
public ArrayList<ItemBean> getPortalItemBeans() { public ArrayList<ItemBean> getPortalItemBeans() {
ASLSession session = getASLSession(); PortalContext context = PortalContext.getConfiguration();
context.getCurrentScope(getThreadLocalRequest());
String scope = context.getCurrentScope(getThreadLocalRequest());
String username = context.getCurrentUser(getThreadLocalRequest()).getUsername();
boolean withinPortal = false; boolean withinPortal = false;
if (isWithinPortal() && session.getUsername().compareTo(TEST_USER) != 0) { if (isWithinPortal() && username.compareTo(TEST_USER) != 0) {
withinPortal = true; withinPortal = true;
} }
// retrieve user and group beans // retrieve user and group beans
return Utils.getDisplayableItemBeans(session.getScope(), session.getUsername(), withinPortal); return Utils.getDisplayableItemBeans(scope, username, withinPortal);
} }
@Override @Override
public ArrayList<ItemBean> getHashtags() { public ArrayList<ItemBean> getHashtags() {
ASLSession session = getASLSession(); PortalContext context = PortalContext.getConfiguration();
String scope = session.getScope(); context.getCurrentScope(getThreadLocalRequest());
String scope = context.getCurrentScope(getThreadLocalRequest());
_log.error("getting hashtags for " + scope); _log.error("getting hashtags for " + scope);
Map<String, Integer> map = store.getVREHashtagsWithOccurrence(scope); Map<String, Integer> map = store.getVREHashtagsWithOccurrence(scope);
ArrayList<HashTagAndOccurrence> toSort = new ArrayList<HashTagAndOccurrence>(); ArrayList<HashTagAndOccurrence> toSort = new ArrayList<HashTagAndOccurrence>();

View File

@ -1,27 +1,23 @@
package org.gcube.portlets.user.shareupdates.server.portlet; package org.gcube.portlets.user.shareupdates.server.portlet;
import javax.portlet.GenericPortlet;
import javax.portlet.ActionRequest;
import javax.portlet.RenderRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
import java.io.IOException; import java.io.IOException;
import javax.portlet.PortletRequestDispatcher;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
/** /**
* WfTemplatesPortlet Portlet Class
* *
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it * @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version May 2011 (0.1)
*/ */
public class ShareUpdatesPortlet extends GenericPortlet { public class ShareUpdatesPortlet extends GenericPortlet {
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.setContentType("text/html"); response.setContentType("text/html");
ScopeHelper.setContext(request);
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/ShareUpdates_view.jsp"); PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/ShareUpdates_view.jsp");
dispatcher.include(request, response); dispatcher.include(request, response);
} }

View File

@ -1,19 +0,0 @@
package org.gcube.portlets.user.shareupdates.test;
import static org.junit.Assert.*;
import org.gcube.portlets.user.shareupdates.server.ShareUpdateServiceImpl;
import org.junit.Test;
public class TestForDeploy {
@Test
public void testUserIsTestUser() {
ShareUpdateServiceImpl serviceImpl = new ShareUpdateServiceImpl();
String username = serviceImpl.getDevelopmentUser();
System.out.println("username for deploy is: " + username);
assertTrue(username.compareTo(ShareUpdateServiceImpl.TEST_USER) == 0);
System.out.println("Test OK!");
}
}