ref 13226:StorageHub - Update workspace-sharing-widget to SH

https://support.d4science.org/issues/13226

Updated to StorageHub

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@177242 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-02-22 14:02:32 +00:00
parent 6cb6d82820
commit 22074fee73
18 changed files with 528 additions and 536 deletions

View File

@ -27,16 +27,12 @@ public class ExtendedInfoContactModel extends InfoContactModel {
super(id, login, fullName, isGroup);
}
/**
* @return use this client side
*/
public void setIcon() {
set(ICON, getIcon());
}
/**
* @return use this client side
*/
public Image getIcon() {
if (!this.isGroup()) // NOT IS GROUP

View File

@ -12,7 +12,6 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
*/
public class FileTrashedModel extends FileGridModel {
/**
*
*/
@ -22,34 +21,18 @@ public class FileTrashedModel extends FileGridModel {
private Date deleteDate;
private InfoContactModel deletedBy;
public static enum STOREINFO {ORIGINALPATH, DELETEDATE, DELETEUSER}
public static enum STOREINFO {
ORIGINALPATH, DELETEDATE, DELETEUSER
}
public FileTrashedModel() {
}
/**
*
* @param identifier
* @param name
* @param path
* @param creationDate
* @param parent
* @param size
* @param isDirectory
* @param isShared
*/
public FileTrashedModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared) {
public FileTrashedModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size,
boolean isDirectory, boolean isShared) {
super(identifier, name, path, creationDate, parent, size, isDirectory, isShared);
}
/**
* @param orginalPath
* @param deleteDate
* @param deleteUser
*/
public FileTrashedModel(String orginalPath, Date deleteDate, InfoContactModel deleteUser) {
super();
this.orginalPath = orginalPath;
@ -57,18 +40,8 @@ public class FileTrashedModel extends FileGridModel {
this.deletedBy = deleteUser;
}
/**
*
* @param identifier
* @param name
* @param creationDate
* @param parent
* @param size
* @param isDirectory
* @param isShared
*/
public FileTrashedModel(String identifier, String name, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared) {
public FileTrashedModel(String identifier, String name, Date creationDate, FileModel parent, long size,
boolean isDirectory, boolean isShared) {
super(identifier, name, creationDate, parent, size, isDirectory, isShared);
}
@ -99,7 +72,6 @@ public class FileTrashedModel extends FileGridModel {
set(STOREINFO.DELETEUSER.toString(), deleteUser.getName());
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();

View File

@ -29,10 +29,7 @@ public class GcubeVRE extends BaseModelData implements IsSerializable{
}
/**
* @param vreName
* @param vreScope
*/
public GcubeVRE(String vreName, String vreScope) {
super();

View File

@ -15,27 +15,38 @@ import com.extjs.gxt.ui.client.data.BaseModelData;
*/
public class MessageModel extends BaseModelData implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public MessageModel() {}
public MessageModel() {
}
/**
* USED IN OPEN MESSAGE
*
* @param id
* id
* @param subject
* subject
* @param sender
* sender
* @param date
* date
* @param text
* text
* @param attachs
* attachs
* @param listContactsToString
* contacts
* @param messageType
* message type
* @param isRead
* is read
*/
public MessageModel(String id, String subject, InfoContactModel sender, Date date, String text, List<FileModel> attachs, List<String> listContactsToString, String messageType, boolean isRead) {
public MessageModel(String id, String subject, InfoContactModel sender, Date date, String text,
List<FileModel> attachs, List<String> listContactsToString, String messageType, boolean isRead) {
this(id, subject, sender, date, attachs.size(), isRead, messageType);
setListContactsToString(listContactsToString);
setListAttachments(attachs);
@ -43,11 +54,26 @@ public class MessageModel extends BaseModelData implements Serializable {
}
/**
* BASIC CONSTRUCTOR
*
* @param id
* id
* @param subject
* subject
* @param sender
* sender
* @param date
* date
* @param numAttachs
* attachs num
* @param isRead
* is read
* @param messageType
* message type
*/
public MessageModel(String id, String subject, InfoContactModel sender, Date date, int numAttachs, boolean isRead, String messageType) {
public MessageModel(String id, String subject, InfoContactModel sender, Date date, int numAttachs, boolean isRead,
String messageType) {
setId(id);
setSubject(subject);
setFromContact(sender);
@ -58,18 +84,27 @@ public class MessageModel extends BaseModelData implements Serializable {
setMessageType(messageType);
}
/**
* USED TO VIEW MESSAGE IN GRID
*
*
* @param id
* id
* @param subject
* subject
* @param sender
* sender
* @param date
* date
* @param attachsNames
* attachs names
* @param messageType
* message type
* @param isRead
* is read
*/
public MessageModel(String id, String subject, InfoContactModel sender, Date date, List<String> attachsNames, String messageType, boolean isRead) {
public MessageModel(String id, String subject, InfoContactModel sender, Date date, List<String> attachsNames,
String messageType, boolean isRead) {
setId(id);
setSubject(subject);
setFromContact(sender);
@ -78,22 +113,21 @@ public class MessageModel extends BaseModelData implements Serializable {
setNumAttachments(attachsNames.size());
setMessageType(messageType);
setRead("" + isRead);
// System.out.println("##################IN CONSTRUCTROR Attach size: " + attachsNames.size());
// System.out.println("##################IN CONSTRUCTROR Attach size: "
// + attachsNames.size());
setAttachmentsNames(attachsNames);
// System.out.println("##########START MESSAGE: " + id);
//
// for(String mess: attachsNames){
// System.out.println("##################IN CONSTRUCTROR Attach: " + mess);
// System.out.println("##################IN CONSTRUCTROR Attach: " +
// mess);
// }
//
// System.out.println("##########END MESSAGE: " + id);
setAttachmentsNamesView(attachsNames);
}
/**
* Set string with first attach name and the numbers of attachs
* @param attachsNames
*/
private void setAttachmentsNamesView(List<String> attachsNames) {
if (attachsNames.size() == 0) {
set(ConstantsExplorer.ATTACHS, "");
@ -103,7 +137,6 @@ public class MessageModel extends BaseModelData implements Serializable {
set(ConstantsExplorer.ATTACHS, attachsNames.get(0) + " [+" + attachsNames.size() + "]");
}
private void setMessageType(String messageType) {
set(ConstantsExplorer.MESSAGETYPE, messageType);
}
@ -116,7 +149,6 @@ public class MessageModel extends BaseModelData implements Serializable {
set(ConstantsExplorer.LISTCONTACTSTOSTRING, listContactsToString);
}
private void setRead(String isRead) {
set(ConstantsExplorer.ISREAD, isRead);
@ -150,7 +182,6 @@ public class MessageModel extends BaseModelData implements Serializable {
set(ConstantsExplorer.TEXTMESS, text);
}
private void setFromContact(InfoContactModel contact) {
set(ConstantsExplorer.FROM, contact);
}
@ -192,10 +223,6 @@ public class MessageModel extends BaseModelData implements Serializable {
}
/**
* used in grid
* @return
*/
public String getAttachmentsNamesView() {
return get(ConstantsExplorer.ATTACHS);
}

View File

@ -2,7 +2,8 @@ package org.gcube.portlets.user.workspace.client.util;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it May 8, 2014
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* May 8, 2014
*
*/
public class GroupNameUtilSeparator {
@ -24,6 +25,7 @@ public class GroupNameUtilSeparator {
* name
* @param separatorStartIndex
* start
* @return sub sequence
* @throws Exception
* error
*/
@ -58,7 +60,6 @@ public class GroupNameUtilSeparator {
return displayName;
}
public static void main(String[] args) {
GroupNameUtilSeparator filter = new GroupNameUtilSeparator("/");

View File

@ -132,15 +132,16 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
/**
* Gets the workspace.
*
* @return the workspace
*
* @return Workspace
* @throws InternalErrorException
* the internal error exception
* @throws InternalErrorException
* the internal error exception
* Internal error
* @throws HomeNotFoundException
* the home not found exception
* Home not found error
* @throws WorkspaceFolderNotFoundException
* the workspace folder not found exception
* Folder not found error
* @throws org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException
* StorageHub Internal error
*/
protected Workspace getWorkspace()
throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException,
@ -1168,8 +1169,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
}
}
/** Gets the list parents by item identifier.
/**
* Gets the list parents by item identifier.
*
* @param itemIdentifier
* the item identifier
@ -2653,7 +2654,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
org.gcube.common.storagehub.model.items.FolderItem.class);
for (org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem workspaceItem : children) {
workspaceLogger.trace("The ITEM: "+workspaceItem.getName() + ", is shared: "+workspaceItem.isShared() + ", is folder: "+workspaceItem.isFolder() +" the id: "+workspaceItem.getId());
workspaceLogger
.trace("The ITEM: " + workspaceItem.getName() + ", is shared: " + workspaceItem.isShared()
+ ", is folder: " + workspaceItem.isFolder() + " the id: " + workspaceItem.getId());
}
StorageHubToWorkpaceConverter converter = getStorageHubToWorkpaceConverter();

View File

@ -147,7 +147,6 @@ public class ObjectStorageHubToWorkpaceMapper {
*
* @param wrappedItem the wrapped item
* @param parentFolderModel the parent folder model
* @param isParentShared the is parent shared
* @param loggedUser the logged user
* @return the file grid model
* @throws InternalErrorException the internal error exception

View File

@ -142,7 +142,7 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* Sets the synched thredds state for.
*
* @param fileModel the file model
* @param wrappedItem
* @param wrappedItem item
* @return the file model
*/
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {

View File

@ -12,7 +12,7 @@ import org.apache.log4j.Logger;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* @Apr 26, 2013
* Apr 26, 2013
*
*/
public class HttpRequestUtil {

View File

@ -21,7 +21,6 @@ import javax.imageio.ImageIO;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
/**
* The Class ThumbnailGenerator.
*
@ -30,42 +29,43 @@ import org.apache.commons.io.IOUtils;
*/
public class ThumbnailGenerator {
/**
* Creates the thumbnail.
*
* @param originalFile the original file
* @param thumbWidth the thumb width
* @param thumbHeight the thumb height
* @param originalFile
* the original file
* @param thumbWidth
* the thumb width
* @param thumbHeight
* the thumb height
* @return the input stream
* @throws Exception the exception
* @throws Exception
* the exception
*/
public static InputStream generateThumbnail(
String originalFile, int thumbWidth,
int thumbHeight)
throws Exception {
public static InputStream generateThumbnail(String originalFile, int thumbWidth, int thumbHeight) throws Exception {
String baseName = FilenameUtils.getBaseName(originalFile);
Image image = ImageIO.read(new File(originalFile));
return createThumb(image, baseName, thumbWidth, thumbHeight);
}
/**
* Generate thumbnail.
*
* @param originalFile the original file
* @param fileName the file name
* @param thumbWidth the thumb width
* @param thumbHeight the thumb height
* @param originalFile
* the original file
* @param fileName
* the file name
* @param thumbWidth
* the thumb width
* @param thumbHeight
* the thumb height
* @return the input stream
* @throws Exception the exception
* @throws Exception
* the exception
*/
public static InputStream generateThumbnail(
InputStream originalFile, String fileName, int thumbWidth,
int thumbHeight)
throws Exception {
public static InputStream generateThumbnail(InputStream originalFile, String fileName, int thumbWidth,
int thumbHeight) throws Exception {
Image image = ImageIO.read(originalFile);
return createThumb(image, fileName, thumbWidth, thumbHeight);
}
@ -73,30 +73,33 @@ public class ThumbnailGenerator {
/**
* Creates the thumb.
*
* @param image the image
* @param imageName the image name
* @param thumbWidth the thumb width
* @param thumbHeight the thumb height
* @param image
* the image
* @param imageName
* the image name
* @param thumbWidth
* the thumb width
* @param thumbHeight
* the thumb height
* @return the input stream
* @throws IOException
* error
*/
public static InputStream createThumb(Image image, String imageName, int thumbWidth,
int thumbHeight) throws IOException{
public static InputStream createThumb(Image image, String imageName, int thumbWidth, int thumbHeight)
throws IOException {
double thumbRatio = (double) thumbWidth / (double) thumbHeight;
int imageWidth = image.getWidth(null);
int imageHeight = image.getHeight(null);
double imageRatio = (double) imageWidth / (double) imageHeight;
if (thumbRatio < imageRatio) {
thumbHeight = (int) (thumbWidth / imageRatio);
}
else {
} else {
thumbWidth = (int) (thumbHeight * imageRatio);
}
if (imageWidth < thumbWidth && imageHeight < thumbHeight) {
thumbWidth = imageWidth;
thumbHeight = imageHeight;
}
else if (imageWidth < thumbWidth)
} else if (imageWidth < thumbWidth)
thumbWidth = imageWidth;
else if (imageHeight < thumbHeight)
thumbHeight = imageHeight;
@ -107,9 +110,7 @@ public class ThumbnailGenerator {
graphics2D.setBackground(Color.WHITE);
graphics2D.setPaint(Color.WHITE);
graphics2D.fillRect(0, 0, thumbWidth, thumbHeight);
graphics2D.setRenderingHint(
RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);
String ext = FilenameUtils.getExtension(imageName);
@ -123,11 +124,15 @@ public class ThumbnailGenerator {
/**
* Stream2file.
*
* @param in the in
* @param filename the filename
* @param extension the extension
* @param in
* the in
* @param filename
* the filename
* @param extension
* the extension
* @return the file
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static File stream2file(InputStream in, String filename, String extension) throws IOException {
@ -148,7 +153,8 @@ public class ThumbnailGenerator {
// */
// public static void main(String[] args) throws Exception {
//
// String originalFile = "/home/francesco-mangiacrapa/Pictures/Screenshot from 2016-04-11 10:20:43.png";
// String originalFile = "/home/francesco-mangiacrapa/Pictures/Screenshot
// from 2016-04-11 10:20:43.png";
// int thumbWidth = 200;
// int thumbHeight = 200;
//

View File

@ -34,7 +34,6 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
* The Class WsUtil.
*
@ -43,9 +42,6 @@ import com.liferay.portal.service.UserLocalServiceUtil;
*/
public class WsUtil {
/**
*
*/
public static final String FOLDER_PUBLISHING_ON_THREDDS = "FolderPublishingOnThredds";
protected static Logger logger = Logger.getLogger(WsUtil.class);
@ -56,7 +52,8 @@ public class WsUtil {
public static final String WORKSPACEBUILDER_ATTRIBUTE = "WORKSPACEBUILDER";
public static final String NOTIFICATION_MANAGER = "NOTIFICATION_MANAGER";
public static final String NOTIFICATION_PRODUCER = "NOTIFICATION_PRODUCER";
//public static final String NOTIFICATION_MANAGER_TO_STORAGEHUB = "NOTIFICATION_MANAGER_TO_STORAGEHUB";
// public static final String NOTIFICATION_MANAGER_TO_STORAGEHUB =
// "NOTIFICATION_MANAGER_TO_STORAGEHUB";
public static final String NOTIFICATION_PRODUCER_TO_STORAGEHUB = "NOTIFICATION_PRODUCER_TO_STORAGEHUB";
public static final String WS_RUN_IN_TEST_MODE = "WS_RUN_IN_TEST_MODE";
public static final String WORKSPACE_SCOPE_UTIL = "WORKSPACE_SCOPE_UTIL";
@ -64,7 +61,8 @@ public class WsUtil {
public static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
public static final String URI_RESOLVER_SERVICE = "URI_RESOLVER_SERVICE";
public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER";
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; // IN
// DEV
/**
* Checks if is within portal.
@ -75,18 +73,17 @@ public class WsUtil {
try {
UserLocalServiceUtil.getService();
return true;
}
catch (Exception ex) {
} catch (Exception ex) {
logger.trace("Development Mode ON");
return false;
}
}
/**
* Gets the portal context.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the portal context
*/
public static PortalContextInfo getPortalContext(HttpServletRequest httpServletRequest) {
@ -103,15 +100,17 @@ public class WsUtil {
String userToken = pContext.getCurrentUserToken(httpServletRequest);
long currGroupId = pContext.getCurrentGroupId(httpServletRequest);
return new PortalContextInfo(username, fullName, email, avatarID, avatarURL, currentScope, userToken, currGroupId);
return new PortalContextInfo(username, fullName, email, avatarID, avatarURL, currentScope, userToken,
currGroupId);
}
/**
* Gets the portal context.
*
* @param httpServletRequest the http servlet request
* @param overrideScope the override scope
* @param httpServletRequest
* the http servlet request
* @param overrideScope
* the override scope
* @return the portal context
*/
public static PortalContextInfo getPortalContext(HttpServletRequest httpServletRequest, String overrideScope) {
@ -120,33 +119,36 @@ public class WsUtil {
return info;
}
/**
* Checks if is session expired.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return true, if is session expired
* @throws Exception the exception
* @throws Exception
* the exception
*/
public static boolean isSessionExpired(HttpServletRequest httpServletRequest) throws Exception {
logger.trace("workspace session validating...");
return PortalContext.getConfiguration().getCurrentUser(httpServletRequest) == null;
}
/**
* Gets the workspace.
*
* @param httpServletRequest the http servlet request
* @return the workspace
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
* @throws InternalErrorException the internal error exception
* @throws HomeNotFoundException the home not found exception
* @param httpServletRequest
* Servlet request
* @return Workspace
* @throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException
* Folder not found error
* @throws org.gcube.common.homelibrary.home.exceptions.InternalErrorException
* Internal error
* @throws HomeNotFoundException
* Home not found error
*/
public static Workspace getWorkspace(HttpServletRequest httpServletRequest) throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.exceptions.InternalErrorException, HomeNotFoundException
{
public static Workspace getWorkspace(HttpServletRequest httpServletRequest)
throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException,
org.gcube.common.homelibrary.home.exceptions.InternalErrorException, HomeNotFoundException {
logger.trace("Get Workspace");
PortalContextInfo info = getPortalContext(httpServletRequest);
@ -159,22 +161,32 @@ public class WsUtil {
return workspace;
}
/**
* Gets the workspace.
*
* @param httpServletRequest the http servlet request
* @param contextID the context id
* @param user the user
* @return the workspace
* @throws InternalErrorException the internal error exception
* @throws InternalErrorException the internal error exception
* @throws HomeNotFoundException the home not found exception
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
*
* @param httpServletRequest
* Workspace
* @param contextID
* contexId
* @param user
* user
* @return Workspace
* @throws InternalErrorException
* Internal error
* @throws HomeNotFoundException
* Home not found error
* @throws WorkspaceFolderNotFoundException
* Folder not found error
* @throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException
* folder not found error
* @throws org.gcube.common.homelibrary.home.exceptions.InternalErrorException
* internal error
*/
public static Workspace getWorkspace(HttpServletRequest httpServletRequest, String contextID, GCubeUser user) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.exceptions.InternalErrorException
{
public static Workspace getWorkspace(HttpServletRequest httpServletRequest, String contextID, GCubeUser user)
throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException,
org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException,
org.gcube.common.homelibrary.home.exceptions.InternalErrorException {
logger.info("Get workspace using contextID: " + contextID + ", current user: " + user.getUsername());
String currentScope;
@ -195,7 +207,8 @@ public class WsUtil {
String username = null;
try {
if (user.getUsername().compareTo(info.getUsername()) != 0) {
logger.debug("Gcube user read from Portal Context "+user.getUsername()+" is different by GCubeUser passed, using the second one: "+info.getUsername());
logger.debug("Gcube user read from Portal Context " + user.getUsername()
+ " is different by GCubeUser passed, using the second one: " + info.getUsername());
username = user.getUsername();
}
@ -214,11 +227,11 @@ public class WsUtil {
/**
* Gets the GWT workspace builder.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the GWT workspace builder
*/
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder(HttpServletRequest httpServletRequest)
{
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder(HttpServletRequest httpServletRequest) {
PortalContextInfo info = getPortalContext(httpServletRequest);
logger.trace("PortalContextInfo: " + info);
@ -229,22 +242,23 @@ public class WsUtil {
logger.info("Initializing the workspace area builder");
builder = new GWTWorkspaceBuilder();
// ADDED 03/09/2013
builder.setContexInfo(new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false), info.getCurrentScope());
builder.setContexInfo(
new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false),
info.getCurrentScope());
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
}
return builder;
}
/**
* Gets the notification manager.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the notification manager
*/
public static NotificationsManager getNotificationManager(HttpServletRequest httpServletRequest)
{
public static NotificationsManager getNotificationManager(HttpServletRequest httpServletRequest) {
PortalContextInfo info = getPortalContext(httpServletRequest);
HttpSession session = httpServletRequest.getSession();
NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER);
@ -252,28 +266,32 @@ public class WsUtil {
if (notifMng == null) {
try {
logger.trace("Create new NotificationsManager for user: " + info.getUsername());
logger.trace("New ApplicationNotificationsManager with portlet class name: "+NOTIFICATION_PORTLET_CLASS_ID);
logger.trace("New ApplicationNotificationsManager with portlet class name: "
+ NOTIFICATION_PORTLET_CLASS_ID);
SocialNetworkingSite site = new SocialNetworkingSite(httpServletRequest);
SocialNetworkingUser curser = new SocialNetworkingUser(info.getUsername(), info.getUserEmail(), info.getUserFullName(), info.getUserAvatarID());
notifMng = new ApplicationNotificationsManager(site, info.getCurrentScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
SocialNetworkingUser curser = new SocialNetworkingUser(info.getUsername(), info.getUserEmail(),
info.getUserFullName(), info.getUserAvatarID());
notifMng = new ApplicationNotificationsManager(site, info.getCurrentScope(), curser,
NOTIFICATION_PORTLET_CLASS_ID);
session.setAttribute(NOTIFICATION_MANAGER, notifMng);
} catch (Exception e) {
logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+info.getUsername(),e);
logger.error(
"An error occurred instancing ApplicationNotificationsManager for user: " + info.getUsername(),
e);
}
}
return notifMng;
}
/**
* Gets the notification producer.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the notification producer
*/
public static NotificationsProducer getNotificationProducer(HttpServletRequest httpServletRequest)
{
public static NotificationsProducer getNotificationProducer(HttpServletRequest httpServletRequest) {
PortalContextInfo info = getPortalContext(httpServletRequest);
HttpSession session = httpServletRequest.getSession();
NotificationsProducer notifProducer = (NotificationsProducer) session.getAttribute(NOTIFICATION_PRODUCER);
@ -286,11 +304,11 @@ public class WsUtil {
return notifProducer;
}
/**
* Gets the user id.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the user id
*/
public static String getUserId(HttpServletRequest httpServletRequest) {
@ -302,7 +320,8 @@ public class WsUtil {
/**
* Checks if is vre.
*
* @param scope the scope
* @param scope
* the scope
* @return true, if is vre
*/
public static boolean isVRE(String scope) {
@ -322,7 +341,8 @@ public class WsUtil {
/**
* Gets the scope util filter.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the scope util filter
*/
public static ScopeUtilFilter getScopeUtilFilter(HttpServletRequest httpServletRequest) {
@ -344,11 +364,11 @@ public class WsUtil {
return scopeUtil;
}
/**
* Gets the url shortener.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the url shortener
*/
public static UrlShortener getUrlShortener(HttpServletRequest httpServletRequest) {
@ -371,11 +391,11 @@ public class WsUtil {
return shortener;
}
/**
* Gets the uri resolver.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the uri resolver
*/
public static UriResolverReaderParameterForResolverIndex getUriResolver(HttpServletRequest httpServletRequest) {
@ -384,10 +404,12 @@ public class WsUtil {
PortalContextInfo info = getPortalContext(httpServletRequest);
UriResolverReaderParameterForResolverIndex uriResolver = null;
try {
uriResolver = (UriResolverReaderParameterForResolverIndex) session.getAttribute(WsUtil.URI_RESOLVER_SERVICE);
uriResolver = (UriResolverReaderParameterForResolverIndex) session
.getAttribute(WsUtil.URI_RESOLVER_SERVICE);
if (uriResolver == null) {
uriResolver = new UriResolverReaderParameterForResolverIndex(info.getCurrentScope(),RESOLVER_TYPE.SMP_ID);
uriResolver = new UriResolverReaderParameterForResolverIndex(info.getCurrentScope(),
RESOLVER_TYPE.SMP_ID);
session.setAttribute(URI_RESOLVER_SERVICE, uriResolver);
}
@ -401,11 +423,14 @@ public class WsUtil {
/**
* Gets the property special folder reader.
*
* @param httpServletRequest the http servlet request
* @param pathProperty the path property
* @param httpServletRequest
* the http servlet request
* @param pathProperty
* the path property
* @return the property special folder reader
*/
public static PropertySpecialFolderReader getPropertySpecialFolderReader(HttpServletRequest httpServletRequest, String pathProperty) {
public static PropertySpecialFolderReader getPropertySpecialFolderReader(HttpServletRequest httpServletRequest,
String pathProperty) {
HttpSession session = httpServletRequest.getSession();
PropertySpecialFolderReader psFolderReader = null;
@ -427,13 +452,19 @@ public class WsUtil {
/**
* Gets the storage hub wrapper.
*
* @param request the request
* @param scopeGroupId the scope group id. If scopeGroupId is null the scope is read by using the request else by using the scopeGroupId
* @param user the user
* @param request
* the request
* @param scopeGroupId
* the scope group id. If scopeGroupId is null the scope is read
* by using the request else by using the scopeGroupId
* @param user
* the user
* @return the storage hub wrapper
* @throws Exception the exception
* @throws Exception
* the exception
*/
public static StorageHubWrapper getStorageHubWrapper(final HttpServletRequest request, String scopeGroupId, GCubeUser user) throws Exception{
public static StorageHubWrapper getStorageHubWrapper(final HttpServletRequest request, String scopeGroupId,
GCubeUser user) throws Exception {
if (user == null || user.getUsername().isEmpty())
throw new Exception("Session expired");
@ -444,11 +475,11 @@ public class WsUtil {
if (WsUtil.isWithinPortal() && scopeGroupId != null) {
scope = pContext.getCurrentScope(scopeGroupId);
logger.debug(scope + " has retrieved by using the scopeGroupId=" + scopeGroupId);
}
else
} else
scope = pContext.getCurrentScope(request);
logger.debug("Getting "+StorageHubWrapper.class.getSimpleName()+" for user: "+user.getUsername() +" by using the scope: "+scope);
logger.debug("Getting " + StorageHubWrapper.class.getSimpleName() + " for user: " + user.getUsername()
+ " by using the scope: " + scope);
String token = pContext.getCurrentUserToken(scope, user.getUsername());
return new StorageHubWrapper(scope, token, false, false, true);
} catch (Exception e) {
@ -457,33 +488,36 @@ public class WsUtil {
}
}
/**
* Gets the storage hub to workpace converter.
*
* @param request the request
* @param scopeGroupId the scope group id
* @param user the user
* @param request
* the request
* @param scopeGroupId
* the scope group id
* @param user
* the user
* @return the storage hub to workpace converter
* @throws Exception the exception
* @throws Exception
* the exception
*/
public static StorageHubToWorkpaceConverter getStorageHubToWorkpaceConverter(final HttpServletRequest request, String scopeGroupId, GCubeUser user) throws Exception {
public static StorageHubToWorkpaceConverter getStorageHubToWorkpaceConverter(final HttpServletRequest request,
String scopeGroupId, GCubeUser user) throws Exception {
if (user == null || user.getUsername().isEmpty())
throw new Exception("Session expired");
try {
HttpSession session = request.getSession();
StorageHubToWorkpaceConverter converter = (StorageHubToWorkpaceConverter) session.getAttribute(WORKSPACE_STORAGE_HUB_CONVERTER);
StorageHubToWorkpaceConverter converter = (StorageHubToWorkpaceConverter) session
.getAttribute(WORKSPACE_STORAGE_HUB_CONVERTER);
String scope;
PortalContext pContext = PortalContext.getConfiguration();
if (WsUtil.isWithinPortal() && scopeGroupId != null) {
scope = pContext.getCurrentScope(scopeGroupId);
logger.debug(scope + " has retrieved by using the scopeGroupId=" + scopeGroupId);
}
else
} else
scope = pContext.getCurrentScope(request);
if (converter == null) {
@ -498,12 +532,13 @@ public class WsUtil {
}
}
/**
* Checks if is root folder.
*
* @param folder the folder
* @param converter the converter
* @param folder
* the folder
* @param converter
* the converter
* @return true, if is root folder
*/
public static boolean isRootFolder(FileModel folder, StorageHubToWorkpaceConverter converter) {
@ -518,47 +553,55 @@ public class WsUtil {
}
// /**
// * Gets the notification manager to storage hub.
// *
// * @param httpServletRequest the http servlet request
// * @return the notification manager to storage hub
// */
// public static NotificationsManager getNotificationManagerToStorageHub(HttpServletRequest httpServletRequest)
// public static NotificationsManager
// getNotificationManagerToStorageHub(HttpServletRequest httpServletRequest)
// {
// PortalContextInfo info = getPortalContext(httpServletRequest);
// HttpSession session = httpServletRequest.getSession();
// NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER_TO_STORAGEHUB);
// NotificationsManager notifMng = (NotificationsManager)
// session.getAttribute(NOTIFICATION_MANAGER_TO_STORAGEHUB);
//
// if (notifMng == null) {
// try{
// logger.trace("Create new NotificationsManager for user: "+info.getUsername());
// logger.trace("New ApplicationNotificationsManager with portlet class name: "+NOTIFICATION_PORTLET_CLASS_ID);
// logger.trace("Create new NotificationsManager for user:
// "+info.getUsername());
// logger.trace("New ApplicationNotificationsManager with portlet class
// name: "+NOTIFICATION_PORTLET_CLASS_ID);
// SocialNetworkingSite site = new SocialNetworkingSite(httpServletRequest);
// SocialNetworkingUser curser = new SocialNetworkingUser(info.getUsername(), info.getUserEmail(), info.getUserFullName(), info.getUserAvatarID());
// notifMng = new ApplicationNotificationsManager(site, info.getCurrentScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
// SocialNetworkingUser curser = new
// SocialNetworkingUser(info.getUsername(), info.getUserEmail(),
// info.getUserFullName(), info.getUserAvatarID());
// notifMng = new ApplicationNotificationsManager(site,
// info.getCurrentScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
// session.setAttribute(NOTIFICATION_MANAGER_TO_STORAGEHUB, notifMng);
// }catch (Exception e) {
// logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+info.getUsername(),e);
// logger.error("An error occurred instancing
// ApplicationNotificationsManager for user: "+info.getUsername(),e);
// }
// }
//
// return notifMng;
// }
/**
* Gets the notification producer to storage hub.
*
* @param httpServletRequest the http servlet request
* @param httpServletRequest
* the http servlet request
* @return the notification producer to storage hub
*/
public static NotificationsProducerToStorageHub getNotificationProducerToStorageHub(HttpServletRequest httpServletRequest)
{
public static NotificationsProducerToStorageHub getNotificationProducerToStorageHub(
HttpServletRequest httpServletRequest) {
PortalContextInfo info = getPortalContext(httpServletRequest);
HttpSession session = httpServletRequest.getSession();
NotificationsProducerToStorageHub notifProducer = (NotificationsProducerToStorageHub) session.getAttribute(NOTIFICATION_PRODUCER_TO_STORAGEHUB);
NotificationsProducerToStorageHub notifProducer = (NotificationsProducerToStorageHub) session
.getAttribute(NOTIFICATION_PRODUCER_TO_STORAGEHUB);
if (notifProducer == null) {
logger.trace("Create new Notification Producer for user: " + info.getUsername());
@ -568,5 +611,4 @@ public static NotificationsProducerToStorageHub getNotificationProducerToStorage
return notifProducer;
}
}

View File

@ -8,7 +8,6 @@ import java.util.Map;
import org.apache.log4j.Logger;
public class ScopeUtilFilter {
private static final String SCOPE_SEPARATOR = "/";
@ -22,7 +21,9 @@ public class ScopeUtilFilter {
/**
*
* @param scopeName
* @param addIdAllSpaces if true add "ID All spaces" - "All spaces" pair into map
* scope name
* @param addIdAllSpaces
* if true add "ID All spaces" - "All spaces" pair into map
*/
public ScopeUtilFilter(String scopeName, boolean addIdAllSpaces) {
@ -32,14 +33,14 @@ public class ScopeUtilFilter {
if (scopes != null && scopes.length > 1) {
scopeRoot = SCOPE_SEPARATOR + scopes[1];
logger.trace("found root " + scopeRoot);
}
else{
} else {
logger.warn("root scope not found!");
scopeRoot = SCOPE_SEPARATOR;
}
if (addIdAllSpaces)
hashScopesFiltered.put(ALLSCOPE, IDALLSCOPE); //PUT DEFAULT ID ALL SCOPE
hashScopesFiltered.put(ALLSCOPE, IDALLSCOPE); // PUT DEFAULT ID
// ALL SCOPE
}
}
@ -90,7 +91,6 @@ public class ScopeUtilFilter {
return scopesConverted;
}
public String getPortalScopeFromFilteredScope(String scope) {
String portalScope = hashScopesFiltered.get(scope);
@ -107,7 +107,6 @@ public class ScopeUtilFilter {
return hashScopesFiltered;
}
// TEST
private void printScopeName(String scopeName) {
@ -118,7 +117,6 @@ public class ScopeUtilFilter {
}
}
private void printScopes() {
for (String key : hashScopesFiltered.keySet()) {
@ -134,7 +132,8 @@ public class ScopeUtilFilter {
public static void main(String[] args) {
String scope = "/gcube";
List<String> listTest = Arrays.asList(new String[]{"/gcube/devsec/devre", "/gcube/devsec","/gcube/devsec/devNEXT", "/", "/gcub", "/gcube"});
List<String> listTest = Arrays.asList(new String[] { "/gcube/devsec/devre", "/gcube/devsec",
"/gcube/devsec/devNEXT", "/", "/gcub", "/gcube" });
ScopeUtilFilter filter = new ScopeUtilFilter(scope, false);
@ -142,12 +141,10 @@ public class ScopeUtilFilter {
filter.convertListScopeToPortlet(listTest);
System.out.println("get portal scope for /devsec: " + filter.getPortalScopeFromFilteredScope("/devsec"));
filter.printScopes();
}
}

View File

@ -15,25 +15,16 @@ import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
*/
public class TrashContent implements Serializable{
/**
*
*/
private static final long serialVersionUID = -7428752149892396573L;
List<FileTrashedModel> trashContent;
List<FileTrashedModel> listErrors;
/**
*
*/
public TrashContent() {
}
/**
* @param trashContent
* @param listErrors
*/
public TrashContent(List<FileTrashedModel> trashContent, List<FileTrashedModel> listErrors) {
this.trashContent = trashContent;
this.listErrors = listErrors;

View File

@ -12,25 +12,14 @@ import java.util.List;
*/
public class TrashOperationContent extends TrashContent{
/**
*
*/
private static final long serialVersionUID = 3089944053784656200L;
private List<String> listTrashIds;
private WorkspaceTrashOperation operation;
/**
*
*/
public TrashOperationContent() {
}
/**
* @param trashContent
* @param listErrors
*/
public TrashOperationContent(WorkspaceTrashOperation operation, List<String> listTrashIds) {
this.listTrashIds = listTrashIds;
this.operation = operation;

View File

@ -4,9 +4,7 @@ import java.io.Serializable;
public class UserBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6779963164440480883L;
private String username;
@ -25,36 +23,25 @@ public class UserBean implements Serializable {
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @return the firstName
*/
public String getFirstName() {
return firstName;
}
/**
* @return the lastName
*/
public String getLastName() {
return lastName;
}
/**
* @return the email
*/
public String getEmail() {
return email;

View File

@ -12,10 +12,6 @@ import java.io.Serializable;
*/
public class WorkspaceUserQuote implements Serializable{
/**
*
*/
private static final long serialVersionUID = -5363340286390074157L;
@ -28,11 +24,6 @@ public class WorkspaceUserQuote implements Serializable{
/**
* @param diskSpace
* @param diskSpaceFormatted
* @param totalItems
*/
public WorkspaceUserQuote(Long diskSpace, String diskSpaceFormatted,
Long totalItems) {
this.diskSpace = diskSpace;

View File

@ -3,7 +3,6 @@
*/
package org.gcube.portlets.user.workspace.shared.accounting;
/**
* The Enum GxtAccountingEntryType.
*
@ -48,8 +47,10 @@ public enum GxtAccountingEntryType {
/**
* Instantiates a new gxt accounting entry type.
*
* @param id the id
* @param name the name
* @param id
* the id
* @param name
* the name
*/
GxtAccountingEntryType(String id, String name) {
this.id = id;
@ -69,7 +70,8 @@ public enum GxtAccountingEntryType {
/**
* Sets the id.
*
* @param id the new id
* @param id
* the new id
*/
public void setId(String id) {
this.id = id;
@ -87,7 +89,8 @@ public enum GxtAccountingEntryType {
/**
* Sets the name.
*
* @param name the new name
* @param name
* the new name
*/
public void setName(String name) {
this.name = name;

View File

@ -15,9 +15,6 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
*/
public class GxtAccountingField implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2114527164447302004L;
private InfoContactModel user;
@ -29,12 +26,6 @@ public class GxtAccountingField implements Serializable {
}
/**
* @param description
* @param user
* @param date
* @param operation
*/
public GxtAccountingField(String description, InfoContactModel user,
Date date, GxtAccountingEntryType operation) {
setUser(user);