diff --git a/pom.xml b/pom.xml
index 9b369cd..9118d79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
org.gcube.portlets.user
workspace-tree-widget
- 6.6.8-SNAPSHOT
+ 6.7.0-SNAPSHOT
gCube Workspace Tree Widget
gCube Workspace Tree Widget.
@@ -326,7 +326,7 @@
- compile
+
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java
index 948eaa7..1d11231 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java
@@ -138,6 +138,7 @@ import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExterna
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTUrlDocument;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
+import org.gcube.portlets.user.workspace.shared.UserBean;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEvent;
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEventHandler;
@@ -180,6 +181,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private boolean selectRootItem;
private FileUploader fileUploader;
public static String myLogin;
+ public static String myLoginFirstName;
private static AppControllerExplorer singleton;
@@ -2200,7 +2202,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private void loadMyLogin(){
- rpcWorkspaceService.getMyLogin(new AsyncCallback() {
+ rpcWorkspaceService.getMyLogin(new AsyncCallback() {
@Override
public void onFailure(Throwable caught) {
@@ -2210,9 +2212,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}
@Override
- public void onSuccess(String result) {
- GWT.log("My login is: "+result);
- myLogin = result;
+ public void onSuccess(UserBean user) {
+ GWT.log("My login is: "+user.getUsername());
+ myLogin = user.getUsername();
+ myLoginFirstName = user.getFirstName();
}
});
}
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java
index 2fbca1d..a6c9785 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java
@@ -5,6 +5,9 @@ import com.google.gwt.resources.client.ImageResource;
public interface Icons extends ClientBundle {
+ @Source("icons/cloud-drive.png")
+ ImageResource cloudDrive();
+
@Source("icons/table.png")
ImageResource table();
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java
index 12b564b..8834a62 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java
@@ -39,7 +39,11 @@ public class Resources {
private static final String PPTX = "vnd.openxmlformats-officedocument.presentationml.presentation";
private static final String XSLX = "vnd.openxmlformats-officedocument.spreadsheetml.sheet";
-
+ public static AbstractImagePrototype getCloudDriveIcon(){
+
+ return AbstractImagePrototype.create(ICONS.cloudDrive());
+ }
+
public static AbstractImagePrototype getIconTable(){
return AbstractImagePrototype.create(ICONS.table());
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/cloud-drive.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/cloud-drive.png
new file mode 100644
index 0000000..a125651
Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/cloud-drive.png differ
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java
index e2bedc4..274c6c9 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java
@@ -20,6 +20,7 @@ import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
import org.gcube.portlets.user.workspace.shared.TrashContent;
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
+import org.gcube.portlets.user.workspace.shared.UserBean;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
@@ -30,101 +31,101 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("WorkspaceService")
public interface GWTWorkspaceService extends RemoteService{
- /** SendToRequest **/
+ String getUserWorkspaceSize() throws Exception;
public FolderModel getRootForTree() throws Exception;
-
+
public FolderModel getRootForTree(String scopeId) throws Exception;
-
+
public List getAllScope() throws Exception;
-
+
public List getFolderChildren(FolderModel folder) throws Exception, SessionExpiredException;
-
+
public List getFolderChildrenForFileGrid(FileModel folder) throws Exception, SessionExpiredException;
-
+
public FileDetailsModel getDetailsFile(FileModel item) throws Exception;
-
+
public FolderModel createFolder(String nameFolder, String description, FileModel parent) throws Exception;
-
+
public ArrayList getChildrenSubTreeToRootByIdentifier(String itemIdentifier) throws Exception;
-
+
public List getSmartFolderResultsByCategory(String category) throws Exception;
-
+
public SmartFolderModel createSmartFolder(String name, String description, String query) throws Exception;
-
+
public List getSmartFolderResultsById(String folderId) throws Exception;
-
+
public List getAllSmartFolders() throws Exception;
-
+
public GWTWorkspaceItem getImageById(String identifier, boolean isInteralImage, boolean fullDetails) throws Exception;
-
+
public GWTWorkspaceItem getUrlById(String identifier, boolean isInternalUrl, boolean fullDetails) throws Exception;
-
+
public FileModel createExternalUrl(FileModel parentFileModel, String name, String description, String url) throws Exception;
-
+
public void setValueInSession(String name, String value) throws Exception;
public List getItemsBySearchName(String text) throws Exception;
-
+
public Boolean moveItem(String itemId, String destinationId) throws Exception;
-
+
public Boolean removeItem(String itemId) throws Exception;
-
+
public Boolean renameItem(String itemId, String newName, String oldName) throws Exception;
-
+
public Boolean removeSmartFolder(String itemId, String name) throws Exception;
-
+
public List getAllContacts() throws Exception;
-
+
public String getUrlWebDav(String itemId) throws Exception;
-
-// public boolean sendTo(List listContacts, List listAttachments, String subject, String text) throws Exception;
-
+
+ // public boolean sendTo(List listContacts, List listAttachments, String subject, String text) throws Exception;
+
public boolean sentToByMessageModel(MessageModel message) throws Exception;
public boolean sendToById(List listContactsId, List listAttachmentsId, String subject, String text) throws Exception;
-
+
public List getAllMessagesReceived() throws Exception;
-
+
public List getNewMessagesReceived() throws Exception;
-
+
public List getAllMessagesSent() throws Exception;
-
+
public List searchInSentMessagesByText(String text) throws Exception;
-
+
public List searchInReceivedMessagesByText(String text) throws Exception;
-
+
public MessageModel getMessageById(String messageIdentifier, String messageType) throws Exception;
-
+
public boolean saveAttachments(String messageIdentifier, String messageType) throws Exception;
-
+
public boolean saveAttach(String attachId) throws Exception;
-
+
public boolean markMessage(String messageIdentifier, String messageType, boolean boolMark, String markType) throws Exception;
-
+
public boolean deleteMessage(String messageIdentifier, String messageType) throws Exception;
-
+
public boolean copyItem(String itemId, String destinationFolderId) throws Exception;
-
+
public List getListFolderBulkCreator() throws Exception;
-
+
public boolean deleteBulk(String bulkId) throws Exception;
-
+
public GWTWorkspaceItem getTimeSeriesById(String identifier) throws Exception;
boolean shareFolder(FileModel folder, List listContacts,
boolean isNewFolder, WorkspaceACL acl) throws Exception;
-
+
public List getListUserSharedByFolderSharedId(String itemId) throws Exception;
-
+
public boolean unSharedFolderByFolderSharedId(String folderSharedId) throws Exception;
-
+
public List getListParentsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception;
public String getURLFromApplicationProfile(String oid) throws Exception;
public InfoContactModel getOwnerByItemId(String itemId) throws Exception;
-
+
public String itemExistsInWorkpaceFolder(String parentId, String itemName) throws Exception;
public List getListUserSharedBySharedItem(String sharedItemId) throws Exception;
@@ -165,7 +166,7 @@ public interface GWTWorkspaceService extends RemoteService{
* @throws Exception
*/
List getFolderChildrenForFileGridById(String folderId) throws Exception, SessionExpiredException;
-
+
String getShortUrl(String longUrl) throws Exception;
/**
@@ -178,8 +179,8 @@ public interface GWTWorkspaceService extends RemoteService{
throws Exception;
boolean isSessionExpired() throws Exception;
-
-
+
+
void deleteListItemsForIds(List ids) throws Exception;
/**
@@ -204,7 +205,7 @@ public interface GWTWorkspaceService extends RemoteService{
void setACLs(String folderId, List listLogins, String aclType)
throws Exception;
- String getMyLogin();
+ UserBean getMyLogin();
void updateACLForVREbyGroupName(String folderId, String aclType) throws Exception;
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java
index 610bff9..859b6d1 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java
@@ -19,6 +19,7 @@ import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
import org.gcube.portlets.user.workspace.shared.TrashContent;
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
+import org.gcube.portlets.user.workspace.shared.UserBean;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
@@ -26,7 +27,8 @@ import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface GWTWorkspaceServiceAsync {
-
+ void getUserWorkspaceSize(AsyncCallback callback);
+
void getRootForTree(AsyncCallback callback);
void getRootForTree(String scopeId, AsyncCallback callback);
@@ -182,7 +184,7 @@ public interface GWTWorkspaceServiceAsync {
void setACLs(String folderId, List listLogins, String aclType,
AsyncCallback callback);
- void getMyLogin(AsyncCallback callback);
+ void getMyLogin(AsyncCallback callback);
void updateACLForVREbyGroupName(String folderId, String aclType,
AsyncCallback callback);
@@ -216,4 +218,6 @@ public interface GWTWorkspaceServiceAsync {
void getACLBySharedFolderId(String identifier, AsyncCallback callback);
+
+
}
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java
index 4cffd3d..47a112a 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java
@@ -61,6 +61,8 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class AsyncTreePanel extends LayoutContainer {
private static final String TREE_MESSAGE_PANEL_ASYNC = "treeMessagePanelAsync";
+
+ private static final String ROOT_SUFFIX = "'s workspace";
// private TreeLoader loader;
private TreePanel treePanel;
private TreeStore store;
@@ -147,6 +149,10 @@ public class AsyncTreePanel extends LayoutContainer {
return Resources.getIconByFolderItemType(model.getGXTFolderItemType());
}
+ if (model.isRoot()) {
+ model.setName(AppControllerExplorer.myLoginFirstName+ROOT_SUFFIX);
+ return Resources.getCloudDriveIcon();
+ }
if(model.getStatus() == ConstantsExplorer.FOLDERNOTLOAD)
return Resources.getIconLoading2();
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java
index 2071dd9..ab5e647 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java
@@ -7,6 +7,7 @@ import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
+import org.gcube.portlets.user.workspace.client.model.FolderGridModel;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
@@ -103,7 +104,6 @@ public class DialogGetInfo extends Dialog {
textFieldSetValue(txtCategory,fileModel.getShortcutCategory());
add(txtCategory);
-
txtOwner = new TextField();
txtOwner.setFieldLabel("Owner");
txtOwner.setReadOnly(true);
@@ -247,7 +247,7 @@ public class DialogGetInfo extends Dialog {
}
private void loadSize(final String itemId){
-
+ GWT.log("Load size");
txtSize.mask();
AppControllerExplorer.rpcWorkspaceService.loadSizeByItemId(itemId, new AsyncCallback() {
@@ -260,6 +260,7 @@ public class DialogGetInfo extends Dialog {
@Override
public void onSuccess(Long result) {
+ GWT.log("Loaded size="+result);
textFieldSetValue(txtSize,getFormattedSize(result));
txtSize.unmask();
}
diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java
index 66a0749..d8db8db 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java
@@ -1108,7 +1108,6 @@ public class GWTWorkspaceBuilder {
case FOLDER:
// fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, -1, true, false);
-
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModificationTime()), parentFileModel, -1, true, false,false);
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java
index 3e91df4..d8e5323 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java
@@ -1,6 +1,7 @@
package org.gcube.portlets.user.workspace.server;
import java.io.File;
+import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -41,6 +42,7 @@ import org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessage;
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashFolder;
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashItem;
import org.gcube.common.scope.api.ScopeProvider;
+import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategoryItemInterface;
import org.gcube.portlets.user.workspace.client.model.BulkCreatorModel;
@@ -71,6 +73,7 @@ import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
import org.gcube.portlets.user.workspace.shared.TrashContent;
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
+import org.gcube.portlets.user.workspace.shared.UserBean;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
@@ -82,6 +85,9 @@ import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+import com.liferay.portal.kernel.exception.PortalException;
+import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.service.UserLocalServiceUtil;
/**
@@ -2178,10 +2184,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
NotificationsProducer np = getNotificationProducer();
List purgeMyContact = new ArrayList(contacts.size()-1);
- String myLogin = getMyLogin();
+ String myLogin = getMyLogin().getUsername();
workspaceLogger.trace("Preparing list of contacts to send un share notification");
for (InfoContactModel infoContactModel : contacts) {
- if(infoContactModel.getLogin().compareToIgnoreCase(getMyLogin())==0)
+ if(infoContactModel.getLogin().compareToIgnoreCase(getMyLogin().getUsername())==0)
workspaceLogger.trace("skipping my login "+myLogin);
else
purgeMyContact.add(infoContactModel);
@@ -2420,6 +2426,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
FolderItem folderItem = (FolderItem) wsItem;
size = new Long(folderItem.getLength());
+ } else if (wsItem instanceof WorkspaceFolder ){
+ WorkspaceFolder theFolder = (WorkspaceFolder) wsItem;
+ size = theFolder.getSize();
}
return size;
@@ -2744,10 +2753,43 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
}
}
+ /**
+ *
+ * @return true if you're running into the portal, false if in development
+ */
+ private boolean isWithinPortal() {
+ try {
+ UserLocalServiceUtil.getService();
+ return true;
+ }
+ catch (Exception ex) {
+ workspaceLogger.trace("Development Mode ON");
+ return false;
+ }
+ }
+
@Override
- public String getMyLogin(){
+ public UserBean getMyLogin(){
ASLSession asl = WsUtil.getAslSession(this.getThreadLocalRequest().getSession());
- return asl.getUsername();
+ String username = asl.getUsername();
+ String email = username+"@isti.cnr.it";
+ String firstName = "Testing";
+ String lastName = "User";
+
+
+ if (isWithinPortal() && username.compareTo(WsUtil.TEST_USER) != 0) {
+ com.liferay.portal.model.UserModel user = null;
+ try {
+ user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
+ firstName = user.getFirstName();
+ lastName = user.getLastName();
+ email = user.getEmailAddress();
+ } catch (PortalException | SystemException e) {
+ e.printStackTrace();
+ }
+
+ }
+ return new UserBean(username, firstName, lastName, email);
}
/**
@@ -3179,5 +3221,41 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
throw new Exception(error);
}
}
+
+ @Override
+ public String getUserWorkspaceSize() throws Exception {
+ Workspace workspace = getWorkspace();
+ return formatFileSize(workspace.getRoot().getSize());
+ }
+ /**
+ * returns dynamically the formated size
+ * @param size
+ * @return
+ */
+ private static String formatFileSize(long size) {
+ String formattedSize = null;
+
+ double b = size;
+ double k = size/1024.0;
+ double m = ((size/1024.0)/1024.0);
+ double g = (((size/1024.0)/1024.0)/1024.0);
+ double t = ((((size/1024.0)/1024.0)/1024.0)/1024.0);
+
+ DecimalFormat dec = new DecimalFormat("0.00");
+
+ if ( t>1 ) {
+ formattedSize = dec.format(t).concat(" TB");
+ } else if ( g>1 ) {
+ formattedSize = dec.format(g).concat(" GB");
+ } else if ( m>1 ) {
+ formattedSize = dec.format(m).concat(" MB");
+ } else if ( k>1 ) {
+ formattedSize = dec.format(k).concat(" KB");
+ } else {
+ formattedSize = dec.format(b).concat(" Bytes");
+ }
+
+ return formattedSize;
+ }
}
diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java
index 171af36..f34d107 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java
@@ -26,6 +26,8 @@ import org.gcube.portlets.user.workspace.server.shortener.UrlShortener;
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
+import com.liferay.portal.service.UserLocalServiceUtil;
+
/**
*
@@ -63,14 +65,29 @@ public class WsUtil {
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
//UNCOMMENT THIS FOR RELEASE
- public static final String TEST_USER = "test.user";
- public static final String TEST_USER_FULL_NAME = "Test User";
+ public static String TEST_USER = "test.user";
+ public static String TEST_USER_FULL_NAME = "Test User";
protected static Logger logger = Logger.getLogger(WsUtil.class);
public static boolean withoutPortal = false;
+ /**
+ *
+ * @return true if you're running into the portal, false if in development
+ */
+ private static boolean isWithinPortal() {
+ try {
+ UserLocalServiceUtil.getService();
+ return true;
+ }
+ catch (Exception ex) {
+ logger.trace("Development Mode ON");
+ return false;
+ }
+ }
+
public static ASLSession getAslSession(HttpSession httpSession)
{
String sessionID = httpSession.getId();
@@ -85,7 +102,10 @@ public class WsUtil {
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
// user = "francesco.mangiacrapa";
-// user = "valentina.marioli";
+ if (! isWithinPortal()) {
+ TEST_USER = "luca.frosini";
+ TEST_USER_FULL_NAME = "Andrea Rossi";
+ }
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
logger.warn("session id: "+sessionID);
diff --git a/src/main/java/org/gcube/portlets/user/workspace/shared/UserBean.java b/src/main/java/org/gcube/portlets/user/workspace/shared/UserBean.java
new file mode 100644
index 0000000..3af64ad
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/workspace/shared/UserBean.java
@@ -0,0 +1,52 @@
+package org.gcube.portlets.user.workspace.shared;
+
+import java.io.Serializable;
+
+@SuppressWarnings("serial")
+public class UserBean implements Serializable {
+ private String username;
+ private String firstName;
+ private String lastName;
+ private String email;
+
+
+
+
+ public UserBean(String username, String firstName, String lastName,
+ String email) {
+ super();
+ this.username = username;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.email = email;
+ }
+ public UserBean() {
+ }
+ public String getUsername() {
+ return username;
+ }
+ public void setUsername(String username) {
+ this.username = username;
+ }
+ public String getFirstName() {
+ return firstName;
+ }
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+ public String getLastName() {
+ return lastName;
+ }
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+ public String getEmail() {
+ return email;
+ }
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+
+
+}