Ticket #1781: was implemented and the enhancement is released on devportal
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@81026 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1112123dd7
commit
e62995d5af
|
@ -113,7 +113,8 @@ public class ConstantsExplorer {
|
|||
public static final String ISSHARED = "isShared";
|
||||
public static final String LASTMODIFIED = "lastModified";
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String OWNER = "owner";
|
||||
public static final String OWNER = "Owner";
|
||||
public static final String OWNERFULLNAME = "Owner Name";
|
||||
public static final String QUERY = "query";
|
||||
public static final String FOLDERNOTLOAD = "notload";
|
||||
public static final String FOLDERLOADED = "loaded";
|
||||
|
@ -207,4 +208,5 @@ public class ConstantsExplorer {
|
|||
public static final String ID_FOLDER = "idFolder";
|
||||
public static final String UPLOAD_FORM_ELEMENT = "uploadFormElement";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -136,6 +136,9 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
|
||||
public void setOwner(InfoContactModel owner){
|
||||
set(ConstantsExplorer.OWNER, owner);
|
||||
|
||||
if(owner!=null)
|
||||
set(ConstantsExplorer.OWNERFULLNAME, owner.getName());
|
||||
}
|
||||
|
||||
public void setMarkAsRead(boolean mark){
|
||||
|
@ -151,6 +154,10 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
return (InfoContactModel) get(ConstantsExplorer.OWNER);
|
||||
}
|
||||
|
||||
public String getOwnerFullName(){
|
||||
return get(ConstantsExplorer.OWNERFULLNAME);
|
||||
}
|
||||
|
||||
public void setSharingValue(boolean isShared, List<InfoContactModel> listShareUsers){
|
||||
set(ConstantsExplorer.ISSHARED, isShared);
|
||||
set(ConstantsExplorer.SHAREUSERS, listShareUsers);
|
||||
|
|
|
@ -101,6 +101,7 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
protected static final String IMAGE_SERVICE_URL = "ImageService";
|
||||
protected GCUBEClientLog logger;
|
||||
private InfoContactModel userLogged;
|
||||
protected static HashMap<String, InfoContactModel> hashTestUser = null;
|
||||
// private final String UNKNOWN = "unknown";
|
||||
// private final String FOLDER = "Folder";
|
||||
|
@ -1030,6 +1031,8 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
}
|
||||
|
||||
//TODO SETTING OWNER, ISSHARED IN SEARCH ITEM
|
||||
|
||||
//ACCOUNTING
|
||||
// fileGridModel.setMarkAsRead(item.isMarkedAsRead());
|
||||
|
||||
|
@ -1074,7 +1077,6 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
FolderItem folderItem = (FolderItem) item;
|
||||
fileGridModel = new FileGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, folderItem.getLength(), false, false);
|
||||
// FolderItem folderItem = (FolderItem) item;
|
||||
fileGridModel = (FileGridModel) setFolderItemType(fileGridModel, folderItem);
|
||||
break;
|
||||
|
||||
|
@ -1100,7 +1102,22 @@ public class GWTWorkspaceBuilder {
|
|||
fileGridModel.setShareable(false);
|
||||
}
|
||||
|
||||
// fileGridModel.setOwner(new InfoContactModel(item.getOwner().getId(), item.getOwner().getPortalLogin(), "name"));
|
||||
//OWNER
|
||||
if(item.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED
|
||||
if(item.getOwner()!=null){
|
||||
String portalLogin = item.getOwner().getPortalLogin();
|
||||
String fullName = portalLogin;
|
||||
|
||||
if(!WsUtil.withoutPortal) //INTO PORTAL
|
||||
fullName = UserUtil.getUserFullName(portalLogin);
|
||||
|
||||
fileGridModel.setOwner(new InfoContactModel(item.getOwner().getId(), portalLogin, fullName));
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(userLogged!=null)
|
||||
fileGridModel.setOwner(new InfoContactModel(userLogged.getId(), userLogged.getLogin(), userLogged.getName()));
|
||||
}
|
||||
//// fileGridModel.setShared(item.isShared());
|
||||
// fileGridModel.setMarkAsRead(item.isMarkedAsRead());
|
||||
|
||||
|
@ -1994,4 +2011,12 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
return listAccFields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param infoContactModel
|
||||
*/
|
||||
public void setUserLogged(InfoContactModel infoContactModel) {
|
||||
this.userLogged = infoContactModel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,11 @@ public class UserUtil {
|
|||
public static String getUserFullName(String portalLogin){
|
||||
// return user.getPortalLogin(); //for testing in eclipse
|
||||
|
||||
logger.trace("Finding full name for: "+portalLogin);
|
||||
|
||||
if(portalLogin==null)
|
||||
return "";
|
||||
|
||||
if (portalLogin.compareTo(WsUtil.TEST_USER) != 0) { //skip test.user
|
||||
|
||||
UserModel curr = null;
|
||||
|
@ -45,14 +50,25 @@ public class UserUtil {
|
|||
}
|
||||
} catch (UserManagementPortalException ume) {
|
||||
logger.error("An error occurred in getUserFullName "+ume,ume);
|
||||
}catch (Exception e) {
|
||||
logger.error("An error occurred in getUserFullName "+e,e);
|
||||
logger.warn("Return portal login "+portalLogin);
|
||||
return portalLogin;
|
||||
}
|
||||
|
||||
if (curr != null){
|
||||
|
||||
logger.trace("Return "+curr.getFullname() +" full name for: "+portalLogin);
|
||||
return curr.getFullname();
|
||||
|
||||
}
|
||||
if (curr != null)
|
||||
return curr.getFullname();
|
||||
}else{
|
||||
|
||||
logger.trace("Return "+WsUtil.TEST_USER_FULL_NAME +" full name for: "+portalLogin);
|
||||
return WsUtil.TEST_USER_FULL_NAME;
|
||||
}
|
||||
|
||||
logger.trace("Return empty full name for: "+portalLogin);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException
|
|||
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
||||
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
||||
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
||||
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameter;
|
||||
|
@ -71,8 +72,8 @@ public class WsUtil {
|
|||
|
||||
if (user == null) {
|
||||
|
||||
// user=TEST_USER;
|
||||
user = "francesco.mangiacrapa";
|
||||
user=TEST_USER;
|
||||
// user = "francesco.mangiacrapa";
|
||||
|
||||
defaultLogger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
||||
defaultLogger.warn("session id: "+sessionID);
|
||||
|
@ -152,6 +153,10 @@ public class WsUtil {
|
|||
logger.trace("Initializing the workspace area builder");
|
||||
|
||||
GWTWorkspaceBuilder builder = new GWTWorkspaceBuilder();
|
||||
|
||||
//ADDED 03/09/2013
|
||||
builder.setUserLogged(new InfoContactModel(session.getUsername(), session.getUsername(), session.getUserFullName()));
|
||||
|
||||
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue